[Toybox] incorrect output from grep -w --color

Rob Landley rob at landley.net
Wed Jan 17 16:57:51 PST 2024


On 1/17/24 15:16, Peter Collingbourne via Toybox wrote:
> Hi,
> 
> Happened to notice this today:
> 
> $ echo ab a | ./toybox grep -w a
> ab a
> $ echo ab a | ./toybox grep -w --color a
> b a
> 
> Reproduces on current master branch.

Hmmm...

$ echo ab a | toybox grep -w --color=always a | hd
00000000  1b 5b 6d 62 20 1b 5b 31  3b 33 31 6d 61 1b 5b 6d  |.[mb .[1;31ma.[m|
00000010  0a                                                |.|

Yup, reproduced. It's actually worse than that:

$ echo ab a bab | root/i686/fs/bin/grep -w --color=always a
b ab

Thanks. Digging into it...

Rob


More information about the Toybox mailing list