public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST: Cygwin 3.0.0-0.7
Date: Thu, 07 Feb 2019 16:14:00 -0000	[thread overview]
Message-ID: <02da4eeb-fcce-b1bc-e6eb-68ff3ec0cf74@ssi-schaefer.com> (raw)
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

  reply	other threads:[~2019-02-07 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 15:24 Corinna Vinschen
2019-02-07 16:14 ` Michael Haubenwallner [this message]
2019-02-07 18:27   ` Corinna Vinschen
2019-02-08  6:46     ` Michael Haubenwallner
2019-02-08 11:32       ` Corinna Vinschen
2019-02-08 11:51         ` Michael Haubenwallner
2019-02-08 12:21           ` Corinna Vinschen
2019-02-08 12:23             ` Corinna Vinschen
2019-02-08 12:52               ` Michael Haubenwallner
2019-02-08 13:06                 ` Corinna Vinschen
2019-02-08 13:28                   ` Corinna Vinschen
2019-02-08 14:43                     ` Michael Haubenwallner
2019-02-08 14:49                       ` Corinna Vinschen
2019-02-08 16:18                         ` Michael Haubenwallner
2019-02-08 16:50                           ` Corinna Vinschen
2019-02-08 16:35                     ` Michael Haubenwallner
2019-02-08 16:58                       ` Corinna Vinschen
2019-02-08 17:00                         ` Corinna Vinschen
2019-02-11 11:50                           ` Michael Haubenwallner
2019-02-11 13:33                             ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02da4eeb-fcce-b1bc-e6eb-68ff3ec0cf74@ssi-schaefer.com \
    --to=michael.haubenwallner@ssi-schaefer.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).