Subject: Re: bug#56843: grep mangling lines

From: Paul Eggert <[email-masked]>
Date: Sat, 30 Jul 2022 11:17:43 -0700

I'm not seeing the problem on Ubuntu 22.04 LTS, using grep 3.7 and GNOME 
Terminal 3.44.0 using VTE 0.68.0 +BIDI +GNUTLS +ICU +SYSTEMD. The output 
isn't even colored unless I pass something like '--color=always' to 
'grep', which leads me to wonder whether you're using an alias for 
'grep' instead of the real thing.

Here's how I tried to reproduce the problem. What happens when you try 
the same thing on your platform? and what is your platform?

$ cat >x <<'EOF'
 > 30 23 * * * /usr/bin/freshclam --datadir=/home/dgp/.clamtk/db 
--log=/home/dgp/.clamtk/db/freshclam.$(/bin/date +\%b-\%d-\%Y).log 
 >/home/dgp/.clamtk/db/freshclam_cron.log 2>&1 ; 
/usr/local/bin/clamdscan --config-file=/etc/clamav/clamd.conf --reload 
--log="$HOME/.clamtk/history/$(/bin/date +\%b-\%d-\%Y).log" 
 >>.clamtk/history/clamscan.log 2>&1 ; /usr/local/bin/clamdscan 
--config-file=/etc/clamav/clamd.conf --quiet --multiscan --fdpass 
--log="$HOME/.clamtk/history/$(/bin/date +\%b-\%d-\%Y).log" $HOME 
 >>.clamtk/history/clamscan.log 2>&1 # freshclam update and clam-scan
 > EOF
$ cat x | grep clam | diff x -
$ e=$(printf '\033')
$ cat x | grep --color=always clam | sed "s/$e\\[[0-9;]*.//g" | diff x -
$ which grep
/usr/bin/grep