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


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 39678 <at> debbugs.gnu.org
Cc: Tomasz Dziendzielski <tomasz.dziendzielski <at> gmail.com>, Jim Meyering <jim <at> meyering.net>
Subject: bug#39678: POSIXLY_CORRECT removal, and oddball regex doc
Date: Sat, 21 May 2022 03:05:38 -0700
Looking again at grep bug 39678 <https://bugs.gnu.org/39678> I noticed 
that the bug occurs even when grep is not coloring:

echo a | grep -oi --color=never '\a'

This outputs nothing and exits with status 0, which is clearly wrong.

I tracked this down to a bug buried deep in the bowels of glibc regex, a 
bug that Tomasz also spotted. It's not trivial to fix (the fix that 
Tomasz sent in doesn't feel right, at least for \X where X is a 
multibyte letter) and any fix would be low priority since the bug occurs 
only in regular expressions like '\a' that have unspecified behavior - 
which means the behavior though wrong nevertheless conforms to POSIX.

I'm inclined to address this by having GNU 'grep' diagnose unspecified 
regexps like '\a' and exit with status 2, much as it already diagnoses 
unspecified regexps like '[:alpha:]'. If this approach sounds too 
drastic, a gentler approach would be for 'grep' to warn about '\a' 
without changing the exit status for now, and escalate the warning to 
exit with status 2 in a later 'grep' release.




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

Previous Next


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