Skip to content

test(executor): correct pwd expectation formula and clear -D warnings dead code - #3369

Merged
caomengxuan666 merged 2 commits into
unixwin:masterfrom
Uarz:fix/issue-2631
Nov 11, 2026
Merged

caomengxuan666 merged 2 commits into
unixwin:masterfrom
Uarz:fix/issue-2631

Conversation

@Uarz

@Uarz Uarz commented Nov 11, 2026

Copy link
Copy Markdown
Member

Fixes #2631

What was fixed

The three wrong BASH_ARGC/ARGV pins and the mapfile -u hang listed in the issue were already green at HEAD (f5f65d3): the part_008 call-stack pins carry the correct GNU values (with #2631 comments), part_009 has the extdebug premise plus a split two-state sibling pin, and the part_012 mapfile 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:

  1. part_023.rs:38: the pwd expectation 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)).
  2. RUSTFLAGS="-D warnings" cargo check --all-targets was red on dead code in tests/ only: the 4 items the captain named plus 12 more found by the same measurement (unused imports/fields/functions, redundant mut, 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)

  • New pin tests/issue2631_hygiene.rs: 1/1 pass (pwd keeps uppercase path spelling). Note: the product pwd was 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.
  • The 7 already-fixed pins, re-run by the supervisor: bash_call_stack 3/3, bash_argc 2/2, mapfile_u_reports_bad_fd 1/1, builtin_cd_invokes 1/1.
  • All 16 touched test files re-run: 115 passed / 0 failed in total (per-file: issue2577 2, issue2514 6, issue2694 5, issue2584 2, issue3104 24, issue661 6, issue660 7, issue2078 5, issue2124 8, issue2385 19, issue2500 5, issue2698 5, issue2702 7, issue2722 3, issue2933 3, plus the 7 old pins and the new pin).
  • RUSTFLAGS="-D warnings" cargo check --all-targets: exit 0 (was exit 101 before this change; supervisor re-ran it). cargo fmt --check clean on all touched files. src/ untouched, src/lexer/continuation.rs untouched.

Owed

  1. tests/issue2634_extdebug_bash_argc_sticky.rs: 7 passed / 6 failed — the failures are the extdebug on→off sticky-BASH_ARGC product bug (rubash prints BASH_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-dead run function was removed here.
  2. Full suite (1596 tests) not run — weak-CPU discipline, focused legs only.
  3. No live GNU 5.3 oracle run on this VM; GNU expectations rest on the C source (variables.c:5643-5690, execute_cmd.c:5337-5348) and the issue's recorded 5.3.20 measurements.

… 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.
@caomengxuan666 caomengxuan666 added the bug Something isn't working label Nov 11, 2026
@caomengxuan666 caomengxuan666 self-assigned this Nov 11, 2026
@caomengxuan666 caomengxuan666 added the P2-medium 中:次要缺陷或边缘路径,排期修复 label Nov 11, 2026
@caomengxuan666

Copy link
Copy Markdown
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
caomengxuan666 marked this pull request as ready for review November 11, 2026 18:00
@caomengxuan666
caomengxuan666 merged commit 9994ad9 into unixwin:master Nov 11, 2026
11 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P2-medium 中:次要缺陷或边缘路径,排期修复

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[freeze-1.5.0] executor_tests hygiene: three wrong pins (BASH_ARGC/ARGV vs GNU 5.3.20) + parallel-fd full-run hang at mapfile -u3 pin

2 participants