delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/29/03:54:04

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <42997508.60300@familiehaase.de>
Date: Sun, 29 May 2005 09:53:44 +0200
From: "Gerrit P. Haase" <gerrit AT familiehaase DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.5.16: DuplicateHandle(Out) failed (e=6)
References: <1117157441 DOT 475ed70cnlm24 AT email DOT byu DOT edu> <20050529054820 DOT GA3024 AT efn DOT org>
In-Reply-To: <20050529054820.GA3024@efn.org>
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019