NetBSD-Users archive

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

Re: Bug in NetBSD grep ?



On Tue, 16 Aug 2022, RVP wrote:

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:


Fixed in GNU grep-2.6:

$ /tmp/g2/bin/grep --version
GNU grep 2.6

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ echo 00:00: | /tmp/g2/bin/grep -E '^([0]{2}[:-]){2}$'
00:00:
$ /tmp/g1/bin/grep --version
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo 00:00: | /tmp/g1/bin/grep -E '^([0]{2}[:-]){2}$'
$ 		# nada

-RVP



Home | Main Index | Thread Index | Old Index