On Mon, Jan 30, 2012 at 23:26, Allin Cottrell <cottrell@xxxxxxx> wrote: > On Mon, 30 Jan 2012, Kay Sievers wrote: > >> It is just plain wrong to continue anything like the dirty hacks which are >> mentioned earlier in this mail thread. > > I see your point, but could you comment on the use of a udev rule that aims > solely to auto-mount detachable media such as USB sticks? I've been using a > mounting rule which starts > > KERNEL!="sd[b-z][0-9]", GOTO=<get out> > > on a system where the only hard drive is /dev/sda, and sdb and higher will > only be USB memory devices. No, that's not fine. Using the kernel device name to implement device-is-removable policy is wrong. No real filesystem must ever be mounted from a udev rule. The time the kernel takes to mount an on-disk filesystem is unpredictable. The mount command must not be killed by udev if the we run into the timeout. Things need to clean up if anything goes wrong. Many filesystems require an fsck before they are mounted. Using udev for a local hack is fine, sure, but please never distribute broken stuff like that to users who might just naively run it. It risks _their_ data, not yours; and that's where things get nasty, and where one needs to make sure that dirty hacks like that do not leak into the public. There is a reason, why tools like systemd and udisks are larger projects. You can probably strip all that down, remove the user interfaces, and implement a simple automounter in 1000+ lines of code, but surely not in udev rules. > This has worked fine, although in one respect > the rule is now out of date, in that it includes > > IMPORT{program}="/sbin/blkid -o udev -p %N" > > which I guess should be substituted by > > IMPORT{builtin}="blkid --noraid" (?) It does not really matter. The external /sbin/blkid will continue to work. > Would this be considered kosher in context? No, not at all. :) Kay -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html