This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tcsh 6.15.00 loses DOS line ending crossing 32768 byte boundary



When a tcsh script has DOS line endings and a line ending falls in bytes
32767 and 32768, the line ending is lost. I discovered this with a script
passing shell input to a program using the << construct, and have reproduced the problem with a script (bigscript) that passes 4 lines of input to another script. The functional part of the script is
./testreader <<EOF
key1 value1
key2 value2
key3 value3
key4 value4
EOF


and the rest is filler to bring the line ending between the second and
third line to the 32768 byte boundary.
testreader simply reads and echos four lines of input.

Here is the result of running bigscript - it passes both lines to the reader:

[mast@salsa ~]$ ./bigscript
Line 1: key1 value1
Line 2: key2 value2key3 value3
Line 3: key4 value4
Line 4: [mast@salsa ~]$ od -c bigscript | grep -B 1 0100000
0077760 \r \n k e y 2 v a l u e 2 \r
0100000 \n k e y 3 v a l u e 3 \r \n


Here the script was modified to have one less character and it runs fine:

[mast@salsa ~]$ ./bigscript2
Line 1: key1   value1
Line 2: key2   value2
Line 3: key3   value3
Line 4: key4   value4
[mast@salsa ~]$ od -c bigscript2 | grep -B 1 0100000
0077760  \n   k   e   y   2               v   a   l   u   e   2  \r  \n
0100000   k   e   y   3               v   a   l   u   e   3  \r  \n   k

Here it was modified to have one more character and it runs fine:

[mast@salsa ~]$ ./bigscript3
Line 1: key1   value1
Line 2: key2   value2
Line 3: key3   value3
Line 4: key4   value4
[mast@salsa ~]$ od -c bigscript3 | grep -B 1 0100000
0077760   1  \r  \n   k   e   y   2               v   a   l   u   e   2
0100000  \r  \n   k   e   y   3               v   a   l   u   e   3  \r

Converting a script to unix line endings avoids the problem, even if a critical line ending is moved to byte 32767 or 32768.

The problem occurs on a cygwin installation with binmode mounts and not on one with textmode mounts.

Regards,

David

Attachment: cygcheck.out
Description: Text document

Attachment: scripts.tar.gz
Description: GNU Zip compressed data

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]