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

2020-05-06 Thread Andrei Borzenkov
On Wed, May 6, 2020 at 4:43 PM Lennart Poettering
 wrote:
>
> On Mi, 06.05.20 13:03, Boyce, Kevin P [US] (AS) (kevin.bo...@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.
>
> 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.
>


bash already does it if extglob is set.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-05-06 Thread Lennart Poettering
On Mi, 06.05.20 13:03, Boyce, Kevin P [US] (AS) (kevin.bo...@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.

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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


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

2020-05-06 Thread Boyce, Kevin P [US] (AS)
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 '+'?

Kevin

-Original Message-
From: Ulrich Windl  
Sent: Wednesday, May 06, 2020 8:41 AM
To: systemd-devel@lists.freedesktop.org; Boyce, Kevin P [US] (AS) 

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

>>> "Boyce, Kevin P [US] (AS)"  schrieb am 
>>> 06.05.2020 um
14:15
in Nachricht
<16534_1588767787_5EB2AC2A_16534_16_1_d2c2e1aff05740ea9d1ea3e1325511b2@XCGVAG30.
orthgrum.com>:
> Good Morning List,
> 
> Does anyone know how complicated of a regular expression can be 
> utilized in

> a udev rule?
> 
> For instance I have a system with a lot of drives (sda through z 
> aren't
> enough) and I want to write a rule that will match the physical block
devices 
> for one rule and then a separate rule for partitions.
> 
> Something like this, however the rules don't seem to fire except when 
> I remove the '+' from the rules:

The man page udev(7) I have lists '[', ']', '|', '*' and '?', but not '+'...

> ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a‑z]+",
> SYMLINK+="some_device_%k"
> ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd[a‑z]+[0‑9]+",
> SYMLINK+="some_device_%k"
> 
> I am running systemd version 219‑67.
> 
> Kind Regards,
> Kevin



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel