delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/02/28/02:13:46

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Message-ID: <000701c0a156$9b80e8f0$250ddb18@fision>
From: "Jason Gouger" <cygwin AT jason-gouger DOT com>
To: <cygwin-developers AT cygwin DOT com>
Subject: incorrect exit status from cygwin exec to windows process
Date: Tue, 27 Feb 2001 23:18:10 -0800
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

There appears to be some error when a cygwin process exec's another cygwin 
process, and returns the exit status to a windows process.  The windows 
process receives a return code of '131072'.  The problem appeared sometime 
after the cygwin 1.1.4 release. 

To reproduce the error, try the following: 

1. Compile the "x.c" program below with a windows compiler, e.g. MSVC or 
similar. 
   cl x.c 

   #include <stdio.h> 
   #include <process.h> 

   int main(int argc, char **argv) { 
     const char *cmdline = argv[1]; 
     int ret_code; 
     printf("COMMAND LINE: (%s)\n", cmdline); 
     fflush(stdout); fflush(stderr); 
     ret_code = system(cmdline); 
     fflush(stdout); fflush(stderr); 
     printf("RETURN CODE: %d\n", ret_code); 
     fflush(stdout); fflush(stderr); 
     exit(ret_code); 
   } 

2. From a cygwin shell (bash), type the following command: 
   ./x.exe 'C:\cygwin\bin\bash -c /bin/date' 

   Results: 
      COMMAND LINE: (C:\cygwin\bin\bash.exe -c /bin/date) 
      Tue Feb 27 22:55:39  2001 
      RETURN CODE: 131072 

3. Create a script, e.g. 
   echo /bin/date > x.sh 

   Run the command: 
      ./x.exe 'C:\cygwin\bin\bash x.sh' 

   Results: 
      COMMAND LINE: (C:\cygwin\bin\bash.exe x.sh) 
      Tue Feb 27 22:58:34  2001 
      RETURN CODE: 0 

4. Change the script to have an exec, e.g. 
   echo exec /bin/date > x.sh 

   Run the command: 
      ./x.exe 'C:\cygwin\bin\bash x.sh' 

   Results: 
      COMMAND LINE: (C:\cygwin\bin\bash.exe x.sh) 
      Tue Feb 27 22:59:47  2001 
      RETURN CODE: 131072 

I tried the same with "tcsh.exe" and received the same results, so it 
appears as if the bug is within the cygwin1.dll. 

Any ideas? 

-Jason 


- Raw text -


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