[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH 1/2] Handle roots with or without trailing "/" in FileDevice.path. (#541473)



Hi,

All 3 look good, ack.

Regards,

Hans


On 12/06/2009 11:40 PM, David Lehman wrote:
---
  storage/devices.py |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index b4a518e..7b2e30c 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2997,7 +2997,11 @@ class FileDevice(StorageDevice):
              root = self.parents[0].format._mountpoint
              # trim the mountpoint down to the chroot since we already have
              # the otherwise fully-qualified path
-            root = root[:-len(self.parents[0].format.mountpoint)]
+            mountpoint = self.parents[0].format.mountpoint
+            if mountpoint.endswith("/"):
+                mountpoint = mountpoint[:-1]
+            if mountpoint:
+                root = root[:-len(mountpoint)]

          return os.path.normpath("%s/%s" % (root, path))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]