Repository navigation
Fix scan tty test under an ambient LC_ALL (#2216) - #2217
Conversation
The test names its locale with LANG alone, so a runner's own LC_ALL outranks it. Fix follows. Assisted-by: Claude Code:claude-fable-5-2
The test named its PTY child's locale with LANG alone. The CLI reads the first set of LC_ALL, LC_CTYPE and LANG, and the child inherits the runner's environment, so a runner that exports a UTF-8 LC_ALL (the macOS ones do) outranked the test's LANG=C and the row was drawn with glyphs. Remove the two outranking variables from the child, so LANG decides. Before, LC_ALL=en_US.UTF-8 cargo test ... --test scan scan_on_a_terminal_shows_what_was_measured failed on Linux as it does on the macOS nightly; now it passes under any ambient locale. Fixes #2216 Assisted-by: Claude Code:claude-fable-5-2
|
bugbot run Generated by Claude Code |
PR SummaryLow Risk Overview Previously the child inherited a runner-wide Reviewed by Cursor Bugbot for commit c9b3064. Configure here. |
|
[agent] PR shepherd: review brief for the approver What it does: Fixes the nightly macOS failure in #2216. The PTY test Risk: low. One test in one file; no production code, no other test touched. Look here:
Verified:
Changes I made: none. Open questions: none. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed the PTY child setup against the CLI's locale lookup order. Clearing LC_ALL and LC_CTYPE makes the test's explicit LANG control both cases. The ci-ok checks passed on this commit.
LLM Description written by Claude Code:claude-fable-5-2
Fixes #2216
Summary
A test-only change, seven lines in
crates/socket-patch-cli/tests/scan/scan_tty.rs.scan_on_a_terminal_shows_what_was_measurednow removesLC_ALLandLC_CTYPEfrom its PTY child before it setsLANG, so the locale undertest is the one the CLI reads. The CLI is unchanged.
Root cause
The test names the locale of its PTY child with
LANGalone. The CLI(
glyphs_enabledinsrc/ui/mod.rs) reads the first set ofLC_ALL,LC_CTYPE,LANG, as POSIX orders them, and the PTY child inheritsthe runner's environment. A runner that exports a UTF-8
LC_ALL, as themacOS one evidently does, outranks the test's
LANG=C, so the row isdrawn with glyphs and the ASCII assertion fails. The CLI is right; the
test's environment was incomplete. Linux legs passed only because their
runner sets no outranking variable.
Evidence
Reproduced on Linux by giving the test run the ambient variable:
mainLC_ALL=en_US.UTF-8LC_CTYPE=en_US.UTF-8LC_ALL=C LANG=en_US.UTF-8Command:
<env> cargo test -p socket-patch-cli --test scan scan_on_a_terminal_shows_what_was_measured.scan_ttytests pass underLC_ALL=en_US.UTF-8.cargo clippy --locked --workspace --all-features -- -D warnings(CI'scommand) is clean, and
rustfmt --checkon the file is clean./code-review highon the diff: no findings. It also ran the other PTYtests (the
cli,rollback,remove,updateandscanbinaries)under
LC_ALL=CandLC_ALL=en_US.UTF-8; all pass, so no other testneeds the same pin today.
The macOS leg itself doesn't run on a PR push; it runs in the merge queue
and the nightly, which is where this is confirmed for real.
ci-okandclippyare green, with no failed check.Notes
shared
pty_commandhelper: clearing the locale for every PTY childwould also change what package managers spawned under a PTY see.
cargo clippy -p socket-patch-cli --all-targets --all-features -- -D warningsfails onmainwith 29 errors in testtargets (mostly
duplicate_mod). CI doesn't lint test targets, andnone of the errors is in the file changed here.
https://claude.ai/code/session_011f9aeP4nq5sLGtm5TnGDd9
Generated by Claude Code