Repository navigation
test(executor): correct pwd expectation formula and clear -D warnings dead code - #3369
Merged
Merged
Conversation
… dead code The three wrong BASH_ARGC/ARGV pins and the mapfile -u hang from the issue were already green at HEAD f5f65d3 (verified: 7 pins green on the unpatched tree), so no product change was needed for them. This change fixes what the captain appended and what the same measurement found: the part_023 pwd expectation lowercased the whole path (real spelling kept, only the drive-letter segment is normalised), and 16 dead-code items across test files tripped RUSTFLAGS="-D warnings" cargo check --all-targets. Refs unixwin#2631 New pin tests/issue2631_hygiene.rs (1 test: pwd keeps uppercase path spelling). RUSTFLAGS="-D warnings" cargo check --all-targets now exit 0 (was exit 101). cargo fmt clean. src/ untouched.
Member
|
Thanks for the PR. This is queued for captain review — collaborator PRs are reviewed by the captain before merge, and #2631 stays open until that review lands. CI at intake: all checks green. No action needed unless the review asks for changes. |
caomengxuan666
marked this pull request as ready for review
November 11, 2026 18:00
This was referenced Nov 11, 2026
caomengxuan666
pushed a commit
that referenced
this pull request
Nov 12, 2026
fix(pipeline): keep merged-stream order in pipeline stages Fixes #3324 ## What changed - Pipeline stages whose inline Trap/Printf arms produce both streams now record their writes in an `OrderedOutputLog` (#2699) and stash the ordered chunks in the new `Executor::pipeline_stage_ordered_chunks` field (cleared at `execute_pipeline_stage_inner` entry). In `route_pipeline_stage_streams`, when the stage's fd 1 and fd 2 resolve to the same sink (`2>&1`, `1>&2` incl. the `ProcessStderr`≡`Stderr` variant, `>f 2>&1`), the driver rebuilds the merged stream from the log in production order and routes it once through the shared sink; when the targets differ the split pair routes exactly as before, and the `2>&1 >f` order-dependence is preserved. - A subshell stage's chunk routing no longer degrades to pair-block writes (whole stdout, then whole stderr) when `apply_ordered_output_redirects` legitimately finds nothing to do on the stripped clone: it falls through to the chunk walk whenever `redirect_failed` and `first_open_error` are both empty, so a stage whose fd table already carries a merged binding (#2689) keeps its order. - printf's rendering model is production-ordered: `RenderedPrintf` is now a sequence of `PrintfSegment::{Text, Error}` instead of a `(output, errors)` pair — GNU line-buffers stdout (`shell.c:1921-1922` `sh_setlinebuf`), so a conversion diagnostic lands between the values around it, not ahead of all output. `%n` counts sum over Text segments only; `-v` still receives the joined Text while diagnostics go to stderr. The direct printf path routes the ordered log through `write_buffered_builtin_output_chunks`. ## What was deleted - `write_buffered_builtin_output_stderr_first` and the `stderr_first` parameters of `route_builtin_buffered_output_ordered` / `write_buffered_builtin_output_ordered` (dead once the interleave model replaced the #1134 stderr-first model), plus four comments stating the old fully-buffered model. - No files, features, or tests were removed. ## Verification (captain review, all legs on the Simular box) - Regression pin `tests/issue3324_pipeline_stage_merged_order.rs`: **18/18** on the PR head; on the true fork base (`f5f65d35`, top-up form) **7 passed / 11 failed**, the failures exactly the merged-order shapes. - Three-way probes (32 shapes, GNU bash 5.3.20 oracle): the head matches GNU byte-for-byte on every in-scope shape — merged pipeline order both directions, printf mixed conversions, subshell/direct controls, file merge, `|&`. The two pre-existing red stems the PR body names are unchanged on the head: `issue1100_printf_option_parsing` 4 passed / 5 failed and `issue3046_exec_pipeline_chardev_stdin` 10 passed / 5 failed, with failure name sets identical on the base tree (verified bilaterally). `issue1134_printf_diag_order_regressions` 1/1 and `issue2699_builtin_output_interleaving` 7/7 stay green. - lib 1245 passed / 0 failed / 4 ignored on both trees, failure name sets identical (empty). - `cargo fmt --check`, marker-literal, and UTF-8 boundary hygiene legs clean; scoped `RUSTFLAGS="-D warnings"` check (lib + bins + pin) rc=0. The full-target `-D warnings` enumeration's error set is 16 pre-existing test-file lint points, each in a file byte-identical between the fork base and this head (the class master has been clearing since the fork, e.g. #3369/#3418); no point is in `src/` or in this PR's files. Refs #3408 — `declare -p`'s mixed diagnostic/listing order on a merged stream is produced inside the declare builtin's own pending-diagnostic funnel, not the stage merge layer; captain-review probes confirm it is unchanged (still reversed) on this head, exactly as that issue records. Refs #3409 — a builtin pipeline stage still fires the inherited EXIT trap at stage exit (missing subshell trap reset in the stage executor); captain-review probes confirm it is unchanged on this head and untouched by this PR, exactly as that issue records.
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 #2631
What was fixed
The three wrong BASH_ARGC/ARGV pins and the mapfile
-uhang listed in the issue were already green at HEAD (f5f65d3): thepart_008call-stack pins carry the correct GNU values (with#2631comments),part_009has theextdebugpremise plus a split two-state sibling pin, and thepart_012mapfile pin already uses fd 93. No product change was forced for those — per #3341 discipline, no change without a fail-first red.What this PR does fix is the hygiene the captain appended in the comments, plus what the same measurement found:
part_023.rs:38: thepwdexpectation lowercased the whole path (.to_ascii_lowercase()). On a real uppercase path the product prints the true spelling (/tmp/Fix-B5/probe) while the old formula expected/tmp/fix-b5/probe— a false red. Only the drive-letter segment is normalised now (replacen("D:/", "/d/", 1)).RUSTFLAGS="-D warnings" cargo check --all-targetswas red on dead code intests/only: the 4 items the captain named plus 12 more found by the same measurement (unused imports/fields/functions, redundantmut, an unused parameter renamed to_script, one dead method deleted). 16 items, 16 files, all test code.What was deleted
Test-only deletions, no product code and no tests removed: one dead
connections()method, dead struct fields, unused imports/functions. No test cases were deleted.Verification (all run, per-item counts)
tests/issue2631_hygiene.rs: 1/1 pass (pwdkeeps uppercase path spelling). Note: the productpwdwas already correct, so this pin is green on both trees — it guards the behaviour the formula must match. The fail-first evidence for the formula itself is the probe: old formula expected/tmp/fix-b5/probe, product printed/tmp/Fix-B5/probe.bash_call_stack3/3,bash_argc2/2,mapfile_u_reports_bad_fd1/1,builtin_cd_invokes1/1.RUSTFLAGS="-D warnings" cargo check --all-targets: exit 0 (was exit 101 before this change; supervisor re-ran it).cargo fmt --checkclean on all touched files.src/untouched,src/lexer/continuation.rsuntouched.Owed
tests/issue2634_extdebug_bash_argc_sticky.rs: 7 passed / 6 failed — the failures are the extdebug on→off sticky-BASH_ARGCproduct bug (rubash printsBASH_ARGC=(), GNU expects([0]="0")), reproduced identically on the unpatched tree. That is [bug] extdebug 开→关后 BASH_ARGC 为空数组,GNU 为 ([0]="0") #2634's own work, not this issue; only the file's provably-deadrunfunction was removed here.variables.c:5643-5690,execute_cmd.c:5337-5348) and the issue's recorded 5.3.20 measurements.