linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm filter regex format
@ 2017-12-18 17:16 Thanos Makatos
  2017-12-18 17:49 ` Joe Thornber
  0 siblings, 1 reply; 6+ messages in thread
From: Thanos Makatos @ 2017-12-18 17:16 UTC (permalink / raw)
  To: linux-lvm

I'm trying to be very specific in the global_filter of lvm.conf and
ignore devices under /dev/mapper of the format
'^/dev/mapper/[a-z0-9]{14}$', however the repetition count '{14}' does
not seem to be honored?

Currently I have to repeat '[a-z0-9]' fourteen times, which works but
it's a bit ugly.

Does the filter use some standarized regex format?

-- 
Thanos Makatos

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] lvm filter regex format
  2017-12-18 17:16 [linux-lvm] lvm filter regex format Thanos Makatos
@ 2017-12-18 17:49 ` Joe Thornber
  2017-12-19  9:36   ` Thanos Makatos
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Thornber @ 2017-12-18 17:49 UTC (permalink / raw)
  To: LVM general discussion and development

On Mon, Dec 18, 2017 at 05:16:14PM +0000, Thanos Makatos wrote:
> I'm trying to be very specific in the global_filter of lvm.conf and
> ignore devices under /dev/mapper of the format
> '^/dev/mapper/[a-z0-9]{14}$', however the repetition count '{14}' does
> not seem to be honored?
> 
> Currently I have to repeat '[a-z0-9]' fourteen times, which works but
> it's a bit ugly.
> 
> Does the filter use some standarized regex format?

It's a custom engine that I wrote which matches all the regexs in the
filters at the same time (so is pretty fast).  Looking at the header here:

   https://github.com/jthornber/lvm2-ejt/blob/master/libdm/regex/parse_rx.h

It seems to support just catenation, |, *, +, ?, [<charset>], ^ and $

Out of interest why are you using the length of the device name as a discriminator?

- Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] lvm filter regex format
  2017-12-18 17:49 ` Joe Thornber
@ 2017-12-19  9:36   ` Thanos Makatos
  0 siblings, 0 replies; 6+ messages in thread
From: Thanos Makatos @ 2017-12-19  9:36 UTC (permalink / raw)
  To: LVM general discussion and development

> Out of interest why are you using the length of the device name as a discriminator?

In my case I am the one who creates these devices so I fully control
the naming scheme, however there are other components in our product
that might create device mapper targets and I shouldn't filter them
out.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] lvm filter regex format
  2017-12-18 18:53 ` matthew patton
  2017-12-18 22:43   ` Zdenek Kabelac
@ 2017-12-19  8:51   ` Joe Thornber
  1 sibling, 0 replies; 6+ messages in thread
From: Joe Thornber @ 2017-12-19  8:51 UTC (permalink / raw)
  To: matthew patton, LVM general discussion and development

On Mon, Dec 18, 2017 at 06:53:06PM +0000, matthew patton wrote:
> > �  https://github.com/jthornber/lvm2-ejt/blob/master/libdm/regex/parse_rx.h
>  
> not to be ungrateful but why on earth would one NOT use the glibc standard regex library? Nobody cares about pointless optimization. Surprises like "well, we only implemented most of the spec" are what drives people nuts!

It was written about 17 years ago, and the optimisation was not pointless at that time.

- Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] lvm filter regex format
  2017-12-18 18:53 ` matthew patton
@ 2017-12-18 22:43   ` Zdenek Kabelac
  2017-12-19  8:51   ` Joe Thornber
  1 sibling, 0 replies; 6+ messages in thread
From: Zdenek Kabelac @ 2017-12-18 22:43 UTC (permalink / raw)
  To: matthew patton, LVM general discussion and development

Dne 18.12.2017 v 19:53 matthew patton napsal(a):
>>     https://github.com/jthornber/lvm2-ejt/blob/master/libdm/regex/parse_rx.h
>   
> not to be ungrateful but why on earth would one NOT use the glibc standard regex library? Nobody cares about pointless optimization. Surprises like "well, we only implemented most of the spec" are what drives people nuts!
> 
> I agree this particular length-based match is rather odd but there are plenty of useful examples I am sure that could benefit from {x,y} notation.


Such code was actually written long time ago - but since the syntax of 
standard glibc  regex accepts slightly different strings - it would be an 
incompatible change - so it's been considered now worth breaking the 
compatibility at that time...


Regards

Zdenek

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-lvm] lvm filter regex format
       [not found] <72381975.739900.1513623186634.ref@mail.yahoo.com>
@ 2017-12-18 18:53 ` matthew patton
  2017-12-18 22:43   ` Zdenek Kabelac
  2017-12-19  8:51   ` Joe Thornber
  0 siblings, 2 replies; 6+ messages in thread
From: matthew patton @ 2017-12-18 18:53 UTC (permalink / raw)
  To: LVM general discussion and development

>    https://github.com/jthornber/lvm2-ejt/blob/master/libdm/regex/parse_rx.h
 
not to be ungrateful but why on earth would one NOT use the glibc standard regex library? Nobody cares about pointless optimization. Surprises like "well, we only implemented most of the spec" are what drives people nuts!

I agree this particular length-based match is rather odd but there are plenty of useful examples I am sure that could benefit from {x,y} notation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-19  9:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18 17:16 [linux-lvm] lvm filter regex format Thanos Makatos
2017-12-18 17:49 ` Joe Thornber
2017-12-19  9:36   ` Thanos Makatos
     [not found] <72381975.739900.1513623186634.ref@mail.yahoo.com>
2017-12-18 18:53 ` matthew patton
2017-12-18 22:43   ` Zdenek Kabelac
2017-12-19  8:51   ` Joe Thornber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).