Re: bug in cat 5.3.0 (cygwin) on XP SP2

"Tristan Savatier" <[email protected]> Wed, 18 May 2005 16:05:54 -0700
Newsgroups gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.textutils.bugs
Message-ID <0a3e01c55bfe$29756f30$6de8fea9@milk>
apparently this bug is triggered as soon as one of the text files contains a 
spurious ^M character at its end, after the last \n.  emacs does not show 
the ^M in this case, but it seems to change the behavior of cat on windows.

this is strange and i think it's a bug...

-t


----- Original Message ----- 
From: "Tristan Savatier" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 18, 2005 3:39 PM
Subject: bug in cat 5.3.0 (cygwin) on XP SP2


> when 'cat' is passed several text files as parameters, it will add the 
> invisible control character '^M' at the end of each lines of each file 
> except the first file.
>
> e.g.:
>
> $ cat file1.txt file2.txt file3.txt > fileout.txt
>
> in fileout.txt, all the lines from file2.txt and file3.txt now have a 
> spurious invisible '^M' control character right before the \n.  this 
> character was not present in the original files.  it can be seen by 
> editing the text files with emacs.
>
> this invisible  '^M' control character causes problems, e.g. if you pipe 
> this into 'sort -u', identical lines that should be discarded are not 
> discarded because they are in fact now different because of the spurious 
> invisible '^M' control character added by 'cat'.
>
> the spurious invisible '^M' control character is NOT added to the lines of 
> the first file in the parameter list.
>
> -t