Skip to main content

[pkg-discuss] [review] 18877276 first character trimmed from display of salvaged files

  • From: Erik Trauschke < >
  • To: " " < >
  • Subject: [pkg-discuss] [review] 18877276 first character trimmed from display of salvaged files
  • Date: Tue, 03 Jun 2014 15:59:31 -0700

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.


Thanks
Erik

---
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 @@

                 assert self._executed
                 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:]
                 self.image.imageplan.pd._salvaged.append((fpath, spath))

         def salvage_from(self, local_path, full_destination):


[pkg-discuss] [review] 18877276 first character trimmed from display of salvaged files

Erik Trauschke 06/03/2014

[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files

Edward Pilatowicz 06/03/2014

[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files

Erik Trauschke 06/04/2014

[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files

Shawn Walker 06/04/2014

[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files

Shawn Walker 06/04/2014

[pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files

Erik Trauschke 06/04/2014
 
 
Close
loading
Please Confirm
Close