Subject: Here documents in ash shell scripts mess up stdin on 9x
From: [email-masked] (Mikey)
To: [email-masked]
Date: Fri, 12 Feb 1999 18:32:43 GMT

I always wondered why configure screwed up bash
on win95, and I finally figured it out.

Here documents in ash shell scripts

This bug doesn't appear under NT4 SP3.

--------------------  output starts here
Mikey:/usr/bin$ ./here2
testing
Mikey:/usr/bin$ cat here2
#!/bin/bash
cat <<!
testing
!
Mikey:/usr/bin$ ./here1
testing
Mikey:/usr/bin$ ccat here1
cat here1
"D:/usr/H-i586-cygwin32/bin/bash.exe": ccat: command not found
Mikey:/usr/bin$ cat here1
cat here1
#!/bin/sh
cat <<!
testing
!
Mikey:/usr/bin$               <--------- just pressed <ENTER>

Mikey:/usr/bin$ echo this
echo this
this
Mikey:/usr/bin$
------------------------- output ends here

arrow keys stop working for history,
and command line editing,
and any command entered from the command
line is echoed on the next line.
including just <ENTER> as you can see above.

BTW the ccat is not a typo the first character
pressed is repeated, and the cat here1
on the next line is exactly as it was typed.

Symptoms are the same if ash is the login shell. 
( except there is no history :)

Maybe time for a little cut/paste action bash->ash?

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Feb 08 01:12:50 1999

Win95 Ver 4.0 build 67306684  C

Path:	/usr/bin
	/usr/local/bin
	/bin
	/bin
	/c/WINDOWS
	/c/WINDOWS/COMMAND
	/c/progra~1/bin95
	/progra~1/dos/b
	/progra~1/DOS/bin
	/progra~1/DOS
	/progra~1/ISP16

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

CYGWIN32 = `tty binmode'
CYGWIN = `  tty binmode'
HOME = `/Cygnus/home'
MAKE_MODE = `unix'
PWD = `/cygnus/home'
TCL_LIBRARY = `D:\usr\share\tcl8.0\'

BISONLIB = `/usr/share/'
COMSPEC = `C:\COMMAND.COM'
EDITOR = `vi'
LESSOPEN = `|lesspipe.sh %s'
LOCATE_PATH = `/Cygnus/home/locatedb'
RSX_TYPE = `PEI'
TEMP = `C:\WINDOWS\TEMP'
TERM = `w32linux'
TMP = `C:\WINDOWS\TEMP'
TMPDIR = `/tmp'
VERSION_CONTROL = `numbered'
WINDIR = `C:\WINDOWS'
_ = `/usr/H-i586-cygwin32/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
  (default) = `w:'
  unix = `/w'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
  (default) = `I:\man'
  unix = `/usr/man'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
  (default) = `I:\info'
  unix = `/usr/info'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
  (default) = `h:'
  unix = `/h'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
  (default) = `E:'
  unix = `/e'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
  (default) = `\\.\tape1:'
  unix = `/dev/st1'
  fbinary = 0x00000000
  fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
  (default) = `\\.\tape0:'
  unix = `/dev/st0'
  fbinary = 0x00000000
  fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
  (default) = `\\.\b:'
  unix = `/dev/fd1'
  fbinary = 0x00000000
  fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
  (default) = `\\.\a:'
  unix = `/dev/fd0'
  fbinary = 0x00000000
  fsilent = 0x00000001
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
  (default) = `c:'
  unix = `/c'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
  (default) = `d:\usr\H-i586-cygwin32\bin'
  unix = `/bin'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
  (default) = `d:'
  unix = `/'
  fbinary = 0x00000001
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cygnus Cygwin B20
  (default) = `C:\WINDOWS\IsUninst.exe -fc:\cygbak\cygwin-b20\Uninst.isu'
  DisplayName = `Cygwin B20'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\00
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\05
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\06
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\07
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\08
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\09
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0E
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\0F
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\10
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\11
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\12
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\13
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\14
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\15
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\16
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\17
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\18
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\19
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1A
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1B
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1C
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\1D
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32\i586-cygwin32
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\GNUPro\i586-cygwin32\i586-cygwin32\cygwin-B20.1
  (default) = `c:\cygbak\cygwin-b20'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20\B20.1

a:\ fd           N/A    N/A                    
c:\ hd  FAT     1862Mb  88% CP    UN       VC  
d:\ hd  FAT32    962Mb  94% CP    UN           DRIVE2 1
e:\ hd  FAT32   1220Mb  95% CP    UN           DRIVE1 2
f:\ cd  CDFS     105Mb 100% CP                 QUAKE101
h:\ hd  aŒêS
    277Mb  38% CP                 hda3
i:\ hd  aŒêS
    257Mb  83% CP                 hdb2
w:\ hd  FAT     1017Mb 100% CP    UN           

d:                          /          native  text=binary
d:\usr\H-i586-cygwin32\bin  /bin       native  text=binary
c:                          /c         native  text=binary
\\.\a:                      /dev/fd0   native  text!=binary
\\.\b:                      /dev/fd1   native  text!=binary
\\.\tape0:                  /dev/st0   native  text!=binary
\\.\tape1:                  /dev/st1   native  text!=binary
E:                          /e         native  text=binary
h:                          /h         native  text=binary
I:\info                     /usr/info  native  text=binary
I:\man                      /usr/man   native  text=binary
w:                          /w         native  text=binary

Found: d:\usr\H-i586-cygwin32\bin\bash.exe
Found: d:\usr\H-i586-cygwin32\bin\cat.exe
Found: d:\progra~1\DOS\cat.exe
Warning: d:\usr\H-i586-cygwin32\bin\cat.exe hides d:\progra~1\DOS\cat.exe
Not Found: cpp (good!)
Found: d:\usr\H-i586-cygwin32\bin\find.exe
Found: c:\WINDOWS\COMMAND\find.exe
Warning: d:\usr\H-i586-cygwin32\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe
Found: d:\usr\H-i586-cygwin32\bin\gcc.exe
Found: d:\usr\H-i586-cygwin32\bin\gdb.exe
Found: d:\usr\H-i586-cygwin32\bin\ld.exe
Found: d:\usr\H-i586-cygwin32\bin\ls.exe
Found: d:\progra~1\DOS\ls.exe
Warning: d:\usr\H-i586-cygwin32\bin\ls.exe hides d:\progra~1\DOS\ls.exe
Found: d:\usr\H-i586-cygwin32\bin\make.exe
Found: d:\usr\H-i586-cygwin32\bin\sh.exe

  451k 1999/01/16 d:\usr\H-i586-cygwin32\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=1999/1/15 22:09
  371k 1998/12/01 d:\usr\H-i586-cygwin32\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=1998/12/1 1:25
    5k 1998/12/01 d:\usr\H-i586-cygwin32\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 1998/12/01 d:\usr\H-i586-cygwin32\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=1998/12/1 1:25
  600k 1998/12/01 d:\usr\H-i586-cygwin32\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=1998/12/1 1:28
Use -h to see help about each section