Package: usbmount Version: 0.0.10 System configuration:
i386, Debian sarge, Kernel 2.5.15.6 (self compiled), udev 056 (standard sarge), usbmount 0.0.10 (standard sarge, but same code and bug is also in 0.0.14 of sid), USB controller UHCI, USB stick SanDisk Cruizer Micro. Behaviour: When inserting an USB stick, it is correctly assigned /dev/sda1 by udev, and then mounted to /media/usb0 by usbmount, and then linked to /var/run/usbmount/* by 00_create_model_symlink in the run-parts directory /etc/usbmount/mount.d/. When removing the USB stick the /dev/sda1 is removed by udev, but usbmount then fails to call 00_remove_model_symlink (or anything else) in the second run-parts directory /etc/usbmount/umount.d/. Bug Location: What goes wrong is the script /usr/share/usbmount/usbmount, which in its section for "$ACTION" = remove runs the following while loop: while read device mountpoint fstype remainder; do if test "$DEVNAME" = "$device"; then ... umount -l "$mountpoint" ... run-parts /etc/usbmount/umount.d || : ... fi done < /proc/mounts Unfortunately for this loop, udev (the only possible culprint) has already removed the node /dev/sda1 by the time this is called. And as side effect of doing that has also umount-ed it. So /proc/mounts does not anymore contain an line for the device, and the "if" inside the while fails to trigger. Thus the run-parts never gets executed. Note: The umount -l also does not get executed, but this does not show, als udev has already done so. This is also most likely the reason why this bug was overlooked in testing. In the default install it only shows itsself in form of littering of /var/run/usbmount. When users add their own scripts to /etc/usbmount/umount.d the bug then manifests itsself. Suggested Fix: While running the "$ACTION" = add case locally store all the information needed for "$ACTION" = remove so there is no dependency on /proc/mounts. Note: You can not use /etc/mtab either, as that has also allready been cleaned up by the umount done by udev. Note 2: This is more a workaround than a true fix. Properly the udev people should not remove /dev/sda1 before all /etc/dev.d/ scripts have run. But the udev team has already eliminated /etc/dev.d/ alltogether in newer versions (they are up at 084), so they will not care about an bug report on this. -- Neil Franklin, System Programmer, Dept of Physics Swiss Federal Institute of Technology (ETH), Zuerich, HPR E86.1 http://www.phys.ethz.ch/~franklin/, [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]