GNU bug report logs - #9344
about the command of 'cat'

Previous Next

Package: coreutils;

Reported by: 博高 <doctorinmit <at> gmail.com>

Date: Mon, 22 Aug 2011 20:04:02 UTC

Severity: normal

Tags: notabug

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9344 in the body.
You can then email your comments to 9344 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9344; Package coreutils. (Mon, 22 Aug 2011 20:04:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to 博高 <doctorinmit <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 22 Aug 2011 20:04:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 博高 <doctorinmit <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: about the command of 'cat'
Date: Tue, 23 Aug 2011 03:21:51 +0800
Hello:
  I am a user of ubuntu 10.04.2.While I am trying to use 'cat' to
display a binary file.....Every letter on my display goes wrong....
  yours GB from China




Added tag(s) notabug. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Mon, 22 Aug 2011 20:17:01 GMT) Full text and rfc822 format available.

Reply sent to Bob Proulx <bob <at> proulx.com>:
You have taken responsibility. (Mon, 22 Aug 2011 20:17:02 GMT) Full text and rfc822 format available.

Notification sent to 博高 <doctorinmit <at> gmail.com>:
bug acknowledged by developer. (Mon, 22 Aug 2011 20:17:02 GMT) Full text and rfc822 format available.

Message #12 received at 9344-done <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: 博高 <doctorinmit <at> gmail.com>
Cc: 9344-done <at> debbugs.gnu.org
Subject: Re: bug#9344: about the command of 'cat'
Date: Mon, 22 Aug 2011 14:14:00 -0600
tags 9344 + notabug
thanks

博高 wrote:
> Hello:
>   I am a user of ubuntu 10.04.2.While I am trying to use 'cat' to
> display a binary file.....Every letter on my display goes wrong....
>   yours GB from China

The 'cat' program copies each file to standard output concatenating
files.  It is working properly.  What you are seeing are the contents
of the files to the terminal.  Whether the terminal can display that
binary data or not is not a bug in cat.  Your data is almost certainly
in a character encoding that is not understood by the terminal.  You
could reconfigure the terminal or recode the file into a different
characer set.

Since the purpose of 'cat' is to concatenate files it must not modify
or filter the files in the process.  What goes in should come out.
The 'cat' program is typically used to assemble parts of files
together.  It is doing that correctly.

To browse files you should use a file browser such as 'more', 'less',
'most', or other programs that act as terminal pagers.  For binary
files it may be more useful to use 'od -tx1', 'hexdump', 'xxd' or
other program that converts binary data into text codes and then
piping the output to a pager.

It is historically traditional on Unix-like systems to use cat to
write short text files to the terminal.  However this is done with
full knowledge that it only behaves as desired on short text files
that do not contain terminal control sequences.  If they do then the
user running cat to write the file to the terminal must be prepared to
accept the consequences and be able to reset the terminal if needed.

Since this is not a bug in cat but instead a misuse of it I am going
to close the bug report.

Hope this helps,
Bob




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9344; Package coreutils. (Mon, 22 Aug 2011 22:39:02 GMT) Full text and rfc822 format available.

Message #15 received at 9344 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: 博高 <doctorinmit <at> gmail.com>
Cc: 9344 <at> debbugs.gnu.org
Subject: Re: bug#9344: about the command of 'cat'
Date: Mon, 22 Aug 2011 23:36:30 +0100
On 08/22/2011 08:21 PM, 博高 wrote:
> Hello:
>   I am a user of ubuntu 10.04.2.While I am trying to use 'cat' to
> display a binary file.....Every letter on my display goes wrong....
>   yours GB from China

There was probably a character sequence in the binary file
to put your terminal into an alternate character set mode.
For example try:

  tput smacs; echo abcd; tput rmacs

If your terminal is messed up, the `reset` command
(even if you can't see what you're typing), will fix things.

Also note the `cat -v` and `od -Ax -tx1z -v` coreutils
commands for viewing binary files.

cheers,
Pádraig.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9344; Package coreutils. (Tue, 23 Aug 2011 04:31:01 GMT) Full text and rfc822 format available.

Message #18 received at 9344 <at> debbugs.gnu.org (full text, mbox):

From: 博高 <doctorinmit <at> gmail.com>
To: 9344 <at> debbugs.gnu.org
Subject: Re: bug#9344: closed (Re: bug#9344: about the command of 'cat')
Date: Tue, 23 Aug 2011 11:08:55 +0800
Thanks very much

On Tue, Aug 23, 2011 at 4:17 AM, GNU bug Tracking System
<help-debbugs <at> gnu.org> wrote:
> Your bug report
>
> #9344: about the command of 'cat'
>
> which was filed against the coreutils package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 9344 <at> debbugs.gnu.org.
>
> --
> 9344: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9344
> GNU Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
>
>
> ---------- Forwarded message ----------
> From: Bob Proulx <bob <at> proulx.com>
> To: 博高 <doctorinmit <at> gmail.com>
> Date: Mon, 22 Aug 2011 14:14:00 -0600
> Subject: Re: bug#9344: about the command of 'cat'
> tags 9344 + notabug
> thanks
>
> 博高 wrote:
>> Hello:
>>   I am a user of ubuntu 10.04.2.While I am trying to use 'cat' to
>> display a binary file.....Every letter on my display goes wrong....
>>   yours GB from China
>
> The 'cat' program copies each file to standard output concatenating
> files.  It is working properly.  What you are seeing are the contents
> of the files to the terminal.  Whether the terminal can display that
> binary data or not is not a bug in cat.  Your data is almost certainly
> in a character encoding that is not understood by the terminal.  You
> could reconfigure the terminal or recode the file into a different
> characer set.
>
> Since the purpose of 'cat' is to concatenate files it must not modify
> or filter the files in the process.  What goes in should come out.
> The 'cat' program is typically used to assemble parts of files
> together.  It is doing that correctly.
>
> To browse files you should use a file browser such as 'more', 'less',
> 'most', or other programs that act as terminal pagers.  For binary
> files it may be more useful to use 'od -tx1', 'hexdump', 'xxd' or
> other program that converts binary data into text codes and then
> piping the output to a pager.
>
> It is historically traditional on Unix-like systems to use cat to
> write short text files to the terminal.  However this is done with
> full knowledge that it only behaves as desired on short text files
> that do not contain terminal control sequences.  If they do then the
> user running cat to write the file to the terminal must be prepared to
> accept the consequences and be able to reset the terminal if needed.
>
> Since this is not a bug in cat but instead a misuse of it I am going
> to close the bug report.
>
> Hope this helps,
> Bob
>
>
>
> ---------- Forwarded message ----------
> From: 博高 <doctorinmit <at> gmail.com>
> To: bug-coreutils <at> gnu.org
> Date: Tue, 23 Aug 2011 03:21:51 +0800
> Subject: about the command of 'cat'
> Hello:
>  I am a user of ubuntu 10.04.2.While I am trying to use 'cat' to
> display a binary file.....Every letter on my display goes wrong....
>  yours GB from China
>
>
>
>




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 20 Sep 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.