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

Previous Next

Package: grep;

Reported by: Tomasz Dziendzielski <tomasz.dziendzielski <at> gmail.com>

Date: Mon, 18 Oct 2021 04:00:03 UTC

Severity: normal

Merged with 39678, 51255, 51257

Full log


View this message in rfc822 format

From: Tomasz Dziendzielski <tomasz.dziendzielski <at> gmail.com>
To: 51256 <at> debbugs.gnu.org
Cc: 39678 <at> debbugs.gnu.org
Subject: bug#51256: grep --ignore-case --color does not always color the matches
Date: Mon, 18 Oct 2021 00:02:36 +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 (application/octet-stream, attachment)]

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

Previous Next


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