[pmg-devel] [PATCH pmg-api v2 1/2] fix #4811: rule db: test regex validity on save

Dominik Csapak d.csapak at proxmox.com
Mon Dec 18 14:34:13 CET 2023


On 12/15/23 18:06, Stoiko Ivanov wrote:
> After testing this a bit more I realized that anchored regexes, don't die
> on '^*foo$' (the quite common case of mistaking regex for globs (especially
> for filenames) - the warning is printed to the journal - but I can happily
> store it (additionally the eval-block in the what/who_match never dies -
> and the 'invalid regex:' does not get printed.
> 
> maybe we could improve this even further by die'ing upon a warning when
> saving the regex? - then the question is if we want to add the eval+warning
> code in the who/what_match subs at all (afaict this would only add 'invalid
> regex:' to the same log-line.

can we check if the regex match warns though? how would we do that?

> 
> In any case - thanks for the patch - I never took the time to find out why
> some invalid-regexes cause pmg-smtp-filter to exit+respawn, and some others
> don't ;)
> 
> 
> On Fri, Dec 15, 2023 at 05:44:19PM +0100, Stoiko Ivanov wrote:
>> Thanks for the patch, this definitely improves UX!
>>
>> one tiny nit in-line (I'll gladly change that upon applying directly, but
>> just don't want to miss anything):
>> ..snip..





More information about the pmg-devel mailing list