NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/57530: regex(3): REG_BADRPT raised by { for REG_EXTENDED



>Number:         57530
>Category:       lib
>Synopsis:       regex(3): REG_BADRPT raised by { for REG_EXTENDED
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 18 03:45:00 +0000 2023
>Originator:     Rin Okuyama
>Release:        10.99.3
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD netbsd 10.99.3 NetBSD 10.99.3 (AMD64_NET_MPSAFE) #1: Thu May 25 19:17:12 JST 2023  rin@latipes:/build/src/sys/arch/amd64/compile/AMD64_NET_MPSAFE amd64
>Description:
re_format(7) says:

> Extended regular expressions
...
> A ?{? followed by a character other than a digit is an
> ordinary character, not the beginning of a bound

However, REG_BADRPT is raised for stray {, e.g.:

----
$ /bin/echo '{' | /usr/bin/sed -E '/{/p'
sed: 1: "/{/p": RE error: repetition-operator operand invalid
----

This is due to recent sync of regex(3) with FreeBSD. At least,
the above example works for netbsd-8. Probably, this commit to
FreeBSD did it:

https://github.com/freebsd/freebsd-src/commit/a4a801688c909ef39cbcbc3488bc4fdbabd69d66

Thanks yamaguchi@ for pointing out this problem.
>How-To-Repeat:
/bin/echo '{' | /usr/bin/sed -E '/{/p'
>Fix:
Fix regcomp() or manpages [regex(3) and re_format(7)]

Even if we choice the latter, I am not sure whether REG_BADRPT is
appropriate here, or not.



Home | Main Index | Thread Index | Old Index