[systemd-devel] udev “PROGRAM/RUN” command not working properly for “REMOVE” action

Lennart Poettering lennart at poettering.net
Tue Feb 5 12:17:13 UTC 2019


On Di, 05.02.19 13:08, Martin Wilck (mwilck at suse.de) wrote:

> On Mon, 2019-02-04 at 13:19 +0100, Lennart Poettering wrote:
> >
> > reading sysfs attrs is problematics from "remove" rules, as the sysfs
> > device is likely to have vanished by then, as rules are executed
> > asynchronously to the events they are run for.
> >
> > udev will import the udev db from the last event it has seen on a
> > device on "remove", but sysfs attrs are not stored in the udev
> > db. hence, consider testing against udev db props here, not sysfs
> > attrs.
>
> Right. Then, maybe, udev should treat & report attempts to refer to
> sysfs attributes in rules for "remove" events as errors in the first
> place?

Checking that is not trivial. After all the language knows GOTO and
negative comparisons, and whatnot. Hence it's not trivially
determinable whether some rule will run in ACTION=="remove"...

But if you can come up with a crisp patch for this, but all means,
submit as PR and we can review it.

(I do fear that as soon as if we'd turn this on then this will
complain about a major chunk of rules files. Hence should be a
warning, not an error, and might still be controversial then)

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list