Package: usbmount Version: 0.0.21 Tags: patch Followup-For: Bug #588874 usbmount fails to act on partitions on USB thumb drives for me.
I hunted down the bug and found that usbmount parses the output of blkid incorrectly. It scans it with sed searching for variable assignments with a format such as 'VARIABLE="content"', but this is wrong, since there may be variable names that have the VARIABLE as suffix. This happes for "PART_ENTRY_TYPE", while usbmount is actually looking for "TYPE" only. Thus it is reading a wrong value. The fix is to scan for a space before the variable name. Here is the patch: --- /usr/share/usbmount/usbmount.orig 2010-08-03 16:31:25.000000000 +0200 +++ /usr/share/usbmount/usbmount 2011-07-29 17:06:21.000000000 +0200 @@ -87,10 +87,10 @@ # Grab device information from device and "divide it" # FIXME: improvement: implement mounting by label (notice that labels # can contain spaces, which makes things a little bit less comfortable). - DEVINFO=$(/sbin/blkid -p $DEVNAME) - FSTYPE=$(echo "$DEVINFO" | sed 's/.*TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') - UUID=$(echo "$DEVINFO" | sed 's/.*UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') - USAGE=$(echo "$DEVINFO" | sed 's/.*USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + DEVINFO=$(/sbin/blkid -p -- "$DEVNAME") + FSTYPE=$(echo "$DEVINFO" | sed 's/.* TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + UUID=$(echo "$DEVINFO" | sed 's/.* UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + USAGE=$(echo "$DEVINFO" | sed 's/.* USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then log info "$DEVNAME does not contain a filesystem or disklabel" -- System Information: Debian Release: wheezy/sid APT prefers testing-proposed-updates APT policy: (930, 'testing-proposed-updates'), (930, 'stable-updates'), (930, 'testing'), (830, 'proposed-updates'), (830, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.39-2-686-pae (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages usbmount depends on: ii lockfile-progs 0.1.15 Programs for locking and unlocking ii udev 172-1 /dev/ and hotplug management daemo ii util-linux 2.19.1-4 Miscellaneous system utilities Versions of packages usbmount recommends: pn pmount <none> (no description available) usbmount suggests no packages. -- Configuration Files: /etc/usbmount/usbmount.conf changed [not included] -- no debconf information -- debsums errors found: debsums: changed file /usr/share/usbmount/usbmount (from usbmount package)
--- /usr/share/usbmount/usbmount.orig 2010-08-03 16:31:25.000000000 +0200 +++ /usr/share/usbmount/usbmount 2011-07-29 17:36:29.000000000 +0200 @@ -87,10 +87,10 @@ # Grab device information from device and "divide it" # FIXME: improvement: implement mounting by label (notice that labels # can contain spaces, which makes things a little bit less comfortable). - DEVINFO=$(/sbin/blkid -p $DEVNAME) - FSTYPE=$(echo "$DEVINFO" | sed 's/.*TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') - UUID=$(echo "$DEVINFO" | sed 's/.*UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') - USAGE=$(echo "$DEVINFO" | sed 's/.*USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + DEVINFO=$(/sbin/blkid -p -- "$DEVNAME") + FSTYPE=$(echo "$DEVINFO" | sed 's/.* TYPE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + UUID=$(echo "$DEVINFO" | sed 's/.* UUID="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') + USAGE=$(echo "$DEVINFO" | sed 's/.* USAGE="\([^"]*\)".*/\1/g; s/[[:blank:]]*//g;') if ! echo $USAGE | egrep -q "(filesystem|disklabel)"; then log info "$DEVNAME does not contain a filesystem or disklabel"