You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Olivier Coutu <ol...@zerospam.ca> on 2018/08/31 13:59:52 UTC

Negative lookbehind lint issues

I wrote a rule that throws a /variable length lookbehind/ error where 
the lookbehind is fixed length. Here is a MWE:

body            __Z_NEGATIVE_LOOKBEHIND  /(?<!ss) text/i

spamassassin --siteconfigpath=${HOME}/sa-rules/ --lint
aoû 31 09:53:45.343 [9074] warn: config: invalid regexp for rule __Z_NEGATIVE_LOOKBEHIND: /(?<!ss) text/i: Variable length lookbehind not implemented in regex m/(?i)(?<!ss) text/

The error goes away if I remove the case insensitive, or if I put a 
character between the two /s/ characters. Using /nn/ instead of /ss/ 
makes the error go away. The error stays if I add characters before or 
after the /ss/. Is there a special non-text signification to the 
characters /ss/? Here is my config:

SpamAssassin version 3.4.1
   running on Perl version 5.22.1



Re: Negative lookbehind lint issues

Posted by "Kevin A. McGrail" <km...@apache.org>.
Likely best to try against svn for 3.4 and trunk where I expect it will
fail and we have to open a bug.

On Fri, Aug 31, 2018, 10:42 RW <rw...@googlemail.com> wrote:

> On Fri, 31 Aug 2018 09:59:52 -0400
> Olivier Coutu wrote:
>
> > I wrote a rule that throws a /variable length lookbehind/ error where
> > the lookbehind is fixed length. Here is a MWE:
> >
> > body            __Z_NEGATIVE_LOOKBEHIND  /(?<!ss) text/i
> >
> > spamassassin --siteconfigpath=${HOME}/sa-rules/ --lint
> > aoû 31 09:53:45.343 [9074] warn: config: invalid regexp for rule
> > __Z_NEGATIVE_LOOKBEHIND: /(?<!ss) text/i: Variable length lookbehind
> > not implemented in regex m/(?i)(?<!ss) text/
>
>
> I get the same, with or without the UTF-8 non-break spaces.
>
>
> > The error goes away if I remove the case insensitive, or if I put a
> > character between the two /s/ characters. Using /nn/ instead of /ss/
> > makes the error go away. The error stays if I add characters before
> > or after the /ss/. Is there a special non-text signification to the
> > characters /ss/?
>
> gnu grep -P doesn't have a problem with it.
>

Re: Negative lookbehind lint issues

Posted by RW <rw...@googlemail.com>.
On Fri, 31 Aug 2018 09:59:52 -0400
Olivier Coutu wrote:

> I wrote a rule that throws a /variable length lookbehind/ error where 
> the lookbehind is fixed length. Here is a MWE:
> 
> body            __Z_NEGATIVE_LOOKBEHIND  /(?<!ss) text/i
> 
> spamassassin --siteconfigpath=${HOME}/sa-rules/ --lint
> aoû 31 09:53:45.343 [9074] warn: config: invalid regexp for rule
> __Z_NEGATIVE_LOOKBEHIND: /(?<!ss) text/i: Variable length lookbehind
> not implemented in regex m/(?i)(?<!ss) text/


I get the same, with or without the UTF-8 non-break spaces.


> The error goes away if I remove the case insensitive, or if I put a 
> character between the two /s/ characters. Using /nn/ instead of /ss/ 
> makes the error go away. The error stays if I add characters before
> or after the /ss/. Is there a special non-text signification to the 
> characters /ss/? 

gnu grep -P doesn't have a problem with it.

Re: Negative lookbehind lint issues

Posted by Olivier Coutu <ol...@zerospam.ca>.
You are correct Pedro, the curly-braces solution does work. I will 
integrate the solution, I leave it to you guys to determine if a bug 
should be opened and with whom.

On 2018-08-31 15:01, Pedro David Marco wrote:
> It works with Perl 5.14.2 but not with 5.20.2
>
> It seems that Perl preprocessor does something with repeated chars 
> before the regex engine that makes it consider it wrongly
>
> if i change ss for s{2} like this:
> body            __Z_NEGATIVE_LOOKBEHIND  /(?<!s{2}) text/i
>
> then it works
>
> try it Olivier and let us know..
>
> ---
> PedroD

Re: Negative lookbehind lint issues

Posted by Pedro David Marco <pe...@yahoo.com>.
It works with Perl 5.14.2 but not with 5.20.2
It seems that Perl preprocessor does something with repeated chars before the regex engine that makes it consider it wrongly
if i change ss for s{2} like this:
body            __Z_NEGATIVE_LOOKBEHIND  /(?<!s{2}) text/i

then it works
try it Olivier and let us know..
---PedroD

  >On Friday, August 31, 2018, 4:00:05 PM GMT+2, Olivier Coutu <ol...@zerospam.ca> wrote:  >  >I wrote a rule that throws a variable length lookbehind error where the lookbehind is fixed length. Here is a MWE:
>body            __Z_NEGATIVE_LOOKBEHIND  /(?<!ss) text/i
>
>spamassassin --siteconfigpath=${HOME}/sa-rules/ --lint
>aoû 31 09:53:45.343 [9074] warn: config: invalid regexp for rule __Z_NEGATIVE_LOOKBEHIND: /(?<!ss) text/i: Variable length lookbehind not implemented in regex m/(?i)(?<!ss) text/>The error goes away if I remove the case insensitive, or if I put a character between the two s characters. Using nn instead of ss makes the error go away. The error stays if I add characters before or after the ss. Is there a special non-text signification to the characters ss? Here is my config:
 >SpamAssassin version 3.4.1
 > running on Perl version 5.22.1