Use the normalized path for unmounting, patch by Peter Daum
authorMichael Prokop <mika@grml.org>
Tue, 21 Apr 2009 08:32:08 +0000 (10:32 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 21 Apr 2009 08:32:08 +0000 (10:32 +0200)
In "unmount" it tries to make sure the path to umount is actually mounted
by comparing the mounted path against the output of "/proc/mounts". Because
paths reported by "/proc/mounts" are normalized, this will fail if there
are any symlinks involved (leaving all mounts and an unbootable usb stick).

debian/changelog
grml2usb

index c32b81d..53c7adf 100644 (file)
@@ -3,8 +3,10 @@ grml2usb (0.9.5) UNRELEASED; urgency=low
   * Fix dashes of options in manpage (thanks for the bugreport,
     Thorsten Glaser).
   * Display program version during execution.
+  * Apply fix by Peter Daum <gator@cs.tu-berlin.de>, making sure
+    to use the normalized path for unmounting. Thanks!
 
- -- Michael Prokop <mika@grml.org>  Fri, 10 Apr 2009 01:08:01 +0200
+ -- Michael Prokop <mika@grml.org>  Tue, 21 Apr 2009 10:31:18 +0200
 
 grml2usb (0.9.4) unstable; urgency=low
 
index 3bf80e8..b5338bd 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -869,7 +869,7 @@ def unmount(target, unmount_options):
     # make sure we unmount only already mounted targets
     target_unmount = False
     mounts = open('/proc/mounts').readlines()
-    mountstring = re.compile(".*%s.*" % re.escape(target))
+    mountstring = re.compile(".*%s.*" % re.escape(os.path.realpath(target)))
     for line in mounts:
         if re.match(mountstring, line):
             target_unmount = True