public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nachms+sourceware at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/18433] New: posix_spawn does not return correctly upon failure to execute
Date: Tue, 19 May 2015 20:34:00 -0000 [thread overview]
Message-ID: <bug-18433-131@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=18433
Bug ID: 18433
Summary: posix_spawn does not return correctly upon failure to
execute
Product: glibc
Version: 2.19
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: nachms+sourceware at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
posix_spawn is supposed to return a value indicating an error when it fails.
The specification for it is here:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html
>From the spec: Otherwise, no child process shall be created, the value stored
into the variable pointed to by a non-NULL pid is unspecified, and *an error
number shall be returned as the function return value* to indicate the error.
However, glibc is returning 0 (success) instead of some kind of indication of
error (such as 2 for ENOENT).
Test program:
-------------------------
#include <stdio.h>
#include <spawn.h>
int main()
{
extern char **environ;
char *argv[] = { "/bin/blah_blah-blah", 0 };
pid_t pid = -1;
int ret = posix_spawn(&pid, argv[0], 0, 0, argv, environ);
printf("ret: %d\npid: %ld\n", ret, (long)pid);
return(0);
}
-------------------------
"/bin/blah_blah-blah" doesn't exist, so it should not successfully spawn.
GLIBC for this program is returning:
ret: 0
pid: 17302
FreeBSD, DragonFlyBSD, NetBSD, and musl-libc all handle this correctly.
With them:
ret: 2
pid: -1 (some will put a different value here, which is allowed by the
standard)
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2015-05-19 20:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 20:34 nachms+sourceware at gmail dot com [this message]
2015-06-05 9:41 ` [Bug libc/18433] " fweimer at redhat dot com
2015-09-10 14:25 ` rahimi.nv at gmail dot com
2015-09-10 18:20 ` pb at pbcl dot net
2015-09-12 19:03 ` nachms+sourceware at gmail dot com
2015-09-12 20:56 ` rahimi.nv at gmail dot com
2015-09-12 21:00 ` rahimi.nv at gmail dot com
2015-09-12 21:07 ` rahimi.nv at gmail dot com
2015-09-13 12:15 ` rahimi.nv at gmail dot com
2021-07-26 19:03 ` vtjnash at gmail dot com
2021-07-26 19:33 ` adhemerval.zanella at linaro dot org
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=bug-18433-131@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=glibc-bugs@sourceware.org \
/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).