Repository navigation
fix(parser): close shared option-parser cluster #1301 #1302 #1304 #1306 — GNU-oracle verification - #1417
Merged
Conversation
…rand (#1304) glibc counts mere presence of POSIXLY_CORRECT (an empty value counts), and the parser policy layer already checks presence. Pin the empty-value rule with a regression test next to the POSIXLY_CORRECT=1 ones, closing the last coverage gap of the parser defect cluster verification.
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.
Provenance: verification of the prematurely merged WIP #1391
The code for #1301 / #1302 / #1304 / #1306 landed on
mainthrough WIP #1391,which was merged on 2026-10-27 while its own banner still read "not yet verified —
do not merge". The four issues therefore stayed open. This PR carries the deferred
verification of that cluster against a real GNU oracle, plus the one coverage gap
the verification exposed. The
Fixeslines below close the cluster.Diff vs
main: one new regression test. The behavioral fixes themselves werealready merged by #1391 and are verified here, on a fresh full MSVC build of
main+ this commit.GNU oracle verification (WSL: coreutils 9.4, diffutils 3.10, grep 3.11)
#1301 — Bool long options reject
=valuecat --show-ends=foo foption '--show-ends' doesn't allow an argument+Try 'cat --help', rc1ls --all=x .option '--all' doesn't allow an argument+ Try, rc2cat --help=foooption '--help' doesn't allow an argument+ Try, rc1grep --count=x fUsage: grep ...+ Try, rc2, no hang#1302 — Int long option with empty
=valueno longer swallows the next argvgrep --max-count= -e x fnow fails on the empty value (exit 2) and neverconsumes
-eas the value — the issue's defect is gone.Regression test:
grep.grep_int_long_option_empty_value_does_not_swallow_next_arg.grep.cand printsgrep: invalid max count; WinuxCmd's shared parser printsgrep: invalid argument '' for '--max-count'+ Usage/Try, also exit 2. Matching GNUverbatim would require the shared parser to pass unparseable ints through to every
command's own validator — a cross-command API change out of scope here. Exit code and
the failing operand match GNU.
#1304 —
POSIXLY_CORRECTstops option permutation at the first operandPOSIXLY_CORRECT=1 ls . --color=never→ls: cannot access '--color=never'+.listing, rc2;unset → rc0. Matches the oracle exactly.
POSIXLY_CORRECT=(empty value)also stops. Implementation checks presence (
getenv(...) != nullptr) inoption_policy_for_command, mirrored in the dispatcher pre-pass; non-getopt grammars(
find,test/[,expr,true/false,dd) keep permuting, and per-commandstop rules (e.g. xargs) are unaffected.
ls.ls_posixly_correct_empty_value_still_stops_at_first_operandpins the empty-value rule — previously only
POSIXLY_CORRECT=1was covered.#1306 — bundled short flags no longer eaten by shared optional-argument metas
uniq -Dc→uniq: printing all duplicated lines and repeat counts is meaningless+ Try, rc1 — matches oracle.split -dl 5 f→ numeric suffixes,-ltakes5from the next argv (5-line chunks) — matches oracle.diff -cu a b→ issue-text correction: GNU diffutils 3.10 (oracle) printsdiff: conflicting output style options+diff: Try 'diff --help', rc2 — it doesnot emit a unified diff as the issue body claimed. The merged implementation matches
the oracle;
diff.diff_cluster_conflicting_styles_are_an_errorpins it.Test results
winuxcmd-tests.exewith the standing baseline exclusions(
xargs.xargs_interactive_*,xargs.xargs_max_chars_splits_batches,xargs.xargs_delimiter_does_not_force_exit_if_exceeded,xargs.xargs_verbose_quotes_special_args_1322,*.issue_1288_*,find.issue_1309_*): 3341 passed, 0 failed. No new failures; the parserchanges touch every command, so the full run is the load-bearing check.
python scripts/i18n_batch.py extractoutput byte-identicalbefore/after this branch's change (no new or removed keys; no user-visible
strings touched — the diff is a test-only change).
Fixes #1301
Fixes #1302
Fixes #1304
Fixes #1306