B20.1: Cat-to-screen bug in bash shell (Win 95).

Garrett Sylvester gsylvester@gdats.com
Mon Nov 22 12:22:00 GMT 1999


Problem Description:
  I am running Cygwin B20.1 (1/15/99 cygwin DLL snapshot) bash under Win 95, and have problems
"catting" files to the screen (which is a DOS box). For example, a 9-line file will cat correctly 3
times in a row, then on the 4th try leave out some characters, then on the 5th try get it right
again. The problem is exacerbated when I run Charles Wilson's "consize" utility to increase the
line history buffer, but appears without it; see below. The source file, an example session, and
the output of cygcheck are edited in following. Can you give me any hints on what's wrong, and how
to fix it? 
     Garrett Sylvester
     gsylvester@gdats.com

===============================================================

Copy of 9-line file used to exhibit screen-display problem follows. File begins with
"/* printIt"... and ends with ..."buffer[256]".

/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int line, page;
	char buffer[256];

==========================================================================================

Text of CygWin bash session illustrating (one aspect of) screen display problem follows.
In summary, 9-line text file shown above is successfully catted to screen 3 times in a row,
then the cat has an error on the fourth try, and it returns to nominal on the fifth and
last. Lines that are indented and parenthesized are comments interpolated later to highlight
what the problem is. Note that original file as pasted in above contains a tab character
at beginning of last line, just prior to phrase "char buffer[256]". For some reason, this
character is reproduced below as a sequence of spaces.

BASH.EXE-2.02$ cd /E/Compiler/CygWin/GSSCodes
   (Change to directory with example file.)
BASH.EXE-2.02$ cat frontOfPrintIt.txt
   (Cat example file to screen for first time. Printout is nominal.)
/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int line, page;
        char buffer[256];
BASH.EXE-2.02$ cat frontOfPrintIt.txt
   (Cat example file to screen for second time. Printout is nominal.)
/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int line, page;
        char buffer[256];
BASH.EXE-2.02$ cat frontOfPrintIt.txt
   (Cat example file to screen for third time. Printout is nominal.)
/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int line, page;
        char buffer[256];
BASH.EXE-2.02$ cat frontOfPrintIt.txt
   (Cat example file to screen for fourth time. Printout is wrong: everything from and 
    including the comma in line 8 through the tab in line 9 has gone to bit heaven.)
/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int linechar buffer[256];
BASH.EXE-2.02$ cat frontOfPrintIt.txt
   (Cat example file to screen for fifth time. Printout is right again.)
/* printIt: This program lists a file to the screen, adding line numbers. */
/* Usage: printIt filename  */
#include <stdlib.h>
#include <stdio.h>

void do_heading(char *filename);

int line, page;
        char buffer[256];
BASH.EXE-2.02$

=========================================================================

Output of cygcheck -s -v -r follows.


Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Nov 22 14:39:52 1999

Win95 Ver 4.0 build 67306684  B

Path:	.
	/E/COMPILER/CYGWIN/CYGWIN~1/H-I586~1/BIN
	/E/COMPILER/CYGWIN/CYGWIN~1/H-I586~1/USR/LOCAL/BIN
	/E/MATH/MATLAB~2/BIN
	/C/TNGSD/BIN
	/C/WINDOWS
	/C/WINDOWS/COMMAND
	/E/COMPILER/WATCOMCC/BINNT
	/E/COMPILER/WATCOMCC/BINW
	/E/COMPILER/MS_IDE
	/C/APPS/ANTIVI~1/MCAFEE

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

HOME = `/home'
MAKE_MODE = `UNIX'
PWD = `/E/Compiler/CygWin/GSSCodes'

!C: = `C:\WINDOWS\DESKTOP'
!E: = `E:\COMPILER\CYGWIN\CYGWIN~1'
ASMROOT = `C:\TNGSD\SD'
BLASTER = `A220 I2 D1 T4'
CMDLINE = `bash'
COMSPEC = `C:\COMMAND.COM'
EDPATH = `E:\Compiler\WatcomCC\EDDAT'
HOSTNAME = `garrett_mobile.gdats.com'
HOSTTYPE = `i586'
INCLUDE = `E:\Compiler\WatcomCC\H;E:\Compiler\WatcomCC\H\NT'
MACHTYPE = `i586-pc-cygwin32'
OSTYPE = `cygwin32'
PROMPT = `$p$g'
SHELL = `/bin/sh'
SHLVL = `1'
TEMP = `C:\WINDOWS\TEMP'
TERM = `cygwin'
TMP = `C:\WINDOWS\TEMP'
WATCOM = `E:\Compiler\WatcomCC'
WINBOOTDIR = `C:\WINDOWS'
WINDIR = `C:\WINDOWS'
WWINHELP = `H:\BINW'
_ = `/E/COMPILER/CYGWIN/CYGWIN~1/H-I586~1/BIN/cygcheck'

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites\Engineering
\CompSci\Cygnus
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites\Engineering
\CompSci\Cygnus\Menu
  (default) = (unsupported type)
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) = `F:'
  unix = `/F'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\01
  (default) = `E:'
  unix = `/E'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\02
  (default) = `D:'
  unix = `/D'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\03
  (default) = `C:'
  unix = `/C'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0\mounts\04
  (default) = `E:\Compiler\CygWin\cygwin-b20\H-i586-cygwin32'
  unix = `/'
  fbinary = 0x00000000
  fsilent = 0x00000000
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cygnus Cygwin B20
  (default) = `C:\WINDOWS\IsUninst.exe -fe:\compiler\cygwin\cygwin-b20\Uninst.isu'
  DisplayName = `Cygwin B20'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin B20\B20.1
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) = `e:\compiler\cygwin\cygwin-b20'
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

a:\ fd           N/A    N/A                    
c:\ hd  FAT32    992Mb  60% CP    UN           BOOT
d:\ hd  FAT32    765Mb  38% CP    UN           WORK
e:\ hd  FAT32   1675Mb  66% CP    UN           APPS
f:\ hd  FAT32   4359Mb  82% CP    UN           DATA
g:\ cd           N/A    N/A                    

E:\Compiler\CygWin\cygwin-b20\H-i586-cygwin32  /        native  text!=binary
C:                                             /C       native  text!=binary
D:                                             /D       native  text!=binary
E:                                             /E       native  text!=binary
F:                                             /F       native  text!=binary

Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\bash.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cat.exe
Not Found: cpp (good!)
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\find.exe
Found: C:\WINDOWS\COMMAND\find.exe
Warning: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\find.exe hides C:\WINDOWS\COMMAND\find.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\gcc.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\gdb.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\ld.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\ls.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\make.exe
Found: E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\sh.exe

  371k 1998/12/01 E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=1998/12/1 3:25
    5k 1998/12/01 E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 1998/12/01 E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=1998/12/1 3:25
  600k 1998/12/01 E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=1998/12/1 3:28
  451k 1999/11/19 E:\COMPILER\CYGWIN\CYGWIN~1\H-I586~1\BIN\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=1999/1/16 0:09
Use -h to see help about each section


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list