Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Always set arguments on POSIX #147

Merged
merged 2 commits into from
Feb 22, 2018

Conversation

amerry
Copy link
Contributor

@amerry amerry commented Feb 21, 2018

Explicitly specifying an executable (either with boost::filesystem::path
or boost::process::exe) and no arguments causes NULL to be passed as the
argument list.

Not only is this unexpected behaviour for the child process (which
doesn't even have argv[0]), it is not portable across UNIX systems. From
the execve(2) man page on Linux:

"On Linux, either argv or envp can be specified as NULL, which has the
same effect as specifying these arguments as a pointer to a list
containing a single NULL pointer. Do not take advantage of this
misfeature! It is nonstandard and nonportable: on most other UNIX
systems doing this will result in an error (EFAULT)."

Explicitly specifying an executable (either with boost::filesystem::path
or boost::process::exe) and no arguments causes NULL to be passed as the
argument list.

Not only is this unexpected behaviour for the child process (which
doesn't even have argv[0]), it is not portable across UNIX systems. From
the execve(2) man page on Linux:

"On Linux, either argv or envp can be specified as NULL, which has the
same effect as specifying these arguments as a pointer to a list
containing a single NULL pointer.  Do not take advantage of this
misfeature!  It is nonstandard and nonportable:  on  most other UNIX
systems doing this will result in an error (EFAULT)."
Insofar as there are copyrights on these changes, they are owned by my
employer, as I'm doing this on company time.
@klemens-morgenstern
Copy link
Owner

TBH I'd feel more comfortable if you would put your own name in as copyright holder to be honest. It looks a bit strange to have a company in an open-source library.

@amerry
Copy link
Contributor Author

amerry commented Feb 22, 2018

It's inaccurate, though - I don't own the copyright on this work (although I do have permission from my employer to make these and similar contributions). Note that other parts of the Boost codebase have copyrights by Microsoft, Multi Media Ltd, Garmin Ltd and Cadenza New Zealand Ltd, among others.

If I was doing this on my own time, it would be different (I have a release from my employer for that), but this is done on company time to support company software.

Although I'm pretty sure exit_argc.cpp isn't copyrightable in most jurisdictions anyway...

@klemens-morgenstern klemens-morgenstern merged commit d4a0444 into klemens-morgenstern:develop Feb 22, 2018
klemens-morgenstern added a commit that referenced this pull request May 20, 2020
close_out.hpp:25:52: warning: suggest braces around initialization of subobject
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants