Conversation
This was referenced Sep 17, 2026
dev_t is signed on some platforms (macOS: i32), and st_rdev has that type just like st_dev. st_dev already sign-extends a negative value; st_rdev went straight through u64::try_from(..).unwrap(), which panics with TryFromIntError on a negative device number. Apply the same conversion, which also matches std's MetadataExt::st_rdev (`st_rdev as u64`).
zackees
force-pushed
the
fix/signed-rdev
branch
from
September 24, 2026 06:33
2e979e3 to
1368db9
Compare
Author
|
The fix worked but the CI is broken. I created a new or to fix the CI and rebased on top of that. |
zackees
added a commit
to zackees/kernal-api
that referenced
this pull request
Sep 25, 2026
Hosted Intel and Apple Silicon runners pass every test the Recovery guest excluded as a macOS finding (exact-SHA run 36067778414), so what remains excluded is guest-only: - cap-primitives st_rdev panic: the guest reports negative device numbers; wait for sunfishcode/cap-std#428 rather than [patch]. - ENOTSUP from the guest filesystem's atomic renames, now also covering install_directory's RENAME_SWAP (documented to return the fs error). - one two-core timing window. Re-enabled in the guest: the PTY restore and owner-bound child tests (fixed in #347) and the containment-state test, which passes there now. owned_group_termination_reaches_the_grandchild failed intermittently in the guest because Child::wait closes stdin first, letting the root read EOF and exit 0 before the SIGKILL landed. Hold stdin across a bounded wait and assert the root died by SIGKILL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Fixes #427.
dev_tis signed on some platforms (on macOS it isi32).from_rustixalready handles that forst_devby sign-extending throughi64, butst_rdevhas the same type and went throughu64::try_from(stat.st_rdev).unwrap(), which panics withTryFromIntError(())when the device number is negative. We hit this on an x86_64 macOS host:symlink_metadatapanics atmetadata_ext.rs:171.This applies the existing
st_devconversion tost_rdevand widens the existing comment to cover both. The function's#[allow(unused_comparisons)]already covers platforms wheredev_tis unsigned. Sign-extending matches std:std::os::darwin::fs::MetadataExt::st_rdevreturnsst_rdev as u64.There's no regression test, because a negative
st_rdevcan't be produced portably. The change mirrors thest_devcode a few lines above.This PR is stacked on #429: the CI repairs are the first commit, and this
st_rdevchange follows them. Once #429 merges, this branch can be rebased ontomainso #428 contains only this fix.Validated locally: Rust 1.70
cargo test --workspace --features=fs_utf8,arf_strings; Windowsx86_64-pc-windows-gnutest check; nightlycargo fuzz build --dev; and Rust 1.95 formatting. GitHub marked the workflowaction_required; no checks have started yet.If this is acceptable, a 4.0.4 patch release would let downstream users pick it up without a
[patch]. Thanks!