On 06/03/14 15:59, 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:]
I would use os.path.sep instead of "/".
[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files