On 06/ 3/14 04:32 PM, Edward Pilatowicz wrote:
On Tue, Jun 03, 2014 at 03:59:31PM -0700, Erik Trauschke wrote:
This is a small fix for
18877276 first character trimmed from display of salvaged files
This code hasn't changed in a while. The reason this worked until
recently was that image.get_root() would return "//" for the live
image. I think this got fixed with Ed's li alternate path fixes.
The fix below takes care of all sorts of paths, it should also work
if there are double slashes or any other craziness in the path.
diff -r 7863650e8a13 src/modules/client/pkgplan.py
--- a/src/modules/client/pkgplan.py Fri May 30 15:21:07 2014 -0700
+++ b/src/modules/client/pkgplan.py Tue Jun 03 15:54:10 2014 -0700
@@ -578,8 +578,11 @@
spath = self.image.salvage(path)
- # get just the file path that was salvaged
- fpath = path[len(self.image.get_root()) + 1:]
+ # get just the file path that was salvaged
+ fpath = path.replace(
+ os.path.normpath(self.image.get_root()), "", 1)
+ if fpath.startswith("/"):
+ fpath = fpath[1:]
def salvage_from(self, local_path, full_destination):
this code assumes that fpath will always be prefixed by the result of
get_root(). if this assumption is ever violated this code will break.
hence, i'd recommend assert()ing this assumption:
The problem I have with this is that we are talking mainly about a
display issue here. So instead of having an incorrect display, you want
to terminate the pkg application?
I think it might be better to just check for this and set fpath to path
if the root is missing from path.
[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files