Repository navigation
test(rust): skip the vtab permission tests when the OS ignores mode bits - #992
Merged
Merged
Conversation
`unreadable_file_yields_null_content_without_erroring_the_row` chmods a fixture 0o000 and asserts `content` comes back NULL. Root bypasses permission bits, so the read succeeds and the assertion fails -- the product is fine, the test's precondition just cannot hold for a privileged process. The hosted sandbox runs as uid 0, so `cargo test --workspace --features cli` was never clean there and `cargo mutants` aborted on the unmutated baseline. Probe the precondition instead of asserting it: `make_unreadable` chmods the file and reports whether a read actually fails, and both permission tests bail out with a note when it does not. Probing beats a `geteuid() == 0` check -- it needs no `unsafe`/libc, and it also covers a non-root process holding CAP_DAC_OVERRIDE. `star_does_not_read_file_bodies` shares the precondition. It passed under root rather than failing, but only vacuously, so it gets the same guard. Fixes #977
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 #977
What
packages/rust/tests/vtab.rs::unreadable_file_yields_null_content_without_erroring_the_rowchmods a fixture0o000and assertscontentcomes backNULL. Root bypasses permission bits, so the read succeeds,contentisSome("classified"), and the assertion fails. The product is fine — the test's precondition simply cannot hold for a privileged process. The hosted sandbox runs as uid 0, socargo test --workspace --features cliwas never clean there andcargo mutantsaborted on the unmutated baseline.This probes the precondition instead of assuming it:
Both permission-dependent tests call it and bail with a note when it returns
false.Why probing, not
geteuid() == 0The issue suggested a euid check. Probing is better on two counts: it needs no
unsafe(so no#[expect(unsafe_code, reason = ...)]against the crate'sunsafe_code = "deny"lint) and nolibccall, and it also covers a non-root process holdingCAP_DAC_OVERRIDE, where a euid check would still let the test fail.The skip is observable, not silent — it prints under
--nocapture/--show-output:Slightly beyond the issue's scope
star_does_not_read_file_bodiesshares the samechmod 0o000precondition. It passed under root rather than failing, but only vacuously — the permission error it exists to prove is absent never existed. It gets the same guard, so a green run means the same thing everywhere.Manual verification
Run in the hosted sandbox (uid 0), pre- and post-fix:
The uid-65534 run printed no skip line, which is the point: the guard is inert for a normal developer and for CI, and the two tests still carry their original teeth.
Whole Rust suite under uid 0 is now clean:
cargo test --workspace --features cli→ exit 0, zero failures (was 1 failure before).Gates run locally
cargo test --workspace --features clicargo fmt --check -p dirsqlcargo clippy --workspace -- -D warnings(CI's exact invocation)unit colocated-testunit lintintegration lintunit mutation --base origin/maindirsql-checks changelog-gatee2e verifyE2E Verification
N/A - test-only(one file,packages/rust/tests/vtab.rs; no source underpackages/rust/src,packages/ts/src,packages/python/src, orpackages/ts/napiis touched). Both packages'e2e verifygates were still run locally and pass —[e2e].extra_scopenamespackages/rust/src, notpackages/rust/tests, so neither attestation goes stale.Changelog / Migrations
changelog_gate'sdecide.pyclassifiespackages/<pkg>/tests?/as test, not source. Verified by running the gate against this diff (exit 0).PARITY.mdneeds no update: no SDK public API surface changed.Red/green note
Red/green's pushed-CI-RED gate does not apply here. The change adds no product behavior — it corrects a test's handling of a precondition the OS refuses to grant. CI runs as a non-root user, where behavior before and after is byte-identical, so there is no CI-observable RED to push. The RED that exists is the local reproduction above (uid 0, pre-fix), which the fix flips to green.
Generated by Claude Code