Author kevans
Recipients gregory.p.smith, izbyshev, kevans, koobs, nanjekyejoannah, pablogsal, serhiy.storchaka, vstinner
Date 2019-01-16.04:15:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547612159.68.0.927563044068.issue35537@roundup.psfhosted.org>
In-reply-to
Content
> * On FreeBSD, if setting posix_spawn() "attributes" or execute posix_spawn() "file actions" fails, posix_spawn() succeed but the child process exits immediately with exit code 127 without trying to call execv(). If execv() fails, posix_spawn() succeed, but the child process exit with exit code 127.

Hi,

As a disclaimer, I'm a FreeBSD developer interested in making sure we're doing the right thing here. =)

May I ask what the above assessment is based on, and specifically what we need to address?

As far as I can tell, our implementation is as POSIX describes -- errors processing the file actions or attrs triggers a 127 exit [1][2] which get bubbled up via the return value to posix_spawn [3]. exec failures capture errno at [4] and bubble the error up to the return value of posix_spawn as well via [3]. POSIX explicitly does not require an implementation to use errno for this, only return values, and we seem to have gone the route of not using errno to match OpenSolaris behavior.

What do I need to do to reproduce the results for deriving the results seen in the above quote, so that I can fix us and we can also see this improvement?

I threw together a minimal C reproducer for posix-spawn on -current (this particular bit being unchanged since FreeBSD 11.x times) and was returned ENOENT for a bad exec and otherwise given a pid for successful exec with a return of 0.

[1] https://svnweb.freebsd.org/base/head/lib/libc/gen/posix_spawn.c?view=markup#l214
[2] https://svnweb.freebsd.org/base/head/lib/libc/gen/posix_spawn.c?view=markup#l219
[3] https://svnweb.freebsd.org/base/head/lib/libc/gen/posix_spawn.c?view=markup#l232
[4] https://svnweb.freebsd.org/base/head/lib/libc/gen/posix_spawn.c?view=markup#l225
History
Date User Action Args
2019-01-16 04:16:01kevanssetrecipients: + kevans, gregory.p.smith, vstinner, serhiy.storchaka, koobs, izbyshev, pablogsal, nanjekyejoannah
2019-01-16 04:15:59kevanssetmessageid: <1547612159.68.0.927563044068.issue35537@roundup.psfhosted.org>
2019-01-16 04:15:59kevanslinkissue35537 messages
2019-01-16 04:15:59kevanscreate