[dm-devel] [PATCH] 11-dm-mpath.rules: fix warnings reported by udevadm verify

Dmitry V. Levin ldv at strace.io
Mon May 22 10:49:47 UTC 2023


On Mon, May 22, 2023 at 12:19:04PM +0200, Martin Wilck wrote:
> On Sat, 2023-05-20 at 01:33 +0300, Dmitry V. Levin wrote:
> > Fix the following warnings reported by udevadm verify:
> > 
> > multipath/11-dm-mpath.rules:18 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules:73 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules:73 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules:78 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules:78 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules:78 Whitespace after comma is expected.
> > multipath/11-dm-mpath.rules: udev rules check failed
> > 
> > Signed-off-by: Dmitry V. Levin <ldv at strace.io>
> 
> Maybe you should have mentioned that you've just invented this syntax
> rule yourself (https://github.com/systemd/systemd/pull/26980).
> I see no requirement for adding whitespace after a comma in the udev
> man page. 
> 
> Is this an attempt to change the udev rule syntax retroactively?

As you probably know, udevd silently accepts much broader syntax, for
example, it doesn't need neither comma no whitespace between KEY=VALUE
expressions, and I doubt this will ever change in the future.

In contrast, `udevadm verify` is a tool that checks syntactic, semantic,
and style correctness of udev rules files.  It indeed expects whitespace
after a comma in udev rules - a style most of existing udev rules follow.

> Furthermore, there is actually whitespace after the comma in the code
> this patch changes, it just happens to be at the beginning of the
> following line, which your syntax check ignores.

When I saw the parser of udev rules used by udevd for the first time,
I was also surprised to find out that it discards all leading whitespace
regardless of line continuations.  As result, that whitespace is not
visible to the syntax check at all.  So yes, you are literally correct,
there is whitespace there, but most of existing udev rules add whitespace
between a comma and a backslash.


-- 
ldv



More information about the dm-devel mailing list