Erroneous line endings (cat,gawk,text mount)

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Apr 22 15:07:00 GMT 2003


On Thu, 17 Apr 2003, Roman Belenov wrote:

> I encountered that cygwin tools can generate file with strange line
> endings in certain situation. I have a file (name it foo.txt) with
> dos-style line endings in  text mounted directory. If I do
>     gawk {print;} <foo.txt >bar.txt
> or
>     cat foo.txt >bar.txt
> I get a copy of foo.txt. But if I do
>     cat foo.txt | gawk {print;} >bar.txt
> I get 0xd doubled in line separators (so lines are separated with 0xd
> 0xd 0xa in bar.txt).
>
> <disclaimer>
> This is just a bug report, I don't expect timely reaction of any kind.
> </disclaimer>

FWIW, I've reproduced this on Win2k with CYGWIN=nobinmode on a text mount:

$ mount
...
c:\temp on /TEMP type user (textmode)
...
$ echo $CYGWIN
nobinmode
$ cd /TEMP
$ (echo;echo;echo;echo) > aaa
$ od -ba aaa
0000000 015 012 015 012 015 012 015 012
         cr  nl  cr  nl  cr  nl  cr  nl
0000010
$ gawk '{print;}' < aaa | cat > bbb; od -ba bbb
0000000 012 012 012 012
         nl  nl  nl  nl
0000004
$ cat AAA | gawk '{print;}' > bbb; od -ba bbb
0000000 015 015 012 015 015 012 015 015 012 015 015 012
         cr  cr  nl  cr  cr  nl  cr  cr  nl  cr  cr  nl
0000014
$ cygcheck -c cygwin gawk
Cygwin Package Information
Package              Version
cygwin               1.3.22-1
gawk                 3.1.2-2

Use -h to see help about each section
$

Hope this helps,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Knowledge is an unending adventure at the edge of uncertainty.
  -- Leto II


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list