This is the mail archive of the cygwin@cygwin.com 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]

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/


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