Yitzchak Scott-Thoennes wrote:

On Thu, May 26, 2005 at 07:30:41PM -0600, Nathan L Mullen wrote:

I recently upgraded from Cygwin 1.5.6-1 to 1.5.16-1.


Does it still happen with 1.5.17-1?

Did you upgrade perl at the same time?  If so, do you know what
the old version was?


I received the following error from GNU make 3.80 when I ran ???mk??? in Cygwin 1.5.16:
process_easy: DuplicateHandle(Out) failed (e=6)
t:/make/380/bin/make: interrupt/Exception caught (code = 0xc0000005, addr = 
0x417344) system() returned code 65280: exit code 255

As both mk and make 3.80 are big (and don???t have a lot to do with Cygwin), I have spent some time narrowing down the problem. I have produced a set of small files that produce the same error. A very specific script structure is needed to reproduce the error (a bash script must call a perl script, which in turn must use back-ticks to run an executable that has a call to DuplicateHandle(Out)) (that is the same script structure that mk uses--and that causes DuplicateHandle(Out) to fail).
Here are the 3 necessary files to reproduce the error (showProb.sh, 
showProb.pl, showProb.c):


showProb.sh: ###########################################
   #!/bin/sh
   perl -S showProb.pl


That's not a bash script.
Is the -S necessary?  (= search for perl script on your path)
showProb.pl: ##########################################
 system("showProb.exe"); #this DupHandle works correctly
 $cwd = `pwd`; # This completes successfully
 system("showProb.exe"); #now DupHandle does _NOT_ work



showProb.c: ###########################################
 /*
* Description: A very stripped-down version of process_easy in * GNU make 3.80 (make/380/w32/subproc/sub_proc.c)
 */
 #include <stdlib.h>
#include <stdio.h>
#include <process.h>  /* for msvc _beginthreadex, _endthreadex */
#include <windows.h>
int main(){
 HANDLE hOut;
 if (DuplicateHandle(GetCurrentProcess(),
                     GetStdHandle(STD_OUTPUT_HANDLE),
                     GetCurrentProcess(),
                     &hOut,
                     0,
                     TRUE,
                     DUPLICATE_SAME_ACCESS) == FALSE) {
fprintf(stderr, "\nprocess_easy: DuplicateHandle(Out) failed (e=%d)\n", GetLastError());
   /*return INVALID_HANDLE_VALUE;*/
 }
 else{
   fprintf(stderr, "\nprocess_easy: DuplicateHandle(Out) SUCCESS\n");
 }
 CloseHandle(hOut);
 return 0;
}



I used cl to compile showProb.c: ???cl showProb.c ???o showProb.exe???.


Does it fail for you compiled with:

 gcc -o showProb.exe -mno-cygwin showProb.c

It doesn't for me, on cygwin 1.5.17-1.

And doesn't fail with cygwin-1.5.16 when using gcc, probably a bug in
cl?

$ gcc -o showprob showprob.c

$ ./showprb.sh

process_easy: DuplicateHandle(Out) SUCCESS

process_easy: DuplicateHandle(Out) SUCCESS

$ gcc -mno-cygwin -o showprob showprob.c

$ ./showprb.sh

process_easy: DuplicateHandle(Out) SUCCESS

process_easy: DuplicateHandle(Out) SUCCESS


Gerrit
--
=^..^=

--
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/

Reply via email to