| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
NetBSD's posix_spawn() surprisingly has the same bug as its
posix_spawnp(): the executable is resolved before the file actions.
Detect this case and work around it by falling back to fork()/exec() if
we need to.
|
|
|
|
| |
Fixes: 8c130ca ("xspawn: Check X_OK even without $PATH resolution")
|
|
|
|
|
|
| |
Otherwise the child process runs with all signals blocked.
Fixes: 423cfa4 ("xspawn: Mask signals before fork()")
|
|
|
|
|
|
| |
This replaces the explicit CPPFLAGS list in flags.mk with just
`-include src/prelude.h`, shortening our compiler command lines and
allowing them to be easily documented.
|
| |
|
|
|
|
|
| |
Rather than a bunch of manual fallback macros, just provide a fallback
definition that returns false.
|
|
|
|
|
|
|
|
|
|
| |
POSIX allows optional features to be supported at compile time but not
necessarily at run time by defining _POSIX_OPTION to 0 and requiring
users to check sysconf(_SC_OPTION) > 0. The new sysoption() macro
simplifies the check.
sighook() and bfs_spawn() now check for conditional runtime support for
the relevant POSIX options.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This completes the workaround for bfs_spawn() hanging on FreeBSD with
ASan enabled.
Link: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280318
|
|
|
|
|
|
|
|
|
|
| |
This should have been benign (just a performance regression), but
FreeBSD has a bug that causes the fork()-based fallback to lock up when
ASAN is enabled, due to fork() and dl_iterate_phdr(). This is not a
complete workaround for that issue, since the fork() fallback may be
used for other reasons.
Fixes: 29ddac2 ("config: Check for posix_spawn_file_actions_addfchdir{,_np}()")
|
|
|
|
|
|
|
|
|
|
| |
Not all posix_spawn() implementations use errno to report execv()
failures from the child process, as that requires either a kernel
posix_spawn() implementation or a pipe to pass the error back.
This should fix tests/posix/exec_nonexistent on OpenBSD and HPPA.
Link: https://buildd.debian.org/status/fetch.php?pkg=bfs&arch=hppa&ver=3.3.1-1&stamp=1717489148&raw=0
|
| |
|
|
|
|
| |
This prevents signal handlers from running in the child before execve().
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
On macOS, posix_spawnp() resolves the executable against the $PATH
*before* the file_actions are applied, contrary to the upcoming POSIX
wording [1] for posix_spawn_file_actions_addfchdir().
[1]: https://www.austingroupbugs.net/view.php?id=1208#c4830
|
|
|
|
|
|
|
|
|
| |
Technically, we should be resolving executables *after* applying the
file actions. It's only safe to resolve earlier if $PATH contains no
relative entries, or if there are no fchdir() actions.
The new implementation resolves as early as possible, deferring to
posix_spawnp() if necessary for correctness.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
posix_spawnp() is typically implemented like execvp(), i.e., by
repeatedly trying execv() with each $PATH component until it succeeds.
This is much slower than resolving the executable path up-front and then
calling execv() once, so do that.
Fixes: https://github.com/tavianator/bfs/pull/127#issuecomment-1795095126
|
|
|
|
| |
Fixes #47.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
In anticipation of C23, since those headers won't be necessary any more.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
And while I'm at it, remove years from copyright declarations.
Link: https://spdx.dev/about/
Link: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Since __has_include() needs special preprocessing rules (e.g. not
expanding `linux` in `__has_include(<linux/stat.h>)`, macros that expand
to __has_include() do not necessarily behave correctly. Instead, we
have to directly test `#if __has_include(...)`.
See https://bugs.llvm.org/show_bug.cgi?id=37990 for more details.
|
|
|
|
|
| |
And set errno correctly if neither one is. Fixes
tests/posix/exec_nopath on Android.
|
| |
|
|
Moved Source Files Into `src` Folder
|