[Toybox] [PATCH] losetup: fix the race.
Josh Gao
jmgao at google.com
Thu Aug 8 13:56:14 PDT 2019
On Wed, Aug 7, 2019 at 8:59 AM enh via Toybox <toybox at lists.landley.net> wrote:
> iirc, the adb maintainer has similar problems where when you first
> connect an Android device to a Linux host, it shows up but with the
> wrong permissions which then fix themselves if you wait+retry. which
> for my money is even worse. (but maybe not. there are pros and cons
> either way, and neither is ideal. and i'm guessing that Ryan's mention
> of EACCES means that he's seen that problem with losetup too.)
For anyone interested, the race here is that libusb has two implementations for
noticing when USB devices are hotplugged, one that listens to udev over dbus,
and one that listens to the kernel directly over an AF_NETLINK socket. We use
netlink because we can't link against libudev since it isn't API or ABI stable,
and that means we get a notification that a device has arrived before udev has
gotten a chance to chown/chmod its device node.
More information about the Toybox
mailing list