Repository navigation
fix(compat): stale OPTIND and repeated array-subscript diagnostics (#614) - #623
Merged
Merged
Conversation
GNU owners: builtins/getopt.c:114-123 sh_getopt EOF normalization; arrayfunc.c:1483 array_value_internal and 1577-1583 negative indices. Verified against WSL GNU Bash 5.3.0 script files: 11 comparisons; five new regressions and existing getopts/side-effect slices pass. Related to #614; host history counterpart follows in niubash.
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.
rubash#614 Verification Report
Date: 2026-10-15. Worktree:
D:/repo/rubash-wt-614, branchfix/issue-614, baseline334afab2. No rebase or commit performed.Changes
src/executor/getopts_enable.rs: staleOPTINDnow normalizes to$# + 1at EOF, matching GNUsh_getopt(third_party/bash/builtins/getopt.c:114-123 sh_getopt).src/executor/command_prepare.rs: one whole parameter word owns one array-subscript memo scope; pending arithmetic subscript writes flush before alternate set/null checks. This removes repeated negative-array diagnostics while preserving distinct${a[i++]}occurrences. GNU owner:third_party/bash/arrayfunc.c:1483 array_value_internal, negative-index handling1577-1583.tests/issue614_regressions.rs: five focused Rubash regressions.crates/niubash-runtime/src/shell.rs: history provider is created only at interactive entry; noninteractivehistoryremains session-local and does not preload the host file.crates/niubash-runtime/src/history.rsandtests/host_contract.rs: explicit noninteractivehistory -r/-wremains supported and automatic file loading is interactive-only. GNU owners:third_party/bash/shell.c:798-812 main,shell.c:1845-1855 init_noninteractive,bashhist.c:320-347 load_history.Verification
5.3.0(1)-release, invoked from LF script files throughwsl.exe -d Ubuntu-GitLab --exec bash -s.target/issue-suites/results/issue-614/script-comparison.json: 11/11 bounded script comparisons match stdout, stderr after script-path normalization, and exit status; includes three upstreamgetopts*.subslices.cargo test --test issue614_regressions -- --nocapture: 5/5 passed.cargo fmt --check -p niubash -p niubash-runtimeandgit diff --check: passed.Remaining
No known #614 semantic remainder. Full workspace suites and the unbounded GNU 83-suite gate were intentionally not run. Existing #609 and merged #620 allocation partial
b404904dare unchanged. The captain should review and commit; this agent did not commit.Temporary malformed host files from the earlier WSL argv-path attempt are outside this worktree and were not modified.
Commands, evidence, and ownership
Oracle/product artifacts live at
D:/repo/niubash/target/issue-suites/results/issue-614/, not the Rubash worktree target:oracle.log,script-comparison.json,verify.log,getopts.before.out,array.before.err, and the.gnu/.rubash/.niuoutput files. Driver:oracle-driver.sh; product harness:verify.py. GNU cases use a 10-second timeout plus 2-second kill grace; product probes use 15 seconds. The array probe changed from 12 diagnostics to 4, matching GNU's four out-of-bounds occurrences. No blanket per-command suppression is used.Rubash authoritative commands, run in the worktree:
Logs in this worktree's
target/issue-suites/results/issue-614/:regressions.log,executor-getopts.log,cli-subscript.log. The first existing-executor run failed because its hardcoded relative target directory was absent; creating the artifact directory and rerunning passed 6/6.Niubash commands use a target-local Cargo override pointing at this worktree; no tracked manifest or lockfile changed:
History provider regressions: 15/15 passed. Existing foreign-PS1 and framework-PS1 interactive-entry tests each pass; the framework test intentionally emits a missing __git_ps1 diagnostic. No interactive PTY persistence gate was run.
The semantic map records two narrow contracts. Its validator fails on the pre-existing unchanged src/input/readline/ entry because that directory is absent. This unrelated row was not changed. Format and diff checks pass. Process inspection found no rubash.exe; two shared bash.exe processes were left untouched rather than killing other agents' shells.
All three tracked Niubash diffs belong to #614: shell.rs, history.rs, tests/host_contract.rs. They change history initialization/contracts, not #355 performance. Coordinate constructor/interactive-entry hunks with #355 at captain review. No #355 worktree, #609 changes, or #620 changes were edited.