test(builder): the channel tests' stand-in game runs under bash, which takes descriptors of 10 and up #2519
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2519
Loading…
Reference in a new issue
No description provided.
Delete branch "madebyjordan/Longshot:fix/channel-test-shell"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
CI's
Rust (rustfmt, clippy, cargo test)job fails now and then on any pull request, with nothing in it to blame. On #2518 (one Markdown page) it failed in run 53626:and it passed on the same base,
be663a08a, half an hour earlier on #1999 (run 53613).Two channel tests from #2286 start a stand-in game with
sh -c '… <&$r … >&$w':build-driver'sa_game_process_says_hello_over_the_ends_it_inheritsandbuild-core'sa_child_talks_to_the_server_over_its_ends_and_the_builders_close_when_it_ends. The channel's pipe ends get whatever descriptor numbers are free in the test process, which runs its tests in parallel, so sometimes 10 or more. Dash, theshof Debian and Ubuntu (CI's runner), redirects only one-digit descriptors and stops with "Bad fd number". Both tests now startbash, which takes any descriptor. The builder is unchanged: the game reads the numbers fromLONGSHOT_BUILDER_CHANNEL, not through a shell.Read
builder/crates/build-driver/src/channel/tests.rsandbuilder/crates/build-core/src/channel.rs(tests).Testing
Tested: Windows 11:
cargo fmt --check -p build-core -p build-driver(Rust 1.99.1) passes. The two tests are#[cfg(unix)], so they don't run on Windows. On Ubuntu, CI's Rust job atb17f210d9(run 53635): both pass (a_child_talks_to_the_server_over_its_ends_and_the_builders_close_when_it_ends ... ok,a_game_process_says_hello_over_the_ends_it_inherits ... ok), everytest result: ok, no "Bad fd number". The Website checks fail onmaintoo (fixed by #2518).Still to test: none.
Measurements
Nothing to measure: two tests' shell, no builder or game code.
Risks
None for players: test code only. The tests now need
bashon the PC that runs them (CI's Ubuntu runner and Linux desktops have it). A revert is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
WIP: test(builder): the channel tests' stand-in game runs under bash, which takes descriptors of 10 and upto test(builder): the channel tests' stand-in game runs under bash, which takes descriptors of 10 and upCI's Rust job on
b17f210d9ran both channel tests on Ubuntu: both pass, no "Bad fd number". In Tested now. @review@review
Recommendation: Request changes. The change addresses dash’s descriptor limit, but the tests do not reliably exercise the failure it fixes. The new bash processes also inherit startup configuration that can make the tests fail or run unrelated commands.
Both channel tests use bash for their stand-in game, allowing multi-digit pipe descriptors. This changes test code only and adds a bash dependency.
Blocking (1): must change before merging.
CI / Website build and checks (pull_request)fails on this head and passes on the base branch: Failing after 24s.Should fix (3): not blocking, but worth doing before merging.
builder/crates/build-core/src/channel.rs:148: Neither changed test ensures that the channel ends have multi-digit descriptors, so the fix has no reliable regression check for the reported failure. (more on the line) Do: Arrange for both tests to use game pipe ends numbered at least 10 and assert that condition before starting the child, so they fail with dash and pass with the fix.builder/crates/build-core/src/channel.rs:148: The new non-interactive bash processes inherit BASH_ENV, allowing a developer’s shell startup file to alter the tests or execute unrelated commands. (more on the line) Do: Remove BASH_ENV from both child commands and clear other inherited bash option variables that can change their behavior.builder/crates/build-driver/src/channel/tests.rs:307: The tests now require bash even on Unix systems where the existing sh is available but bash is not installed. (more on the line) Do: Use a stand-in executable that handles inherited descriptors without requiring bash, or declare and install bash as a test prerequisite on every supported test environment.@fixcan do L1, L2, L3 and L4.More: does it help, other systems, switches, what was read
Does it help: Unproven for the reported case: the Ubuntu CI run passed both tests, but it did not record their descriptor numbers. The tests do not force descriptors of 10 or higher, so the same run could pass with the original shell.
Other systems: The changed tests run on Unix, not Windows; builder and game code are unchanged. Linux test environments now need bash, and inherited bash startup settings can affect both tests.
Switches: No project switches added, changed or removed. The new bash processes inherit BASH_ENV and other shell settings unless cleared.
Reviewed:
b17f210d96againstbe663a08a3: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit, both changed files and the channel server implementation. Reviewed the diff again; docs/review-checklist.md and the neighboring Tooling checkout were absent. The supplied CI results and review comments were read; run logs were not available.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as required for this review. The supplied Ubuntu CI report says both changed tests passed; Windows ran formatting only.
Overlaps and merge order: None found in the supplied pull request information; the network was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by madebyjordan. Nothing was run; a maintainer decides.
@ -147,1 +146,3 @@let mut game = Command::new("sh");// (the game: reads a line from its read end, answers on its write end; the descriptors from the variable.// bash, not sh: they can be 10 and up, and dash, Debian's sh, redirects only one-digit descriptors)let mut game = Command::new("bash");L1 (should fix): Neither changed test ensures that the channel ends have multi-digit descriptors, so the fix has no reliable regression check for the reported failure.
When: When the low descriptor numbers are free, open() can assign both game ends numbers below 10. Replacing bash with dash then still passes, leaving the intermittent CI failure undetected.
Do: Arrange for both tests to use game pipe ends numbered at least 10 and assert that condition before starting the child, so they fail with dash and pass with the fix.
L2 (should fix): The new non-interactive bash processes inherit BASH_ENV, allowing a developer’s shell startup file to alter the tests or execute unrelated commands.
When: If BASH_ENV names a file containing
exit 1, bash exits before exchanging channel messages and both tests fail even though the channel works; the previous dash invocation did not read BASH_ENV.Do: Remove BASH_ENV from both child commands and clear other inherited bash option variables that can change their behavior.
@ -306,0 +304,4 @@// (the game: hello out of its write end, the answer into a file, then a request that is not allowed. bash, not// sh: the pipe ends get whatever numbers are free, 10 and up too, and dash, Debian's sh, redirects only one-digit// descriptors)let mut game = Command::new("bash");L3 (should fix): The tests now require bash even on Unix systems where the existing sh is available but bash is not installed.
When: On a minimal Linux development or CI environment with dash as sh and no bash in PATH, both tests fail at spawn instead of testing the channel.
Do: Use a stand-in executable that handles inherited descriptors without requiring bash, or declare and install bash as a test prerequisite on every supported test environment.
Superseded by #2536, which makes the same change (sh to bash in both channel tests, for dash's one-digit fd limit). On BeanBot's L1-L3: they now apply to main's version of these tests, not to this PR. Closing as a duplicate.
Pull request closed