bug#79410: Error in expr match handling patterns with null expression subpatterns

Paul Eggert <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
On 2025-09-08 10:05, Michael Figiel via GNU coreutils Bug Reports wrote:
> The expected behaviour is on FreeBSD and OpenBSD, so different code
> base, but I think it's more consistent with the POSIX description of
> expr.

My reading of POSIX is that the GNU behavior is required and the FreeBSD 
behavior is correct. Admittedly this is an obscure corner of the spec.

For what it's worth, GNU sed (and I assume other GNU programs) agree 
with GNU expr and with traditional (e.g., Solaris) expr:

$ echo /usr/local/lib/erlang28/bin:/sbin:/bin:/usr/sbin:/usr/bin | sed 
's|\(.*:\)\{0,1\}/usr/local/lib/erlang28/bin\(:.*\)\{0,1\}|1=(\1) 2=(\2)|'
1=() 2=(:/sbin:/bin:/usr/sbin:/usr/bin)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.