Repository navigation
audit(posix): complete the GNU posix-mode coverage audit - fatality family, redirect no-split, time stream, trap usage exit - #559
Merged
Conversation
…fatality family, redirect no-split, time stream, trap usage exit
Second pass over the 75-sub-item matrix in docs/posix-mode-audit.md, after
the first-pass fixes (19, 47, 52, 56, 58, 67, 68, 69):
- 35/36 assignment-error fatality: apply_permanent_assignments /
apply_temporary_assignments report failure to the dispatcher; a posix
non-interactive shell exits status 1 (no command word: GNU exits in every
mode and rubash subshells already did; before a command word GNU 5.3
exits for EVERY command class - special builtin, ordinary builtin,
external, function - and the command never runs; the default mode keeps
apply-and-continue).
- 37 readonly for/select loop variable exits at the bind in posix.
- 40 export/readonly assignment-class failures (invalid identifier AND
readonly conflict) arm special_builtin_failed via the dispatch gate;
export -f not-a-function and non-special declare stay non-fatal,
oracle-matched. unset was already fatal on master.
- 10 redirect targets: in posix the ambiguity gate treats split-produced
whitespace as filename data (f="two words"; echo hi > $f opens one file
like GNU) while brace word lists stay ambiguous; the no-glob gate already
covered the pathname side.
- 6 time: posix routes the TIMEFORMAT/POSIX_TIMEFORMAT report through the
executor's fd-2 endpoint ({ time ...; } 2>f captures it byte-identical to
GNU); default mode keeps the historical raw stream.
- 68 completed: the trap reset-by-name usage path returns GNU's RAW internal
EX_USAGE (258) so the execute_trap wrapper's >EX_SHERRBASE gate arms
special_builtin_failed and converts to 2 - the first pass returned the
already-converted 2 and the posix exit silently never fired (p30).
- docs/posix-mode-audit.md: matrix re-baselined to 42 implemented / 10
doc-drift / 5 deferred / 12 n-a / 6 static, oracle corrections recorded
(35 top-level, 36 all-command-classes, 40 unset already fatal), wsl.exe
file-capture artifact noted, unit tests added (alias listing prefixes,
kill sigspec validator, trap usage/display) and the stale alias_with_io
call in the pre-existing alias test fixed.
Oracle: GNU bash 5.3.0(1)-release via WSL (wsl.exe bash --posix -s);
48-probe three-way harness (master-posix vs branch-posix vs GNU-posix):
35 byte-identical after diagnostic-prefix normalization, all residual
differences documented deferrals, GNU drift, or capture artifacts.
This was referenced Oct 12, 2026
…d re-record errors.snap - the goldens gate caught a wrong oracle reading The CI goldens gate (upstream_suite_slice_snapshots: errors) on the first push of #559 exposed two things: 1. The second pass's item-36 reading ("GNU exits for every command class") was wrong - an artifact of stdout pipe buffering over GNU's jump-exits. Re-probed cell-by-cell with stderr-only per-process probes, GNU 5.3 posix on a failed readonly tempenv assignment: - special builtin command word: the shell exits (status 1) - `ro=2 :`; - ordinary builtin / external / function: the command is SKIPPED, the rest of the command list is abandoned with status 1, the script continues (the ksh93 emulation GNU's own errors7.sub comment describes: `x=8 echo` runs nothing, `after non-special builtin: 1`); - no command word: fatal (item 35, unchanged); - subshell forms exit the subshell with 1, the parent continues. The dispatch gate now branches on is_posix_special_builtin: ExecuteError::ExitCode(1) only for the special-builtin class, ExpansionFailure(1) (the skip-and-abandon contract) otherwise; the function-call fast path takes the skip-and-abandon arm too. 2. Both early-return paths skipped restore_temporary_assignments, leaking an unbalanced tempenv mark that corrupted every later restore - the full-file errors7 run behaved differently from the isolated probe with the same constructs. Both paths restore the partial binds first now. 3. `${v:=val}` against a readonly variable before the special builtin `:` (the parameter-expansion assignment arm in both parameter_assignment_error sites) is fatal in posix (GNU probe: subshell exits 1, nothing after runs); default keeps the status-2 discard rubash already had. tests/regression/snapshots/errors.snap is re-recorded via the module-header protocol (RUBASH_REGRESSION_RECORD=1). Every default-run byte is kept; the delta is exactly the `-o posix` child-run lines, which now match `bash -o posix` byte-for-byte on errors4.sub and errors7.sub - the previous recording had baked in the pre-audit engine's never-exits posix behavior, which the audit's GNU evidence shows was not GNU-aligned. No other snapshot is touched (comsub/heredoc/nquote, which fail locally even with pure origin/master src, are a master-side local-recording divergence reported on the PR for triage). Verification: rubash posix now matches GNU cell-for-cell on the 12-cell matrix, and errors4.sub/errors7.sub match GNU byte-for-byte in BOTH modes (default mode remains identical to the old-master engine); the 12-probe fix battery stays byte-identical to GNU; full cargo test --no-fail-fast failure set remains a strict subset of the fresh-master baseline.
Member
Author
|
Goldens-gate triage pushed as 4b0635c:
|
# Conflicts: # src/executor/command_prepare.rs
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.
What
Second pass over the 75-sub-item matrix in
docs/posix-mode-audit.md, after the first pass (items 19, 47, 52, 56, 58, 67, 68, 69). The matrix now reads 42 implemented / 10 doc-drift / 5 deferred / 12 n-a / 6 static (was 28 implemented / 17 not-implemented before the PR).Fixed this pass
ro=2on a readonly var (no command word) exits status 1 in posix at top level; subshells were already fatal in both modes:, externalls, function), not just special builtinsfor/selectloop variable exits at the bind (status 1)special_builtin_failed→ posix non-interactive exit;export -f nofnand non-specialdeclare 9x=1stay non-fatal, oracle-matched;unset -v 9badwas already fatal on masterf="two words"; echo hi > $fopens one file, rc=0 like GNU); brace word lists stay ambiguous; default mode keeps "ambiguous redirect"timereport goes through the executor's fd-2 endpoint in posix ({ time …; } 2>fcaptures it byte-identical to GNU); default keeps the historical raw streamexecute_trapwrapper's> EX_SHERRBASEgate actually armsspecial_builtin_failed— the first draft returned the already-converted 2 and the posix exit silently never fired (caught by probe p30)Oracle discipline
wsl.exe bash --posix -sstdin method.sh.exefor true posix): 35 byte-identical after diagnostic-prefix normalization; every residual difference is a documented deferral (26/75 job-table lifetime, 29 .sh_history, 42 command-declare, 7 time-lexer), GNU 5.3 drift (12/20/22/33/51/55/66/71), or a wsl.exe file-capture artifact (GNU stdout before a jump-exit; re-verified through the pipe — p15/p17/p18/p21).alias_with_iocall the first pass left in the pre-existing alias test (cfg(test) code is not compiled bycargo build).Verification
cargo fmt; fullcargo test --no-fail-faston the rebased branch: the failure set is a strict subset of a freshorigin/master(db3218a) run — zero branch-only failures (53 shared, master's extra 5 are load-flaky cd/pushd/prompt/wait_n timing tests from the parallel build).Related
NIU_INVOKED_AS), fix(sh): honor the sh invocation contract through the shim forward niubash#262 (host consumes it;sh -c 'set -o | grep -w posix'→ on,$0=sh, bash byte-identical) — this PR is the engine-side posix-mode depth that those invocation fixes switch on.