Repository navigation
Bypass env in the closed-stdin autolint test - #129
Merged
Merged
Conversation
Summary The scheduled `Tests` run failed `files0 stdin: closed descriptor` on the Ubuntu and WSL legs once `ubuntu-latest` moved to Ubuntu 26.04. The product guard was never at fault: the test closed fd 0 and then ran `bin/autolint` through its `#!/usr/bin/env bash` shebang, and Ubuntu 26.04's `env` comes from uutils coreutils. Rust's std runtime reopens any closed descriptor 0-2 on /dev/null before `main`, so autolint received an open, empty /dev/null stream, indistinguishable from a deliberate `</dev/null` empty manifest. - run the closed-stdin case as `"$BASH" "$AUTOLINT"`, so the closed descriptor reaches the guard on every platform - leave `_autolint_read_files0` unchanged: its `/dev/stdin` probe is correct whenever fd 0 actually arrives closed - supersedes the automated fix in #128, which blamed the probe and then bash Testing - reproduced locally with a minimal Rust exec wrapper standing in for uutils `env`: fd 0 arrives as /dev/null and `autolint --files0-from - <&-` exits 0 silently, while GNU `env` and direct `bash` keep fd 0 closed and exit 2 with the actionable message - #128's CI diagnostic showed fd 0 as `lrwx` /dev/null inside autolint, matching Rust's O_RDWR reopen rather than a shell redirect - removing the guard makes the updated invocation exit 0, so the test still catches a regression - `test/suites/autolint-test`: 517 passed, 0 failed - `test/checkrun-test`: only `schema-refresh` refs cases fail, from the local host lacking the `referencing` library; that suite is untouched - `checkrun format`, `checkrun lint`, and the shellcheck-inventory check at the locked cgraf78/actions SHA pass
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.
Summary
Fixes the scheduled
Testsfailure in https://github.com/cgraf78/checkrun/actions/runs/41596810832, wheretest/suites/autolint-testfailedfiles0 stdin: closed descriptor exits 2and... is actionableon the Ubuntu and WSL legs afterubuntu-latestmoved to Ubuntu 26.04. Supersedes #128.Root cause: the product guard was never at fault. The test closed fd 0 and then ran
bin/autolintthrough its#!/usr/bin/env bashshebang. Ubuntu 26.04's coreutils are uutils (the runner image listscoreutils 9.5-1ubuntu2+0.0.0~ubuntu25), so/usr/bin/envis a Rust binary, and Rust's std runtime reopens any closed descriptor 0-2 on/dev/null(O_RDWR) beforemain. autolint therefore received an open, empty/dev/nullstream, which is indistinguishable from a deliberate</dev/nullempty manifest, and exited 0 quietly."$BASH" "$AUTOLINT" --files0-from - <&-, so the closed descriptor reaches the guard on every platform. The other--files0-from -cases still go through the shebang._autolint_read_files0is unchanged: its/dev/stdinprobe is correct whenever fd 0 actually arrives closed. Probe closed stdin with an fd duplication in_autolint_read_files0#128's fd-duplication probe could not help, because by then fd 0 is genuinely open on/dev/null; Probe closed stdin with an fd duplication in_autolint_read_files0#128's later attribution to bash came from a probe that itself ran through/usr/bin/env bash -c.autolint --files0-from - <&-launched throughPATHstill exits 0, since the closed descriptor never reaches the process; nothing in-process can tell that apart from</dev/null.Testing
env: fd 0 arrives aslrwx ... -> /dev/nullandautolint --files0-from - <&-exits 0 with no output (the CI signature); GNUenvand directbashkeep fd 0 closed and exit 2 with the actionable message._autolint_read_files0#128's CI diagnostic showed fd 0 inside autolint aslrwx/dev/null, matching Rust's O_RDWR reopen rather than a shell redirect.test/suites/autolint-test: 517 passed, 0 failed.test/checkrun-test: everything passes except theschema-refreshrefs cases, which fail locally only because this host lacks the Pythonreferencinglibrary; that suite is untouched and runs in CI.checkrun format,checkrun lint, andshellcheck-inventory/run.shat the locked cgraf78/actions SHA pass.Review
Fresh-eyes review by two independent reviewers, both approving:
"$BASH" "$AUTOLINT"still exercises the real guard, including when the suite itself is launched through a Rustenv. This PR's Ubuntu/WSL legs are the on-runner proof that bash 5.3 does not reopen fd 0.$BASHis always the suite's own absolute bash; BSD, GNU, and busyboxenvleave closed descriptors alone; the WSL leg is simulated on the Ubuntu runner (same uutilsenv); Termux does not run this suite; no docs promise closed-stdin behavior. Addressed: commit header style and comment wording that now attributes the reopen to Rust's std runtime.