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 #70 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-grep <at> gnu.org
Subject: Re: bug#39678: warn about stray backslashes
Date: Mon, 23 May 2022 13:03:00 -0700
[Message part 1 (text/plain, inline)]
On 5/22/22 15:22, Paul Eggert wrote:

> We've already uncovered one area, where \a doesn't work as expected and 
> where a warning diagnostic would be helpful.

I installed the attached patch to cause 'grep' to warn about these. 
Comments welcome. Most of the changes were in Gnulib's dfa module, which 
see.


> Here's another one, where an oddly-placed '*' doesn't work as one would expect:
> 
> $ printf '*\na\n*a\n' | grep '\(*\)'
> *
> *a
> $ printf '*\na\n*a\n' | grep -E '(*)'
> grep: Unmatched ( or \(
> $ printf '*\na\n*a\n' | grep '\(*a\)'
> *a
> $ printf '*\na\n*a\n' | grep -E '(*a)'
> a
> *a 

I plan to look at this next. We shouldn't warn about BREs like '\(*\)' 
and '\(*a\)' as these conform to POSIX and work fine. But it makes sense 
to warn about EREs like '(*)', '(*a)', '(+)', '(+a)', '({1})', '({1}a)' 
as POSIX does not specify their behavior, their semantics are 
unpredictable with GNU grep, and it's plausible that people are making 
mistakes in this area.
[0001-build-update-gnulib-submodule-to-latest.patch (text/x-patch, attachment)]
[0002-grep-warn-about-stray-backslashes.patch (text/x-patch, attachment)]

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.