delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/07/11:18:09

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:from:to:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=DyNgQWDXK0GH4s4W
riW+tCMUT49UZOF75tRAiaA96EGT/LPVrOtKUuqR2uUxJ5WKNU/8TegXd+Oaw+Mr
N3DX3/wume/a9y6a56edWh6TaMbQtNxs3s4jDPnFosf6K6p2bBc6gfdFGmGalEtn
TdyStLwsjbYqxDihTROUGKfGzNg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:references:from:to:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=Qq3VSf7Z8ZsSLs2rUI66Pz
F0/F0=; b=JO8svf/Xj2gxuzt8CdwSxQbmai/wLV7bEeLVmih1brNrIpTYOPSF/E
OgvoTbm5QnTHWkmhrIvBYHe74I0m4hQEuyklhwg1uUFF8vbkiEYLUMTkdUY1h1zF
J8cq2sPy7EdMT4fKRzZ3bGAXYqdgfYvS3Yp1R/KpmniAHX6aCMWkk=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=folks, H*M:e6eb
X-HELO: atfriesa01.ssi-schaefer.com
Subject: Re: [ANNOUNCEMENT] TEST: Cygwin 3.0.0-0.7
References: <announce DOT 20190205151855 DOT GD16130 AT calimero DOT vinschen DOT de>
From: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>
To: cygwin AT cygwin DOT com
Openpgp: preference=signencrypt
Message-ID: <02da4eeb-fcce-b1bc-e6eb-68ff3ec0cf74@ssi-schaefer.com>
Date: Thu, 7 Feb 2019 17:14:46 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
In-Reply-To: <announce.20190205151855.GD16130@calimero.vinschen.de>

On 2/5/19 4:18 PM, Corinna Vinschen wrote:
> Hi folks,
> 
> 
> I uploaded a new Cygwin test release 3.0.0-0.7
> 

> Please test.
> 

There's another regression - regarding spawn, exec and waitpid,
loosing the exitstatus somewhere in between:

$ cat > dospawn.c <<EOF
#include <sys/types.h>
#include <sys/wait.h>
#include <process.h>
#include <stdio.h>

int main(int argc, char const **argv)
{
  if (argc > 1)
    {   
      int pid = spawnv(_P_NOWAITO, argv[1], &argv[1]);
      if (pid) 
        {
          int status = 0;
          pid_t wpid = waitpid(pid, &status, 0);
          if (wpid > 0)
            {
              printf("waitpid: pid %d status 0x%x\n", pid, status); 
              if (WIFEXITED(status))
                {
                  int ret = WEXITSTATUS(status);
                  return ret;
                }
            }
        }
    }   
  return 127;
}
EOF

$ gcc dospawn.c -o dospawn
$ ./dospawn /bin/bash -c /bin/false
waitpid: pid 123 status 0x0        <= 2.11.2 does provide status 0x100 as expected
$ echo $?
0        <= Actually I do expect the exit status of /bin/false to show up here.

It is important to have the exec() in between:
$ ./dospawn /bin/false
waitpid: pid 123 status 0x100
$ echo $?
1

Note that bash does detect it can simply exec("/bin/false"). With more complex
commands bash does not just exec():

$ ./dospawn /bin/bash -c ':; /bin/false'
waitpid: pid 123 status 0x100
$ echo $?
1

/haubi/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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