tcsh 6.15.00 loses DOS line ending crossing 32768 byte boundary

David Mastronarde mast@Colorado.EDU
Wed Mar 4 03:47:00 GMT 2009


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
-------------- next part --------------


Cygwin Configuration Diagnostics

Current System Time: Wed Mar 04 00:53:57 2009



Windows XP Professional Ver 5.1 Build 2600 Service Pack 3



Path:	C:\cygwin\usr\local\bin

	C:\cygwin\bin

	C:\cygwin\bin

	C:\cygwin\usr\local\IMOD\bin

	C:\cygwin\bin

	c:\WINDOWS\system32

	c:\WINDOWS

	c:\WINDOWS\System32\Wbem

	c:\Program Files\Python25

	c:\Program Files\CA\SharedComponents\ScanEngine

	c:\Program Files\CA\SharedComponents\CAUpdate\

	c:\Program Files\CA\SharedComponents\ThirdParty\

	c:\Program Files\CA\SharedComponents\SubscriptionLicense\

	c:\Program Files\CA\eTrustITM



Output from C:\cygwin\bin\id.exe (nontsec)

UID: 1003(mast)     GID: 513(None)

0(root)             513(None)           544(Administrators) 545(Users)



Output from C:\cygwin\bin\id.exe (ntsec)

UID: 1003(mast)     GID: 513(None)

0(root)             513(None)           544(Administrators) 545(Users)



SysDir: C:\WINDOWS\system32

WinDir: C:\WINDOWS



HOME = '/home/mast'

PWD = '/home/mast'

USER = 'mast'

MAKE_MODE = 'unix'



ALLUSERSPROFILE = 'C:\Documents and Settings\All Users'

APPDATA = 'C:\Documents and Settings\mast\Application Data'

CASHCOMP = 'C:\Program Files\CA\SharedComponents\'

CLIENTNAME = 'Console'

COMMONPROGRAMFILES = 'C:\Program Files\Common Files'

COMPUTERNAME = 'SALSA'

COMSPEC = 'C:\WINDOWS\system32\cmd.exe'

FP_NO_HOST_CHECK = 'NO'

HOMEDRIVE = 'C:'

HOMEPATH = '\Documents and Settings\mast'

HOME_S = 'C:\Documents and Settings\mast\My Documents'

IGW_LOC = 'C:\Program Files\CA\SharedComponents\iTechnology\'

IMOD_DIR = 'C:\cygwin\usr\local\IMOD'

IMOD_DIR_S = 'C:\Program Files\IMOD\cygwin\usr\local\IMOD'

INOCULAN = 'C:\Program Files\CA\eTrustITM'

ITMLICENSE = 'C:\Program Files\CA\SharedComponents\SubscriptionLicense\'

ITMTHIRDPARTY = 'C:\Program Files\CA\SharedComponents\ThirdParty\'

LOGONSERVER = '\\SALSA'

NUMBER_OF_PROCESSORS = '2'

OS = 'Windows_NT'

PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'

PATH_ORIG = 'C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Python25;C:\Program Files\CA\SharedComponents\ScanEngine;C:\Program Files\CA\SharedComponents\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\SubscriptionLicense\;C:\Program Files\CA\eTrustITM'

PATH_S = 'C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IMOD\IMOD\bin;C:\Program Files\IMOD\cygwin\bin;C:\Program Files\Python25'

PROCESSOR_ARCHITECTURE = 'x86'

PROCESSOR_IDENTIFIER = 'x86 Family 6 Model 14 Stepping 8, GenuineIntel'

PROCESSOR_LEVEL = '6'

PROCESSOR_REVISION = '0e08'

PROGRAMFILES = 'C:\Program Files'

SESSIONNAME = 'Console'

SYSTEMDRIVE = 'C:'

SYSTEMROOT = 'C:\WINDOWS'

USERDOMAIN = 'SALSA'

USERNAME = 'mast'

USERPROFILE = 'C:\Documents and Settings\mast'

WINDIR = 'C:\WINDOWS'

TERM = 'xterm'

COLORFGBG = '0;default;15'

DISPLAY = ':0'

WINDOWID = '6897040'

COLORTERM = 'rxvt-xpm'

HOSTTYPE = 'i386-cygwin'

VENDOR = 'intel'

OSTYPE = 'cygwin'

MACHTYPE = 'i386'

SHLVL = '1'

LOGNAME = 'mast'

GROUP = 'None'

HOST = 'salsa'

IMOD_PLUGIN_DIR = 'C:\cygwin\usr\local\IMOD\lib\imodplug'

IMOD_CALIB_DIR = 'C:\cygwin\usr\local\ImodCalib'

MANPATH = ':/usr/ssl/man'

SHELL = '/bin/tcsh'



HKEY_CURRENT_USER\Software\Cygnus Solutions

HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin

HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2

HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2

  (default) = '/cygdrive'

  cygdrive flags = 0x00000022

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/

  (default) = 'C:\cygwin'

  flags = 0x0000000a

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin

  (default) = 'C:\cygwin/bin'

  flags = 0x0000000a

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib

  (default) = 'C:\cygwin/lib'

  flags = 0x0000000a

HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options



c:  hd  NTFS     29153Mb  67% CP CS UN PA FC     

d:  cd             N/A    N/A                    



C:\cygwin      /          system  binmode

C:\cygwin/bin  /usr/bin   system  binmode

C:\cygwin/lib  /usr/lib   system  binmode

.              /cygdrive  system  binmode,cygdrive



Found: C:\cygwin\bin\awk.exe

Found: C:\cygwin\bin\bash.exe

Found: C:\cygwin\bin\cat.exe

Found: C:\cygwin\bin\cp.exe

Not Found: cpp (good!)

Not Found: crontab

Found: C:\cygwin\bin\find.exe

Not Found: gcc

Not Found: gdb

Found: C:\cygwin\bin\grep.exe

Found: C:\cygwin\bin\kill.exe

Not Found: ld

Found: C:\cygwin\bin\ls.exe

Not Found: make

Found: C:\cygwin\bin\mv.exe

Not Found: patch

Not Found: perl

Found: C:\cygwin\bin\rm.exe

Found: C:\cygwin\bin\sed.exe

Found: C:\cygwin\bin\ssh.exe

Found: C:\cygwin\bin\sh.exe

Found: C:\cygwin\bin\tar.exe

Found: C:\cygwin\bin\test.exe

Not Found: vi

Not Found: vim



   61k 2008/04/01 C:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0

                  "cygbz2-1.dll" v0.0 ts=2008/3/31 21:37

    7k 2003/10/19 C:\cygwin\bin\cygcrypt-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygcrypt-0.dll" v0.0 ts=2003/10/19 1:57

 1057k 2008/06/09 C:\cygwin\bin\cygcrypto-0.9.8.dll - os=4.0 img=1.0 sys=4.0

                  "cygcrypto-0.9.8.dll" v0.0 ts=2008/6/9 10:33

  703k 2007/12/17 C:\cygwin\bin\cygdb-4.2.dll - os=4.0 img=1.0 sys=4.0

                  "cygdb-4.2.dll" v0.0 ts=2007/12/17 4:58

 1036k 2007/12/17 C:\cygwin\bin\cygdb_cxx-4.2.dll - os=4.0 img=1.0 sys=4.0

                  "cygdb_cxx-4.2.dll" v0.0 ts=2007/12/17 4:58

  118k 2008/05/09 C:\cygwin\bin\cygexpat-1.dll - os=4.0 img=1.0 sys=4.0

                  "cygexpat-1.dll" v0.0 ts=2008/5/8 22:03

   40k 2006/11/15 C:\cygwin\bin\cygform-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygform-8.dll" v0.0 ts=2006/11/15 0:06

   48k 2003/08/09 C:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0

                  "cygform7.dll" v0.0 ts=2003/8/9 3:25

   19k 2006/11/19 C:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0

                  "cyggdbm-4.dll" v0.0 ts=2006/11/19 1:18

    8k 2006/11/19 C:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 sys=4.0

                  "cyggdbm_compat-4.dll" v0.0 ts=2006/11/19 1:18

   25k 2008/01/04 C:\cygwin\bin\cyghistory6.dll - os=4.0 img=1.0 sys=4.0

                  "cyghistory6.dll" v0.0 ts=2008/1/3 20:31

  271k 2007/08/24 C:\cygwin\bin\cygicons-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygicons-0.dll" v0.0 ts=2007/8/24 1:24

  976k 2006/10/22 C:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0

                  "cygiconv-2.dll" v0.0 ts=2006/10/22 17:44

   37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0

                  "cygintl-2.dll" v0.0 ts=2003/8/10 15:50

   31k 2005/11/20 C:\cygwin\bin\cygintl-3.dll - os=4.0 img=1.0 sys=4.0

                  "cygintl-3.dll" v0.0 ts=2005/11/19 19:04

   31k 2006/10/23 C:\cygwin\bin\cygintl-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygintl-8.dll" v0.0 ts=2006/10/22 18:12

   21k 2006/11/15 C:\cygwin\bin\cygmenu-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygmenu-8.dll" v0.0 ts=2006/11/15 0:05

   29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0

                  "cygmenu7.dll" v0.0 ts=2003/8/9 3:25

   20k 2006/12/21 C:\cygwin\bin\cygminires.dll - os=4.0 img=1.1 sys=4.0

                  "cygminires.dll" v0.0 ts=2006/12/20 22:07

   67k 2006/11/15 C:\cygwin\bin\cygncurses++-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygncurses++-8.dll" v0.0 ts=2006/11/15 0:13

  237k 2006/11/15 C:\cygwin\bin\cygncurses-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygncurses-8.dll" v0.0 ts=2006/11/15 0:02

  224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0

                  "cygncurses7.dll" v0.0 ts=2003/8/9 3:24

   12k 2006/11/15 C:\cygwin\bin\cygpanel-8.dll - os=4.0 img=1.0 sys=4.0

                  "cygpanel-8.dll" v0.0 ts=2006/11/15 0:04

   19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0

                  "cygpanel7.dll" v0.0 ts=2003/8/9 3:24

  150k 2008/04/25 C:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygpcre-0.dll" v0.0 ts=2008/4/24 18:30

  303k 2008/04/25 C:\cygwin\bin\cygpcrecpp-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygpcrecpp-0.dll" v0.0 ts=2008/4/24 18:30

    7k 2008/04/25 C:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygpcreposix-0.dll" v0.0 ts=2008/4/24 18:30

   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygpopt-0.dll" v0.0 ts=2002/6/8 23:45

  155k 2008/01/04 C:\cygwin\bin\cygreadline6.dll - os=4.0 img=1.0 sys=4.0

                  "cygreadline6.dll" v0.0 ts=2008/1/3 20:31

  219k 2008/06/09 C:\cygwin\bin\cygssl-0.9.8.dll - os=4.0 img=1.0 sys=4.0

                  "cygssl-0.9.8.dll" v0.0 ts=2008/6/9 10:33

   22k 2008/02/24 C:\cygwin\bin\cygwrap-0.dll - os=4.0 img=1.0 sys=4.0

                  "cygwrap-0.dll" v0.0 ts=2008/2/23 0:03

   65k 2006/10/16 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0

                  "cygz.dll" v0.0 ts=2006/10/15 19:10

 1828k 2008/05/27 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0

                  "cygwin1.dll" v0.0 ts=2008/5/26 18:38

    Cygwin DLL version info:

        DLL version: 1.5.25

        DLL epoch: 19

        DLL bad signal mask: 19005

        DLL old termios: 5

        DLL malloc env: 28

        API major: 0

        API minor: 156

        Shared data: 4

        DLL identifier: cygwin1

        Mount registry: 2

        Cygnus registry name: Cygnus Solutions

        Cygwin registry name: Cygwin

        Program options name: Program Options

        Cygwin mount registry name: mounts v2

        Cygdrive flags: cygdrive flags

        Cygdrive prefix: cygdrive prefix

        Cygdrive default prefix: 

        Build date: Mon May 26 20:37:58 EDT 2008

        CVS tag: cr-0x5f1

        Shared id: cygwin1S4





No Cygwin services found.





Cygwin Package Information

Last downloaded files to: C:\DOCUME~1\sueh\LOCALS~1\Temp\is-CCPD9.tmp

Last downloaded files from: C:\DOCUME~1\sueh\LOCALS~1\Temp\is-CCPD9.tmp



Package              Version

_update-info-dir     00738-1

alternatives         1.3.30c-2

ash                  20040127-3

base-files           3.7-1

base-passwd          2.2-1

bash                 3.2.39-19

bzip2                1.0.5-2

coreutils            6.10-1

crypt                1.1-1

cygrunsrv            1.34-1

cygutils             1.3.2-1

cygwin               1.5.25-14

cygwin-doc           1.4-4

editrights           1.01-2

expat                2.0.1-1

findutils            4.4.0-1

gawk                 3.1.6-1

gcc-testsuite        3.4.4-3

grep                 2.5.1a-4

groff                1.18.1-2

gzip                 1.3.12-2

less                 382-1

libbz2_1             1.0.5-2

libdb4.2             4.2.52.5-2

libexpat1            2.0.1-1

libexpat1-devel      2.0.1-1

libgdbm4             1.8.3-8

libiconv2            1.11-1

libintl2             0.12.1-3

libintl3             0.14.5-1

libintl8             0.15-1

libncurses7          5.3-4

libncurses8          5.5-3

libpcre0             7.6-2

libpopt0             1.6.4-4

libreadline6         5.2.12-10

libwrap0             7.6-4

login                1.9-7

man                  1.6e-1

minires              1.01-1

nano                 2.0.6-1

openssh              5.0p1-1

openssl              0.9.8h-1

python               2.5.1-2

rebase               2.4.4-1

run                  1.1.10-1

rxvt                 20050409-7

sed                  4.1.5-2

tar                  1.20-1

tcltk                20080420-1

tcsh                 6.15.00-4

termcap              20050421-1

terminfo             5.5_20061104-1

texinfo              4.8a-1

time                 1.7-1

tzcode               2008a-1

which                2.19-1

zlib                 1.2.3-2

Use -h to see help about each section

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scripts.tar.gz
Type: application/x-gzip
Size: 495 bytes
Desc: 
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090304/96b40a94/attachment.bin>
-------------- next part --------------
--
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