Skip to content

fix(du): threshold xstrtoimax semantics + summarize/all conflict (Refs #1462) - #1794

Merged
caomengxuan666 merged 2 commits into
mainfrom
fix/du-threshold-conflict
Nov 16, 2026
Merged

caomengxuan666 merged 2 commits into
mainfrom
fix/du-threshold-conflict

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Closes the two red baseline rows that have been failing main's differential gate (du/02-summarize-all-conflict, du/05-threshold-neg-zero — the reason recent fleet PRs inherited a red baseline check).

What

threshold parsing (du.c:899-913, gnulib xstrtol.c __xstrtol)

input before now (GNU 9.4 oracle)
--threshold=-0 accepted, rc 0 rejected, du: invalid --threshold argument '-0' rc 1 (du.c:906-912, literal '-0' however zero was spelled)
--threshold=1k / -1k / k / 1KiB rejected (bare i64 parse) scaled per xstrtoimax "kKmMGTPEZYRQ0"
--threshold=1kx rejected as invalid du: invalid suffix in --threshold argument '1kx' (xstrtol_error msgid)
huge value — du: --threshold argument '…' too large

summarize/all conflict (du.c:1004-1008)

du -a -s . now fails before any walk: du: cannot both summarize and show all entries + Try 'du --help' for more information., rc 1 (empty stdout), byte-matching the oracle.

threshold unit (du.c:718-726)

GNU compares the threshold against dui_to_print.size — the value already scaled for printing. The pre-fix gate compared raw bytes, so negative thresholds never printed a row at all (probed: -4 keeps the 4-block ./sub and elides the 8-block .; -1 elides both; -1024 keeps both). threshold_value feeds the scaled print value into all three gates.

Verification

  • WSL GNU 9.4 oracle probe: threshold class matrix (-0 rejected; 0 and negative non-zero accepted; suffix scaling).
  • cargo test winux-cmds 1016/1016 (new pins: neg-zero literal message, conflict wording byte-exact, xstrtol suffix family, print-unit boundary).

catalog/en-US.json: +3 keys (du error family); zh-CN companion rides the winuxcmd-i18n sync chain.

…#1462)

The baseline gate's two red rows (the reason every fleet PR has been
inheriting a red main since #1756-era merges):

1. du/05-threshold-neg-zero: the parser was a bare i64 parse — it
   accepted "--threshold=-0" (GNU rejects), rejected every SIZE suffix
   GNU accepts (du.c:899-903 xstrtoimax "kKmMGTPEZYRQ0"), and had no
   invalid-suffix / too-large message shapes. parse_threshold now
   mirrors gnulib xstrtol.c __xstrtol byte-for-byte: sign + digits,
   a lone suffix means 1, binary single suffixes k/K..Q, the '0' flag
   second suffix ("iB" binary, "B"/"D" decimal), the three
   xstrtol_error msgids ("invalid --threshold argument 'X'" /
   "invalid suffix in --threshold argument 'X'" / "--threshold
   argument 'X' too large", exit 1, no try-help), and du.c:906-912's
   negative-zero rejection with the LITERAL '-0' in the message
   however the zero was spelled.

2. du/02-summarize-all-conflict: "-a -s" ran silently. du.c:1004-1008
   rejects the pair before any walk with "cannot both summarize and
   show all entries" + usage(EXIT_FAILURE)'s try-help line, rc 1.

Also fixes the threshold UNIT (du.c:718-726): GNU compares against
dui_to_print.size — the value ALREADY scaled for printing — while the
pre-fix gate compared raw bytes, so a negative threshold never printed
a row at all (probed: -4 elides an 8-block "." but keeps the 4-block
"./sub"; -1024 shows both; -1 elides both). threshold_value feeds the
scaled print value into the comparison at all three gates.

GNU anchors: coreutils @5f6c02d3 src/du.c:899-913, :1004-1008, :718-726;
gnulib xstrtol.c __xstrtol + xstrtol-error.c xstrtol_error. Verified
against the WSL GNU 9.4 oracle probe class matrix (-0 rejected, 0 and
negative non-zero accepted, 1k/-1k/k/1KiB scaled).

cargo test winux-cmds 1016/1016. catalog/en-US.json: 3 new keys
(summarize_conflict, invalid_threshold_suffix, threshold_too_large);
zh-CN companion rides the winuxcmd-i18n sync chain.
caomengxuan666 added a commit that referenced this pull request Nov 16, 2026
…pin identity

The committed baseline still knew 645 cases (#1547 era); the corpus
grew 26 split/... cases since, so compare-baseline.py failed every
branch run with 'new case' errors once runner.sh's own unexpected-diff
check stopped tripping first (#1794's runner leg is Differences: 0).

Recorded from the #1794 CI differential artifact (PASS 630, KNOWN_DIFF
36, SKIP 5, Differences 0 — the du rows green under PR #1794's fix).
Bucket audit vs origin/main: 26 adds all green; 3 recorded SKIPs are
the WSL/dialect-shaped cases (basename/50, dirname/03, test/13) whose
declared shapes cannot run under the Ubuntu-24.04 oracle — compare-
baseline.py treats a recorded SKIP as the explained declared verdict.
…pin identity

The committed baseline still knew 645 cases (#1547 era); the corpus
grew 26 split/... cases since, so compare-baseline.py failed every
branch run with 'new case' errors once runner.sh's own unexpected-diff
check stopped tripping first (#1794's runner leg is Differences: 0).

Recorded from the #1794 CI differential artifact (PASS 630, KNOWN_DIFF
36, SKIP 5, Differences 0 — the du rows green under PR #1794's fix).
Bucket audit vs origin/main: 26 adds all green; 3 recorded SKIPs are
the WSL/dialect-shaped cases (basename/50, dirname/03, test/13) whose
declared shapes cannot run under the Ubuntu-24.04 oracle — compare-
baseline.py treats a recorded SKIP as the explained declared verdict.
@caomengxuan666
caomengxuan666 force-pushed the fix/du-threshold-conflict branch from 2986ee0 to 35c8f07 Compare November 16, 2026 03:29
caomengxuan666 pushed a commit that referenced this pull request Nov 16, 2026
zh-CN catalog 0.6.51 (77cd698) carries command.du.error.* keys ahead of
their source landing in #1794; ps.option.windows and legacy.ce93f5c9d7140354
drift resolved by #1786 + catalog 0.6.50.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
caomengxuan666 added a commit that referenced this pull request Nov 16, 2026
* test(stat): pin %F 'regular empty file' audit ruling (niubash#993 S9) (#1787)

The audit flagged 'regular file' vs 'regular empty file' for `: > f`;
current main already emits GNU 9.4's exact wording. No behavior
change — pin the audit repro so it can't regress.

* chore(i18n): refresh drift baseline — record du.error.* companion keys

zh-CN catalog 0.6.51 (77cd698) carries command.du.error.* keys ahead of
their source landing in #1794; ps.option.windows and legacy.ce93f5c9d7140354
drift resolved by #1786 + catalog 0.6.50.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 merged commit d03ab48 into main Nov 16, 2026
24 of 28 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/du-threshold-conflict branch November 18, 2026 05:50
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