Repository navigation
audit(a5): fix 57 GNU divergences across core applets [UNVERIFIED] - #1506
Merged
Merged
Conversation
…tr/cat/ls Deep-audit lane A5 (source-level differential vs coreutils 9.4 / grep 3.11 oracle sources). Highlights: - grep: -q exit precedence, empty-pattern invert model, -C default-fill, -m 0 early exit, -d/-r/-R last-wins, --fixed-regexp alias, recursion error/junction handling, omit-dot-slash, process-wide group separator, -u warning, --color synonyms, --label presence, GNU diagnostic texts - sort: all-or-nothing global-option inheritance, incompatible-mode error, begfield/limfield ports, exact strnumcmp for -n, month arm always decides, obsolete +POS keys, repeated -o rule, blank = space/tab - uniq: obsolete -NUM is skip-fields, +NUM operand is skip-chars, field_sep predicate, argmatch prefixes, per-option negative messages - head/tail: xstrtol suffix grammar (1kB, 1mD), head OFF_T_MAX elide guard, head directory header order, tail -f assigns descriptor mode, tail -F '-' fatal, --pid PID_T_MAX bound, dispatcher obsolete suffix grammar + head invalid-trailing-option wording - wc: undecodable bytes skipped (mbrtowc -1 path), fstat(0) width rule - cut: errno-shaped open errors; tr: NUL indefinite fill, empty [= =] - cat: -E pending CR carried across operands - ls: default date-style year split, strict recent window, raw -X extensions, faithful filevercmp for -v, --time=mtime no implicit sort, human-size promotion, no minimum size width, printable non-ASCII in escape quoting, positional -f semantics, --color/--indicator-style argmatch validation (exit 2) UNVERIFIED-BY-CAPTAIN: built only by this PR's Windows CI. Full report: deep-audit lane A5 REPORT.md (64 findings, 7 report-only).
New keys: command.{grep,egrep,fgrep}.option.fixed-regexp,
core.error.invalid_trailing_option; legacy hash churn from corrected
diagnostic texts. zh-CN translations still owed in winuxcmd-i18n
(catalog sync + VERSION bump) before merge.
Captain verification of PR #1506: three sort unit tests failed on the only CI job that runs ctest (build-windows x64 default) because A5's S3+S5 changes interact: begfield now starts keys at the blank run preceding the field, so an extracted numeric key looks like " 10", and the new strnumcmp port — called directly — ties on the leading blank, degenerating the comparison to the last-resort whole-line order. GNU keeps the blank skipping in numcompare, not in strnumcmp: coreutils-9.4/src/sort.c:1996-2004 (numcompare) strips leading blanks (space/tab) from both operands before strnumcmp (lib/strnumcmp-in.h). Restore that wrapper as numcompare_sv and route the numeric arm through it, matching the oracle layering. Fixes sort_repeated_long_key_options_compare_in_order, sort_debug_reports_key_without_changing_stdout, and sort_key_end_character_zero_means_field_end.
Captain verification of PR #1506. Seven of the ten ctest failures on build-windows (x64, default) were in-tree tests encoding the pre-fix, non-GNU behavior that lane A5 deliberately corrected; the tests now assert the oracle behavior, each with its citation: - grep_only_matching_silently_ignores_context (was "..._warns_..."): grep 3.11 has no context warning for -o anywhere in grep-3.11/src/grep.c; stderr is empty (A5 G15). - grep_devices_rejects_invalid_action: grep-3.11/src/grep.c:2528-2536 dies with "unknown devices method", not the invented "invalid devices action" (A5 G21). - head_obsolete_count_after_options_reports_invalid_trailing_option: coreutils-9.4/src/head.c:1024,1066-1069 — head's default getopt arm says "invalid trailing option -- 5"; "option used in invalid context" is tail's wording (src/tail.c:2230) (A5 H4). - head/tail_accepts_lowercase_kB_suffix (were "..._rejects_..."): coreutils-9.4/lib/xstrtol.c:143-166 — 'k' is in the suffix list (src/head.c:911-915, src/tail.c:2163-2166) and a trailing 'B' selects base 1000; 1kB reads 1000 bytes (A5 H1/T5). - sort_ordering_mode_conflict_is_incompatible and sort_short_ordering_mode_conflict_is_incompatible (were "..._last_option_wins"): coreutils-9.4/src/sort.c:4466-4487 — global mode flags only accumulate on gkey, and check_ordering_compatibility (sort.c:4134-4150) rejects the pair with "options '-nV' are incompatible", exit 2 (A5 S2).
caomengxuan666
marked this pull request as ready for review
November 3, 2026 17:13
caomengxuan666
added a commit
that referenced
this pull request
Nov 3, 2026
Conflicts resolved by composition, keeping both sides' GNU semantics: - uniq.cpp: #1513's attached-only parse (bare resolved by caller, "" ambiguous) composed with #1506's argmatch prefix matching; the caller stays the string_occurrences/has_value form. - ls.cpp: both new functions kept (resolve_color_mode from #1513, print_block_size_enabled from #1506); resolve_color_enabled now composes them -- positional -f suppression scan (ls.c case 'f') over resolve_color_mode's bare/attached verdict. validate_color_option now keys the bare case on value_attached so an attached --color= is validated (and rejected) instead of being mistaken for a bare --color; argmatch_error_text treats "" as ambiguous, as GNU argmatch does. - scripts/i18n-drift-baseline.json: union of both branches' recorded drift sets (regeneration against the i18n repo is CI's step). UNVERIFIED-BY-CAPTAIN until CI judges this merge head.
This was referenced Nov 3, 2026
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.
UNVERIFIED-BY-CAPTAIN — deep-audit lane A5 fixes. WinuxCmd cannot build on the audit VM (MSVC-only); these are source-level edits derived from side-by-side reading against the pinned GNU oracle sources (coreutils 9.4 / grep 3.11). This PR's Windows CI is the first and only verifier. Do not merge on green alone without a differential-test pass over the touched applets.
Scope: 57 of 64 audit findings fixed across grep, sort, uniq, head, tail, wc, cut, tr, cat, ls, and the shared dispatcher obsolete-argument handling. The remaining 7 are report-only (shared-parser typing/plumbing and matcher/streaming reworks) and are documented in the lane report with blocking reasons.
Notable behaviour changes:
Before merge (per repo AGENTS.md): changed/added user-visible strings need the i18n catalog sync in unixwin/winuxcmd-i18n (extract + zh-CN + VERSION bump), including the new key core.error.invalid_trailing_option; clang-format (scripts/format.py) was not runnable on the audit VM, so formatting should be confirmed.