Subject: RE: Cygwin make wants stdin != 0
From: "McGroarty, Brian" <[email-masked]>
To: "'Polley Christopher W'" <[email-masked]>, "[email-masked]'" <[email-masked]>
Cc: "McGroarty, Brian" <[email-masked]>
Date: Tue, 27 Nov 2001 11:07:06 -0600

I fixed my program to just create a bogus do-nothing pipe for input that
kills the spawned program on any input attempt. I expect you could just add
"</dev/zero" to the make command line and keep using your current program if
so inclined.

If you want to take the route of patching make, I'm assuming the change
comes from the tests which were recently added to validate all pipes. If
memory serves, the changes had something to do with the fixes for recursive
make sometimes freaking out. Looking over the changelogs should pinpoint
where that went in. 

-----Original Message-----
From: Polley Christopher W [mailto:[email-masked]]
Sent: Tuesday, November 27, 2001 9:07 am
To: [email-masked]'
Cc: 'McGroarty, Brian'
Subject: RE: Cygwin make wants stdin != 0

I've also been experiencing this: I use EditPlus (www.editplus.com), a text
editor that has some nifty features (user-definable tools, syntax
highlighting, auto indenting, regex search/replace,... well worth the reg
fee).  Previously, I was able to use my user tool that ran make in the
current directory, capturing the output into a window that, when clicked on,
grok'd the file name and line # generating an error.  Now when I do this, I
get the same type of error (fhandler_base::dup: dup(unknown disk file)
failed) in each program run (make, for shell utils like rm, etc.; gcc
generates its own, similar error), but not immediately... 'make -d' shows
all of the normal dependency checking before the first rule is executed.

When I make from a NT Dos/bash window (like the standard cygwin.bat) or from
rxvt, there is no problem, and when I uncheck the option in EditPlus to
capture output (it then runs the make in a console window) there is no
problem.

I'm guessing that the IDE uses a 'CreateProcess' similar to Brian's when
launching make and capturing the output.

Has anyone else experienced this, or has any progress been made on
identifying the make(?) change that caused this?  How would I go about
debugging this myself? (I have MSVC 6.0 installed also, so windows offers to
launch the MS debugger on each GPF)

Alternatively, can anyone suggest a GUI IDE that has similar features and
does work well with cygwin?

I've just reinstalled cygwin completely (deleted subdirs and contents of
c:\cygwin, and all Cygnus reg keys) today in the hopes that it was an
installation problem.

Warm Regards,
Chris

make.exe.stackdump:
Exception: STATUS_ACCESS_VIOLATION at eip=6105B807
eax=00000004 ebx=00000036 ecx=6109BB20 edx=61540000 esi=00000001
edi=0A011288
ebp=0022ED44 esp=0022ECFC program=c:\cygwin\bin\make.exe
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022ED44  6105B807  (00000001, 0A011288, 00000036, 6105A539)
0022ED64  6108FAE4  (61098020, 00000001, 0A011288, 00000036)
0022ED94  6108EEA0  (6109825C, 0A011288, 00000036, 6100E533)
0022EDC4  610829AA  (6109825C, 0040CB64, 0000000F, 00000004)
0022EE14  6108F329  (6109825C, 0022F084, 00000000, 00000001)
0022EE44  61087D01  (6109825C, 0022F084, 0000000A, 00000000)
0022F0A4  610895F6  (61098020, 6109825C, 0040CB40, 0022F120)
0022F0D4  61087DFF  (6109825C, 0040CB40, 0022F110, 0022F090)
0022F104  61084103  (0040CB40, 0A021FD8, 0A01E2D8, 00000138)
0022F144  6100FB94  (0A021FD8, 0A01E3A0, 0022F194, 0040CDEF)
0022F194  0040D154  (0A01E3A0, 00000000, 00000000, 0022F204)
0022F1C4  00402704  (0A01E3A0, 00000002, 00000000, 6105DBE7)
0022F1F4  0041AD07  (0A01E3A0, 0A01E2D8, 0022F234, 610829AA)
0022F254  0041A17D  (0A01E3A0, 00000003, 00000000, 00000000)
0022F294  00418A9A  (0A01E3A0, 00000002, 0022F2F4, 0041AFED)
0022F2E4  0041A5AA  (0A01E3A0, 00000001, 00000001, 00000000)
End of stack trace (more stack frames may be present)

cygcheck.out:
Cygnus Win95/NT Configuration Diagnostics
Current System Time: Tue Nov 27 08:57:44 2001

Windows NT Ver 4.0 build 1381 Service Pack 5

Path:	C:\cygwin\usr\local\bin
	C:\cygwin\bin
	C:\cygwin\bin
	c:\WINNT\SYSTEM32
	c:\WINNT
	c:\WIN32APP\TOOLKIT
	c:\ORANT\BIN
	c:\IMNnq_NT
	c:\WINNT\System32\WBEM
	C:\cygwin\bin

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

CYGWIN = `ntsec'
HOME = `C:\cygwin\home\tx17998'
MAKEFLAGS = `--unix'
MAKE_MODE = `unix'
PWD = `/home/tx17998'
USER = `tx17998'

a:  fd           N/A    N/A                    
c:  hd  NTFS    4094Mb  62% CP CS UN PA FC     
e:  cd  CDFS       0Mb -2147483548%    CS              Audio CD
f:  net NTFS   208386Mb  76% CP CS UN PA FC     
g:  net FAT    134676Mb  87% CP CS UN           HOME1
h:  net FAT    649857Mb  99% CP CS UN           CIFS.HOMEDIR
i:  net NTFS    8848Mb  94% CP CS UN PA FC     
k:  net NTFS   74769Mb  77% CP CS UN PA FC     Data
n:  net FAT    295239Mb  95% CP CS UN           DATA
q:  net FAT    295239Mb  95% CP CS UN           QDRIVE
w:  net FAT    80735Mb  89% CP CS UN           DATA

.              /cygdrive  user    binmode,noumount
C:/cygwin      /          system  binmode
C:/cygwin/bin  /usr/bin   system  binmode
C:/cygwin/lib  /usr/lib   system  binmode

Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe

   56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll
   34k 2001/09/30 C:\cygwin\bin\cygform6.dll
   18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll
   21k 2001/06/28 C:\cygwin\bin\cyghistory5.dll
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll
   81k 2000/12/05 C:\cygwin\bin\cygitcl30.dll
   35k 2000/12/05 C:\cygwin\bin\cygitk30.dll
  119k 2001/06/06 C:\cygwin\bin\cygjpeg6b.dll
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll
   19k 2001/09/30 C:\cygwin\bin\cygmenu6.dll
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll
  175k 2001/09/30 C:\cygwin\bin\cygncurses++6.dll
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll
  201k 2001/09/30 C:\cygwin\bin\cygncurses6.dll
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll
   12k 2001/09/30 C:\cygwin\bin\cygpanel6.dll
   40k 2001/11/21 C:\cygwin\bin\cygpcre.dll
   39k 2001/11/21 C:\cygwin\bin\cygpcreposix.dll
  163k 2001/05/06 C:\cygwin\bin\cygpng2.dll
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll
  135k 2001/06/28 C:\cygwin\bin\cygreadline5.dll
   66k 2001/11/20 C:\cygwin\bin\cygregex.dll
  390k 2000/12/05 C:\cygwin\bin\cygtcl80.dll
    5k 2000/12/05 C:\cygwin\bin\cygtclpip80.dll
   10k 2000/12/05 C:\cygwin\bin\cygtclreg80.dll
  623k 2000/12/05 C:\cygwin\bin\cygtk80.dll
   41k 2001/05/28 C:\cygwin\bin\cygXpm-noX4.dll
   49k 2001/02/03 C:\cygwin\bin\cygz.dll
  714k 2001/11/14 C:\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.3.5
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 47
        Shared data: 3
        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: Tue Nov 13 23:16:25 EST 2001
        CVS tag: cygwin-1-3-5-2
        Shared id: cygwin1S3

Cygwin Package Information
Package             Version             
ash                 20011018-1          
autoconf            2.52-1              
automake            1.5-1               
bash                2.05a-2             
binutils            20011002-1          
bison               1.28-1              
byacc               0.0                 
bzip2               1.0.1-6             
clear               1.0                 
cron                3.0.1-5             
crypt               1.0-1               
ctags               5.0.1-1             
cygrunsrv           0.94-2              
cygwin              1.3.5-3             
dejagnu             20010117-1          
diff                0.0                 
expect              20010117-1          
file                3.33-1              
fileutils           4.1-1               
findutils           0.0                 
gawk                3.0.4-1             
gcc                 2.95.3-5            
gdb                 20010428-3          
gdbm                1.8.0-3             
gettext             0.10.38-2           
ghostscript         6.51-1              
grep                2.4.2-1             
groff               1.17.2-1            
gzip                1.3.2-1             
indent              2.2.6-2             
inetutils           1.3.2-15            
jpeg                6b-4                
less                358-3               
libncurses5         5.2-1               
libncurses6         5.2-2               
libpng              1.0.11-1            
login               1.4-2               
lynx                2.8.4-1             
m4                  0.0                 
make                3.79.1-5            
man                 1.5g-2              
mingw               20010917-1          
mingw-runtime       1.1-1               
mutt                1.2.5i-5            
nano                1.0.6-1             
ncftp               3.0.2-2             
ncurses             5.2-7               
newlib-man          20001118-1          
openssl             0.9.6b-1            
patch               2.5-2               
pcre                3.7-1               
perl                5.6.1-2             
popt                1.6.1-1             
python              2.1.1-2             
readline            4.2-3               
regex               4.4-2               
rsync               2.4.6-3             
rxvt                2.7.2-6             
sed                 3.02-1              
sh-utils            2.0-2               
sharutils           4.2.1-1             
shutdown            1.2-1               
tar                 1.13.19-1           
tcltk               20001125-1          
tcsh                6.10.00-3           
termcap             20001216-1          
terminfo            5.2-1               
texinfo             4.0-4               
textutils           2.0.16-1            
time                1.7-1               
unzip               5.41-1              
vim                 6.0.93-1            
w32api              1.1-1               
wget                1.7-1               
which               1.5-1               
xpm-nox             4.0.3-1             
zip                 2.3-1               
zlib                1.1.3-6             

> -----Original Message-----
> From:	McGroarty, Brian [SMTP:[email-masked]]
> Sent:	Monday, November 19, 2001 3:34 PM
> To:	[email-masked]'
> Subject:	Cygwin make wants stdin != 0
> 
> I've just updated my cygwin installation.
> 
> Previously, I could launch make.exe from a Windows application with the
> code
> below. It's used to dump the output of a non-interactive make job to an
> internal buffer.
> 
> It now fails (stackdump below the code), seeming to want to reproduce the
> null read handle, which I understood to be valid when reads are not taking
> place. This was useful for catching tools which had accidentally been
> added
> to a makefile which expect user input.
> 
> Why has this behavior changed? Is this a bug, or am I incorrect about
> stdin=0 being legal?
> 
> The code follows --
> 
> 	HANDLE				PipeReadHandle;
> 	HANDLE				PipeWriteHandle;
> 	SECURITY_ATTRIBUTES		SecurityAttributes;
> 	STARTUPINFO				StartupInfo;
> 	PROCESS_INFORMATION		ProcessInfo;
> 
> 	ZeroMemory( &StartupInfo,		sizeof( StartupInfo ));
> 	ZeroMemory( &ProcessInfo,		sizeof( ProcessInfo ));
> 	ZeroMemory( &SecurityAttributes,	sizeof( SecurityAttributes
> ));
> 
> 	SecurityAttributes.nLength              =
> sizeof(SECURITY_ATTRIBUTES);
> 	SecurityAttributes.bInheritHandle       = TRUE;
> 	SecurityAttributes.lpSecurityDescriptor = NULL;
> 
> 	CreatePipe
> 	(
> 		&PipeReadHandle,		// address of variable for
> read handle
> 		&PipeWriteHandle,		// address of variable for
> write handle
> 		&SecurityAttributes,	// pointer to security attributes
> 		0				// default num bytes
> reserved for pipe
> 	);
> 
> 	StartupInfo.cb           = sizeof(STARTUPINFO);
> 	StartupInfo.dwFlags      = STARTF_USESHOWWINDOW |
> STARTF_USESTDHANDLES;
> 	StartupInfo.wShowWindow  = SW_HIDE;
> 	StartupInfo.hStdOutput   = PipeWriteHandle;
> 	StartupInfo.hStdError    = PipeWriteHandle;
> 
> 	CreateProcess
> 	( 
> 		NULL,			// pointer to name of executable
> module
> 		LPTSTR("c:\\cygwin\\bin\\make.exe clean"),	// command
> line 
> 		NULL,			// pointer to process security
> attributes 
> 		NULL,			// pointer to thread security
> attributes (use primary thread security attributes)
> 		TRUE,			// inherit handles
> 		0,			// creation flags
> 		environmentstrings,	// pointer to new environment block
> (use parent's)
> 		"d:\\wherever",	// pointer to current directory name
> 		&StartupInfo,	// pointer to STARTUPINFO
> 		&ProcessInfo	// pointer to PROCESS_INFORMATION
> 	);                 
> 
> 
> The current version produces this error:
> 
> 0 [main] make 1408 fhandler_base::dup: dup(unknown disk file) failed,
> handle
> 0, Win32 error 6
> 
> 
> And this make.exe.stackdump:
> 
> Exception: STATUS_ACCESS_VIOLATION at eip=6105C0B5
> eax=00000014 ebx=000000C8 ecx=7FFDE000 edx=61540000 esi=00000005
> edi=0242F0F0
> ebp=0242F014 esp=0242EFDC program=c:\cygwin\bin\make.exe
> cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
> Stack trace:
> Frame     Function  Args
> 0242F014  6105C0B5  (00000005, 0A0185B8, 0242F0A4, 00408B92)
> 0242F034  61081C62  (00000005, 00000000, 0242F0A4, 00408B2D)
> 0242F0A4  6100FB94  (0A018390, 0242F0EC, 00408D8E, 004045F2)
> 0242F0D4  00408F25  (0A018390, 00000001, 0242F0EC, 004260B4)
> 0242F134  00409149  (0242F19C, 0242F1A0, 00000000, 00403F3D)
> 0242F1B4  00403FFA  (00000000, 0A017793, FFFFFFFF, 00404636)
> 0242F1D4  004045AA  (0A017793, 00000018, 0242F214, 6108CC86)
> 0242F204  00404636  (0A017793, 00000000, 0242F254, 61082BB4)
> 0242F234  004048A2  (0A017793, 00000000, 00000007, 0041EA1C)
> 0242F294  0041EB0F  (0242F36C, 0A017788, 00000002, 00000000)
> 0242F384  00414EFD  (004139D3, 00000000, 0242F3D4, 004212D1)
> 0242F3D4  00413BA2  (00000000, 00000000, 0242FD74, 0041046B)
> 0242FD74  004104A7  (00000003, 0A011A48, 0A010278, 00000000)
> 0242FF10  61003FA2  (00000000, 00610065, 00000004, FF9C57E8)
> 0242FF40  610041B9  (0040F840, 00610065, 812CC880, 8046CB60)
> 0242FF60  610041F8  (00000000, 00000000, 812CCA10, 00000005)
> End of stack trace (more stack frames may be present)
> 
> 
> 
> ---
> "Law never made men a whit more just; and, by means of their respect for
> it,
> even the well-disposed are daily made the agents of injustice." -- Henry
> David Thoreau
> 
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/