Repository navigation
Fix error handling in PosixSpawnAttr / PosixSpawnFileActions methods - #2865
Merged
Merged
Conversation
asomers
approved these changes
Nov 10, 2026
asomers
left a comment
Member
There was a problem hiding this comment.
Thanks for the fix. The CI failure should be fixed on the master branch. I'm going to optimistically attempt a merge, since we use merge queue.
asomers
enabled auto-merge
November 10, 2026 17:34
This was referenced Nov 10, 2026
asomers
disabled auto-merge
November 10, 2026 17:59
Member
|
Nevermind, Github doesn't like that. @thelastbackspace please rebase. |
The posix_spawnattr_* and posix_spawn_file_actions_* functions return 0 on success and an error number on failure. Errno::result only treats -1 as an error, so failures were reported as Ok(()). Fixes nix-rust#2855
Contributor
Author
|
Rebased onto master. |
thelastbackspace
force-pushed
the
fix/2855-spawn-errno
branch
from
November 10, 2026 18:08
e60f340 to
e315cbe
Compare
asomers
approved these changes
Nov 10, 2026
asomers
enabled auto-merge
November 10, 2026 18:12
3 tasks done
asomers
disabled auto-merge
November 14, 2026 17:41
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.
The
posix_spawnattr_*andposix_spawn_file_actions_*functions return 0 on success and the error number on failure, they don't return -1 and set errno. The wrappers insrc/spawn.rsusedErrno::result, which only treats -1 as an error, so every failure came back asOk(()). #2595 already fixed this forposix_spawn/posix_spawnpthemselves, this does the same for the rest of the file.I added a small
spawn_resulthelper and used it for all of them. That also meansinit()no longer reachesassume_init()when init fails.Added a test that
add_dup2(-1, 1)andadd_close(-1)returnEBADF. Both returnedOk(())before the change.The
reinitdouble-destroy path mentioned in #2797 is a separate problem, so I didn't touch it here.Fixes #2855