[systemd-devel] Antw: Re: EXT :Antw: [EXT] Udev Regex

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Wed May 6 13:55:45 UTC 2020


>>> Lennart Poettering <lennart at poettering.net> schrieb am 06.05.2020 um 15:43
in
Nachricht <20200506134333.GC89018 at gardel-login>:
> On Mi, 06.05.20 13:03, Boyce, Kevin P [US] (AS) (Kevin.Boyce at ngc.com)
wrote:
> 
>> Ulrich,
>>
>> I just noticed that too.  This seems rather restrictive given that one
could 
> have a system with many drives, and with GPT it is not unreasonable to have
a 
> large number of partitions as well.
>>
>> There should be a way in udev to write rules that can distinguish between 
> /dev/sda and /dev/sdzfe87.  Matching with sd[a‑z]* or even sd* does not 
> provide enough granularity.
>>
>> What would it take to get this sort of request in to systemd‑udev to
>> support perl style regular expressions that can group terms and
>> match multiple instances of a group with '+'?
> 
> I am sorry, but no. We are talking about device nodes, i.e. file
> objects in the file system tree. It's generally understood that files
> are matched with globs, not regexes.

The manual says:

       PROGRAM
           Execute a program to determine whether there is a match; the key
is
           true if the program returns successfully. The device properties
are
           made available to the executed program in the environment. The
           program's standard output is available in the RESULT key.

           This can only be used for very short-running foreground tasks. For
           details, see RUN.

So a short C program might help to solve the problem.

> 
> There are things where regexes might be fine, but not matching of file
> names.
> 
> Or to say this differently: as soon as you convinced bash to replace
> its glob matching with regex matching we can consider this for udev
> too.
> 
> Lennart
> 
> ‑‑
> Lennart Poettering, Berlin





More information about the systemd-devel mailing list