On Fri, Jan 24, 2025 at 03:20:28AM +0000, Peter White wrote:
> Hi there,
> 
> I just stumbled on this by accidentally redirecting the output of a
> colored grep invocation to a file like so:
>       
>       $ grep --color=always . /sys/kernel/mm/transparent_hugepage/* 
> >thp-status.txt 2>/dev/null
>       # for convenience the 1st line of actual uncolored output
>       /sys/kernel/mm/transparent_hugepage/defrag:always defer defer+madvise 
> [madvise] never
>       
> Subsequently opening said file in vim I was overwhelmed with escape
> sequences. From the looks of it every character in the match gets its
> very own color escape sequence as opposed to the string indicating the
> path to the file (everything before ':')

I did have a look at the code, after all, and even tried a premature
"fix" which broke the foad1 test in the debian source package. But that
made me realize that this is not a bug at all and grep did as designed
by highlighting every single match which just happened to be every
single character because of '.' being the pattern.

I am sorry for wasting anyone's time and can only hope that this
retraction reaches them before they might go chasing ghosts.


Peter White



Reply via email to