Subject: Re: bug#20482: Colour of Terminal changes with some files using cat

From: Eric Blake <[email-masked]>
Date: Fri, 01 May 2015 09:38:58 -0600

tag 20482 notabug
thanks

On 12/31/1969 05:00 PM,  wrote:
> I have noticed that when running 'cat' to look at certain files that for
> some reason the end of the file is in a different embolden colour, which
> then makes all of my Terminal text that colour as well as bold.
> 
> An example is when I ran: cat /bin/systemd-ask-password
> 
> And this is what happened (Bold_Red_Terminal_Cat_Command.bmp):

Please do NOT attach megabytes of screenshots into something that will
be disseminated via mailing list to multiple readers.  At a minimum,
compress your image using a sane format like .png (rather than blasting
out an uncompressed .bmp) or further compress it with xz or gzip, even
better is to merely post a URL to a link that is hosting the image for
those that want to see it, without clogging inboxes of all list readers.

That said, this is not a bug in cat, but a problem with you making the
mistake of using 'cat' on a binary file, where the file had embedded
byte sequences that the terminal interpreted as commands to change the
terminal color.  It is never a good idea to cat a binary file to the
terminal, but we cannot change the behavior of cat (which is required to
operate on binary files) nor of the terminal (which must operate on
terminal command sequences as requested).

Meanwhile, you can try and reset your terminal back to normal color by
doing things like 'tput reset' or even 'ls -d . --color=always'.

As this is not a bug in coreutils, I'm closing out the bug report;
however, feel free to ask further questions on the topic.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org