[systemd-devel] udev can fail to read stdout of processes spwaned in udev_event_spawn

Paul Davey Paul.Davey at alliedtelesis.co.nz
Fri Nov 1 00:42:35 UTC 2019


Hi,

In tracking down an issue we are having with usb-modeswitch I found
that the root cause is an issue in udev where when the rule sets
a PROGRAM= and uses the result it will sometimes receive an empty
result even when the program did produce output.

This appears to be because the on_spawn_sigchld handler used
by spawn_wait is not checking if there is output in the stdout pipe
when the program exits and thus there is a race between this event and
the io event to read the output.

What is the best way to fix this issue?  I have locally had success
just calling the on_spawn_io callback in the process success branch of
on_spawn_sigchld, but I am unsure if this is an acceptable fix.

Thanks,
Paul


More information about the systemd-devel mailing list