bug with special bracket expressions in regular expressions

Andriy Gapon avg at FreeBSD.org
Fri Jun 12 13:35:17 UTC 2015


On 02/09/2013 19:45, Andriy Gapon wrote:
> It seems that the code works like this:
> - first it matches "cd0 " and "removes" it
> - then it passes "cd1 xx" for matching with a flag that tells that this is not
>   a real start of the string
> - thus the matching code
>  o knows that this is not a real line start, so it can't match [[:<:]]
>    just for that reason
>  o it does _not_ know what was the character before the start of the given
>    substring, so it can not know if it could match [[:<:]]
> 
> So matching fails.
> Not sure if this is an internal problem of regex(3) or a problem of how sed(1)
> uses regex(3).

I've come up with a patch to fix this problem:
https://reviews.freebsd.org/D2792

I am not sure who among the developers is interested in the regexp code, so
currently the request does not have any reviewers.  If know that code well or
care about its correctness please add yourself ti the review request.

All testers are welcome.  The issue could be quite an edge case, but I am more
interested to see if no regressions are introduced.

Thanks.
-- 
Andriy Gapon


More information about the freebsd-current mailing list