cli/tests: Treat spawn exit 127 as not found - #564
Open
Xeonacid wants to merge 1 commit into
Open
Conversation
`program_reports_version` skips optional tools such as `jq` and `jj` when they are missing. It currently only treats `ErrorKind::NotFound` from `Command` as absence. Rust's `Command` uses glibc `posix_spawn` on Unix. When execve fails after spawn has already returned, POSIX requires the child to exit 127 rather than reporting errno to the parent. glibc usually copies that failure back through a `CLONE_VM|CLONE_VFORK` shared-stack channel, but not every implementation preserves it. qemu-user, OpenBSD, and HPPA surface a successful spawn and a 127 status instead. On those platforms the helper panics, so tests that are meant to skip without `jq` or `jj` fail. Treat exit status 127 the same as `NotFound`. See posix_spawn(3) and POSIX.1 on the 127 spawn-error status. Signed-off-by: Xeonacid <h.dwwwwww@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
program_reports_versionis used so that tests which need optional tools such asjqandjjcan skip when those tools are not installed. It currently treats onlystd::io::ErrorKind::NotFoundfromCommandas absence.Rust's
Commanduses glibcposix_spawnon Unix. POSIX requires that ifexecvefails afterposix_spawnhas already returned success, the child exits with status 127 rather than reporting errno to the parent. glibc usually copies that failure back through aCLONE_VM|CLONE_VFORKshared-stack channel, but not every implementation preserves it. qemu-user, OpenBSD, and HPPA surface a successful spawn and a 127 status instead.On those platforms the helper panics, so tests that are meant to skip without
jqorjjfail. Treat exit status 127 the same asNotFound.See posix_spawn(3) and POSIX.1 on the 127 spawn-error status.