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: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 39678 <at> debbugs.gnu.org
Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches
Date: Tue, 2 Nov 2021 20:24:51 +0100
[Message part 1 (text/plain, inline)]
Hi,
so is my patch correct? Without my patch re_string_peek_byte() is not
executed - and this is the function that is executed (and where the match
is found) when "--ignore-case" is not enabled. With my patch grep is able
to match the '\a' while still preserving the correctness for other cases.
For sure some tests would be helpful but from what I checked my patch is
not breaking anything else while adding the correct match for '\a' case.

If you still think the patch is wrong, could you please point me in the
right direction? Maybe you could point me where it's not preserving
correctness.

Best regards,
Tomasz Dziendzielski

śr., 20 paź 2021 o 03:10 Tomasz Dziendzielski <
tomasz.dziendzielski <at> gmail.com> napisał(a):

> >> I found that for optimization purposes common cases in
> re_string_peek_byte
> >> are missed if pstr->mbs_allocated is true, thus skipping them also for
> case
> >> insensitive.
>
> >Unfortunately I've lost context here. Is this patch being proposed to
> >improve performance, or to fix a bug?
>
> >I don't see how the patch preserves correctness: if pstr->icase is true,
> >surely in general we need to look at the translated string, not the
> >original.
>
> It's to fix the bug. Without the patch if we use icase this
> re_string_peek_byte was not executed and as a consequence match is not
> found.
> If we apply the patch grep is able to match the '\a' correctly. The patch
> has nothing to do with improving performance, if was just an additional
> comment from my side that the fix should not affect the performance (in my
> opinion). Sorry for confusion.
>
> Best regards,
> Tomasz Dziendzielski
>
[Message part 2 (text/html, inline)]

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.