Skip to content

audit(713): nested-context inheritance probes (24 cases, 0 divergences) - #770

Merged
caomengxuan666 merged 1 commit into
masterfrom
audit/713-nested-context-probes
Oct 17, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
audit/713-nested-context-probes

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Closes the measurement half of rubash#713 (third axis: what a nested context inherits and owns).

scripts/audit/nested-context-probes.py runs 24 probes over ( ) / $( ) / pipeline stage / background job × { fd table, traps (visibility, EXIT, ERR plain vs set -E, RETURN, ignored signals), exit codes (subshell, command substitution, pipefail, wait), diagnostic routing (redirected, closed, inside $( ), through a pipe), variable isolation }. Each case runs from its own file with stdout, stderr and exit status compared separately against GNU bash 5.3 (WSL).

Result: 0 divergences. Two harness traps were found and avoided while building it, both worth recording:

  1. wsl bash -lc "bash -c '…'" re-joins the argument list, strips the single quotes and lets the outer shell interpret ; — it fabricates $?/$x divergences (I hit 9 of them, all artifacts; my first run re-reported them as findings before the harness was fixed).
  2. Mixing both legs into one stream loses the label lines to trap output on stderr; per-case files plus separate capture is the only reliable shape.
  3. WSL eats backslashes on its command line, so a Windows path handed to wslpath -a arrives as D:repodirfile (no separators) and comes back unchanged; normalize to forward slashes first. All three traps made the very first runs report 24/24 "divergences" that were pure harness noise.

The ownership doc's row F is updated with this measurement. The interesting consequence: for the standard shapes this axis is already owned — the documented recurrence in this family (#719 fixing #702, then #720 filing four residuals hours later) lives in the attribution layer (which Err-returning command owns the last condition's status, and the trap reset call sites), which is exactly what P1 of the ownership plan targets.

Not covered here (deliberately, they need their own triggers): nested subshells as the first body command, process substitution, runtime exec rebinding, and diagnostic ownership under redirection — the first three are #720's residuals, the last is P2.

@caomengxuan666
caomengxuan666 force-pushed the audit/713-nested-context-probes branch from dbb0ecd to 5653d8b Compare October 17, 2026 07:52
@caomengxuan666
caomengxuan666 merged commit 05d6574 into master Oct 17, 2026
6 checks passed
@caomengxuan666
caomengxuan666 deleted the audit/713-nested-context-probes branch October 18, 2026 09:28
SpookyWaste pushed a commit to SpookyWaste/rubash that referenced this pull request Nov 12, 2026
The live host<->engine layering section credited reedline as the
host's editor. niubash switched to ruline (niu PR unixwin#770, pinned on niu
master); the credit now reads "ruline (GNU readline compatibility
layer)".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant