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: Tomasz Dziendzielski <tomasz.dziendzielski <at> gmail.com>
To: 39678 <at> debbugs.gnu.org
Subject: bug#39678: grep --ignore-case --color does not always color the matches
Date: Mon, 18 Oct 2021 00:26:41 +0200
[Message part 1 (text/plain, inline)]
Hello,
I did some investigation and it seems the problem with '\a' is not that the output is not colored but that it's printed at all while it should not be. It's being printed even when re_search in EGexecute doesn't return a match. As a result the for loop in print_line_middle is not being run - this means the 'a' output that you see is not from the matched string but from the rest of the line. To fix this I suggest to return NULL from print_line_middle if 'b' variable equals NULL - which means the loop was not executed.

I'm sending the patch with the fix in the attachment.

Best regards,
Tomasz Dziendzielski
[Message part 2 (text/html, inline)]
[0001-grep-Don-t-print-line-if-matcher-returned-nothing.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.