Skip to main content

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

  • From: Erik Trauschke < >
  • To: Shawn Walker < >
  • Cc:
  • Subject: [pkg-discuss] Re: [review] 18877276 first character trimmed from display of salvaged files
  • Date: Wed, 04 Jun 2014 10:07:47 -0700



On 06/ 4/14 10:02 AM, Shawn Walker wrote:
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.


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:]

I would use os.path.sep instead of "/".

Good call. I'll change that.

Erik


[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