NetBSD-Users archive

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

Re: Bug in NetBSD grep ?



RVP <rvp%SDF.ORG@localhost> écrit :
> On Tue, 16 Aug 2022, Marc Baudoin wrote:
> 
> > The following command-line:
> > 
> > echo 00:00: | grep -E '^([0]{2}[:-]){2}$'
> > 
> > doesn't print anything on NetBSD (9.3) but it prints 00:00: back
> > (as it should, unless I made a mistake in my regular expression):
> > - on NetBSD with GNU grep from pkgsrc
> > - on FreeBSD with their standard grep (which claims to be
> >  GNU-compatible)
> > - on Linux (with GNU grep)
> > 
> > Is there a problem with the grep command shipped with NetBSD?
> 
> Looks like a bug. It works if you force a C locale:
> 
> $ echo 00:00: | LC_ALL=C grep -E '^([0]{2}[:-]){2}$'
> 00:00:
> $ echo $LANG
> en_GB.UTF-8
> $ echo 00:00: | grep -E '^([0]{2}[:-]){2}$'
> $			# nada

That's right:

% echo $LANG
fr_FR.UTF-8
% echo 00:00: | grep -E '^([0]{2}[:-]){2}$'
% echo 00:00: | LANG=C grep -E '^([0]{2}[:-]){2}$'
00:00:

I don't understand how the locale can impact grep that much.
Should I open a PR?


Home | Main Index | Thread Index | Old Index