GNU bug report logs - #39678
'grep --ignore-case --color' does not always color the matches

Previous Next

Package: grep;

Reported by: Benno Schulenberg <bensberg <at> telfort.nl>

Date: Wed, 19 Feb 2020 15:28:01 UTC

Severity: normal

Merged with 51255, 51256, 51257

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Benno Schulenberg <bensberg <at> telfort.nl>
To: bug-grep <at> gnu.org
Cc: bpaddis <at> gmail.com
Subject: 'grep --ignore-case --color' does not always color the matches
Date: Wed, 19 Feb 2020 11:18:18 +0100
[Message part 1 (text/plain, inline)]
  echo a | grep -i --color '\a'

  echo a | grep -i --color '\A'

Of the above two commands, only the second colorizes the printed "a".

(An old GNU grep on NetBSD (grep 2.5.1a nb1) does the opposite of
a modern grep: it will show color for \a, but none for \A.)

Bug was found in GNU grep 3.1 while checking whether it understands
\d as a shorthand for [0-9].  Still present in 3.4. The locale does
not appear to matter.


In a report against glibc [1] that seems to be related, a comment
says that "Unknown backslash escapes invoke undefined behaviour."
But where in the documentation does it say so?


When searching for a regular expression in GNU nano (^W M-R), nano says
it cannot find any \a.  But for \A, it will find all "a"s and "A"s.
Nano's default search is case insensitive.  See [2] for the original
report by Ben Addis.  I suppose this is the same or a related bug in
the regex module of gnulib, which nano uses.


[1] https://sourceware.org/bugzilla/show_bug.cgi?id=22425

[2] https://savannah.gnu.org/bugs/?57852

Benno

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 3 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.