delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/08/10:25:29

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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 8 Jul 2004 10:25:09 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: negative error status: gcc vs. cl
In-Reply-To: <20040708100919.GB32001@cygbert.vinschen.de>
Message-ID: <Pine.GSO.4.58.0407081018370.11665@slinky.cs.nyu.edu>
References: <Pine DOT WNT DOT 4 DOT 21 DOT 0407081106020 DOT 247-100000 AT pc0197 DOT nagra-kudelski DOT ch> <20040708100919 DOT GB32001 AT cygbert DOT vinschen DOT de>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Thu, 8 Jul 2004, Corinna Vinschen wrote:

> On Jul  8 11:49, Daniel Lungu wrote:
> > Feel like bash tcsh on Cygwin mess up with negative exit status from a cl
> > compiled .exe
>
> The answer is "don't do that".  Use positive values in the range from
> 0 to 255.  See
> http://www.opengroup.org/onlinepubs/009695399/functions/exit.html
>
> Corinna

Corinna,

Actually, it looks like another buglet in Cygwin.  The code in
spawn_guts() in spawn.cc (line 847 in CVS HEAD) simply binary-ORs the
exitcode value returned by GetExitCodeProcess with the "res" variable.
However, the "res" variable is also used to carry some flags, and a
negative exitcode, being a full DWORD, accidentally sets those, so all
sorts of havoc can potentially occur (and I'm surprised that all that
happens is the wrong exit code).

I could work on a patch, but just saying that the errorcode should be
binary-ANDed with 0xFF before being binary-ORed with "res" should be
faster.

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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