Skip to content

gap-fill: w 测试补齐 + 6 命令 #1462 式 oracle 审计(arch/locale/pinky/pwd/stdbuf/who) - #1547

Merged
caomengxuan666 merged 10 commits into
mainfrom
fix/test-oracle-gaps
Nov 9, 2026
Merged

caomengxuan666 merged 10 commits into
mainfrom
fix/test-oracle-gaps

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Gap-fill round: w test coverage + 6-command oracle audits (#1488 / #1545 inventory / #1462 method)

Independent worktree branch. Method per #1462: oracle source/live oracle first, then adjudicate, then fix. All comparisons against WSL GNU oracles (coreutils 9.4, procps-ng 4.0.4, glibc 2.39) via script files, stdout/stderr/exit three-way.

Task 1 — w (the only audited command with no tests)

  • New tests/unit/w (13 session-count-independent pins): header presence/-h suppression, -s tail, -f toggle, -i force-FROM, -p/-o acceptance, no-match user filter leaves exactly the 2 header lines exit 0, invalid-option diagnostics + exit 1, --help/--version.
  • Differential gate vs WSL procps-ng 4.0.4: exit codes and first-line diagnostics byte-identical on all comparable faces; evidence in the audit-procps-misc.md addendum.
  • Recorded residual (no change): our headers match upstream procps-ng v4.0.4 git (src/w.c:799-806, 67/45 cols); the Ubuntu-built 4.0.4 oracle prints 68/46 — distro patch vs git tag; upstream source stays the contract.
  • Bonus: fixed C4477 (bad long long cast on a %02d argument) in time_ival7.

Task 2 — 6 audits (files in tests/differential/audit-.md)

Command Verdict One-liner
arch clean all faces byte-identical modulo repo-wide quotearg/help conventions
pwd clean -L/-P last-wins, POSIXLY_CORRECT presence test, PWD validation fallbacks all match
stdbuf clean full matrix incl. optstring-'+' operand boundary, bare-K xstrtol rule, 125/127 exits
locale notes (4 fixed) bare -c/-k now silent (also kills a broken literal-concat block), unknown-name whitelist locale: unknown name "X", invented names (codeset/month/...) rejected + mon added, -k print_item quoting
pinky notes (3 fixed) -l try-help line, --lookup rejected (9.4 has no long opts), When column %b %e; headings byte-identical under LC_ALL=C
who notes (3 fixed) missing FILE operand is silent exit 0 (old pin contradicted the oracle and was flipped), doubled who: who: prefix fixed, time face switched to the C-locale 12-col branch of who.c:803-811

Platform faces stand per the W4 coordinating ruling (mesg, utmp views, WTS rows, locale simulation model), each cited in the audit files. Locale value-model rework (C-locale empty/-1 table, -a/-m inventories, category dumps) needs the locale-database simulation layer (niu #758 dependency) and is documented for follow-up filing.

Verification

Refs #1488, #1462, #1545

本 PR 删除了什么

  • pinky --lookup 长选项一个(GNU 9.4 无此选项,属编造项;删后 --lookup 按 GNU 措辞被拒,exit 1)。
  • locale 旧 -k 无参分支整段破损输出(含字面量拼接块 LC_CTYPE= + get_system_locale() + 等 6 行)与旧 month/codeset/collate/ctype/monetary/numeric/time/default_language 编造名应答。
  • who 对缺失 FILE 操作数的 No such file or directory 报错(旧 pin 一并翻转)。
  • locale 旧报错措辞 locale: unknown keyword 'X'(改为 GNU 的 locale: unknown name "X")。
  • 其余皆为新增(测试、审计记录、白名单表),无产品功能删除。

…snprintf warning

The #1545 inventory scan listed w as the only audited command with no
test coverage. Add tests/unit/w (header block present/suppressed, -s
short tail, -f FROM toggle, -i FROM force, -p/-o acceptance, no-match
user filter leaves exactly the two header lines, invalid short/long
option diagnostics + exit 1, --help/--version).

Differential gate vs WSL procps-ng 4.0.4: exit codes and first-line
diagnostics byte-identical on every comparable face; evidence recorded
as a gap-fill addendum in tests/differential/audit-procps-misc.md
(follow-up commit). One header residual recorded there: ours matches
the upstream v4.0.4 git source byte-for-byte while the Ubuntu build
carries a one-column patch — upstream source stays the contract.

Also drop a bad static_cast<long long> around the %02d centis argument
in time_ival7 (C4477; the value is already int).

Refs #1488, #1462
…telist, -k quoting, mon

#1462-method audit against glibc 2.39 (WSL oracle; audit-locale.md has
the evidence and the platform-face ledger):

- Bare -c / -k now write nothing and exit 0: glibc only dumps the
  environment in the no-argument branch; -c/-k feed the per-NAME loop.
  This also deletes the -k bare-dump block whose string literal
  'concat' printed 'LC_CTYPE= + get_system_locale() + ' verbatim.
- NAME admission inverted to a whitelist of implemented glibc item
  names; anything else is 'locale: unknown name "X"' exit 1 in both
  plain and -k modes (glibc locale_special.c wording; -k previously
  had no validation at all and printed fabricated bindings).
- Invented names (codeset/collate/ctype/monetary/numeric/time/
  default_language/month) fall to the unknown-name error, matching
  glibc 2.39 which rejects them; 'mon' is added as the real LC_TIME
  full-month item.
- -k renders per glibc print_item(): strings quoted name="value",
  numeric monetary flags unquoted, empty era bare.
- Multiple NAME operands answered in argv order.

Value-model faces (C-locale empty/-1 table vs the en-US simulation,
-a/-m inventories, category dumps) are documented as simulation-layer
[DIFFERS] in audit-locale.md; 6 new unit pins.

Refs #1488, #1462
…%e time

#1462-method audit against coreutils 9.4 (audit-pinky.md):

- 'pinky -l' without a username now carries the standard
  "Try 'pinky --help' for more information." line (GNU usage shape;
  exit code already matched at 1).
- --lookup is removed: coreutils 9.4 pinky declares no long options
  beyond --help/--version (src/pinky.c longopts), and the oracle
  rejects it as an unrecognized option, exit 1. The dispatcher now
  produces that wording.
- The When column formats "\%b \%e \%H:%M" (src/pinky.c:434,
  space-padded day) instead of \%d; UCRT %e verified.
- Heading bytes verified byte-identical to GNU under LC_ALL=C for
  plain/-q/-w/-i (an earlier 16-wide reading was the oracle host's
  C.UTF-8 hard-locale face, not the C-locale contract; the hard-locale
  face is recorded, not implemented).

W4 platform rulings (mesg '?', console line, WTS rows, profile-model
long format) stand, cited in audit-pinky.md. 2 new unit pins.

Refs #1488, #1462
…fix, C-locale time face

#1462-method re-audit against coreutils 9.4 (audit-who.md); re-opens
the W4 faces with live evidence:

- An unreadable FILE operand no longer errors: coreutils who.c has no
  existence validation — utmpxname()/getutent() fail lazily, so
  'who /no/such/utmp' prints nothing and exits 0 (observed), and -H
  still prints the heading before the empty record loop. The old
  'missing utmp FILE is the GNU error' unit pin contradicted the
  oracle and is flipped.
- The unsupported-option refusal no longer doubles the 'who: ' prefix
  (report_error() already prepends the command name; the i18n default
  embedded its own).
- Time column switched to the C/POSIX branch of who.c:803-811:
  '%b %e %H:%M' with time_format_width 12 (the 16-column ISO face is
  the hard-locale branch only). -H / -H -T / -H -u headers are now
  byte-identical to the oracle under LC_ALL=C.

W4 platform rulings (mesg '+', FILE accepted-but-unparsed, utmp-view
refusals) stand, cited in audit-who.md. 3 new pins + 1 flipped pin.

Refs #1488, #1462
…dendum

#1462-method audit records for the three remaining unreviewed
inventory commands, each with the option matrix, three-way
(stdout/stderr/exit) comparison and evidence:

- arch: clean — every face byte-identical modulo the repo-wide
  quotearg/help-version conventions.
- pwd: clean — -L/-P/last-wins/POSIXLY_CORRECT/pwd-validation faces
  all match; fixed-prefix and Win32 PWD-form notes recorded.
- stdbuf: clean — full matrix matches incl. the optstring-'+' operand
  boundary, bare-K xstrtol rule, 125/127 exits and published env
  values; smart-quote residual noted.
- audit-procps-misc.md gains the 2026-11-09 gap-fill addendum for w:
  test coverage, differential-gate evidence vs WSL procps-ng 4.0.4,
  and the recorded upstream-git-vs-Ubuntu header residual.

Refs #1488, #1462, #1545
The i18n-drift gate is a ratchet: deliberate user-visible string changes
record their growth in the same PR (check_i18n_drift.py
--update-baseline), per the #1534 precedent. Verified clean at the base
revision (24 recorded, none new); this PR grew zh-CN extras by 10:

- command.pinky.option.lookup: the invented --lookup option is removed —
  coreutils 9.4 pinky declares no long options beyond --help/--version
  (src/pinky.c longopts), so the catalog key the old option carried is
  now extra.
- legacy.0dd8f6031bba80d5 '^[nN]', legacy.1171ad640b28c83c day list,
  legacy.1ba4ef81e33e6de8 month list, legacy.633616abe53daa05 abday
  list, legacy.918315ef66894645 'USD ', legacy.af63994c86017ab3 '$',
  legacy.af63a14c8601884b ',', legacy.af63ac4c86019afc '1',
  legacy.d4c4e1038c50071b '^[yY]': the locale keyword-value literals
  moved out of direct safePrintLn calls into the keyword_value()
  whitelist helper, so scripts/i18n_batch.py's extraction regex (which
  only scans literals sitting directly inside safePrint calls) no
  longer sees them. Runtime translation is unaffected — safePrintLn
  localizes by content digest (translate_legacy) whatever shape the
  argument takes — so the zh-CN catalog entries stay live; only their
  extraction visibility changed.

Catalog translation sync follows at release via the tag-triggered
sync-i18n-catalog job. Local check now passes: i18n drift OK (34
recorded, none new).

Refs #1488, #1462
The baseline job is red on this PR with exactly one gate error:
'new case: corpus/grep/07-initial-tab-width.case=PASS'. The case was
added to the corpus by #1539 (grep -T line-number/offset width, Refs
#1515) but its ledger entry was never recorded — the same error line
appears in #1539's own baseline job log on main, so main carries the
latent gap and any PR touching nothing at all would trip it.

Add the single entry (PASS, grep), verified three ways:
- compare-baseline.py against the CI run's own baseline-results.tsv
  artifact (oracle-anchored Ubuntu 24.04 / coreutils 9.4 shape):
  'baseline OK cases=645'.
- check-baseline-growth.py against the base revision's ledger:
  644->645 cases, 604->605 PASS (pure growth).
- Local full-corpus runner run reproduces PASS for the case; its other
  deltas vs the ledger are this machine's host-PATH shape (Niubash
  allowlisted oracles), not present in the CI artifact.

Refs #1488, #1539
caomengxuan666 added a commit to unixwin/winuxcmd-i18n that referenced this pull request Nov 9, 2026
…eys (#36)

# i18n 同步:配合 WinuxCmd PR #1547 清除 10 个 zh-CN 孤儿 key

本 PR 是 unixwin/WinuxCmd#1547(gap-fill: w 测试补齐 + 6 命令 oracle 审计)的**同任务 i18n 同步**。WinuxCmd#1547 删除了用户可见源字符串但未同步本仓 catalog,其 i18n-drift 门(`scripts/check_i18n_drift.py`)在 PR 头 `5be2eee3` 上 rc=1、新增 10 个 zh-CN extra key(基底 `a92ba5ec` 上 rc=0,增长 100% 由该 PR 引起;队长复核 CAPTAIN-VERIFY §C2 已逐 key 归因)。本 PR 只删除这 10 个孤儿 key 并 bump VERSION,清零该漂移。

Refs unixwin/WinuxCmd#1547

## 逐 key 归因

- `command.pinky.option.lookup`(“尝试将主机名规范化”):真孤儿——WinuxCmd#1547 删除了 pinky 的 `--lookup` 长选项(GNU 9.4 无此选项),源不再产生该选项描述。
- `legacy.0dd8f6031bba80d5`(`^[nN]`):locale 关键字值数据(noexpr),旧代码纯字面量打印被提取,WinuxCmd#1547 改由 `keyword_value()` 值表返回后不再被提取。
- `legacy.1171ad640b28c83c`(星期日;…列表):locale 值数据(day 全名列表),同上提取口径副产品。
- `legacy.1ba4ef81e33e6de8`(一月;…列表):locale 值数据(mon 全名列表),同上。
- `legacy.633616abe53daa05`(周日;…列表):locale 值数据(abday 缩写列表),同上。
- `legacy.918315ef66894645`(`USD `):locale 值数据(货币符号类),同上。
- `legacy.af63994c86017ab3`(`$`):locale 值数据,同上。
- `legacy.af63a14c8601884b`(`,`):locale 值数据,同上。
- `legacy.af63ac4c86019afc`(`1`):locale 值数据,同上。
- `legacy.d4c4e1038c50071b`(`^[yY]`):locale 关键字值数据(yesexpr),同上。

9 个 `legacy.*` 的数据本身仍出现在 locale 输出中,只是打印点由字面量改为值表变量,不再被提取器收录——属提取口径副产品,不是用户可见文案增删。

## 其他语言 catalog 核查

本仓 `catalogs/` 仅有 zh-CN 一个 catalog;已核查,其余语言 catalog 不存在,上述 10 个 key 无其他语言副本。

## 验证

- 同步前:WinuxCmd @ `5be2eee3` + 本仓 main(`f4d5da1`)跑门脚本 rc=1,输出恰为上述 10 个 extra key。
- 同步后:WinuxCmd @ `5be2eee3` + 本 PR 树跑门脚本 rc=0(`i18n drift OK`)。

## 本 PR 删除了什么

- zh-CN catalog 中 10 个孤儿 key(1 个 pinky `--lookup` 选项描述 + 9 个 locale 值数据 legacy key),逐个见上表。
- 除此之外无任何删除;`catalogs/zh-CN/catalog.json` 净 −10 行,`VERSION` 0.6.31 → 0.6.32(catalogs/ 改动同 PR bump patch 段)。


## 补充(开 PR 后同日):WinuxCmd#1547 头已推进

WinuxCmd#1547 在本 PR 开出前后新增提交 `b861695`,把这 10 个 key 以门路径 (b) 记入其仓内 `scripts/i18n-drift-baseline.json`——故其 i18n-drift CI 腿在新头上已可转绿,但 catalog 内的孤儿 key 实体仍在。本同步 PR 是 WinuxCmd 仓 AGENTS.md 同任务同步规则要求的 (a) 路径实体清理,与 (b) 记录互不冲突:以新头 `af8fa464` 复跑门脚本,本 PR 树下 10 个 key 全部报 `drift resolved`、rc=0(证据:队长复核工作区 review-1547/i18n-sync-evidence.log 补充节)。两支合入顺序与 (b) 记录的后续收尾由队长编排。
caomengxuan666 and others added 2 commits November 9, 2026 11:25
The second push to PR #1547 produced no workflow runs at all (both
workflows; only the Vercel check appeared), so the i18n-drift gate
could not be re-verified on the branch update. workflow_dispatch gives
a manual re-run path that does not depend on push event fan-out.
Resolve scripts/i18n-drift-baseline.json by union: keep the PR side's 10 recorded extra keys (command.pinky.option.lookup + 9 legacy.*) and main side's 1 recorded missing key (legacy.7d2d2cf903edeae3); recorded_at kept at the newest side (2026-11-09T02:49:45Z). No other file needed manual resolution.
@caomengxuan666
caomengxuan666 merged commit 2a0ddf5 into main Nov 9, 2026
13 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 10, 2026
…plets

Three CI findings from PR #1561's first run, each traced to root cause:

i18n-drift: the 25 new-drift rows are all stale zh-CN keys whose source
strings this PR deleted (the 10 C++ bodies + test_expr.hpp, incl.
command.readlink/realpath.error.file_name_too_long — the Rust
fsutil::reason statics replaced the keyed i18n::format calls). Verified
PR-introduced: main tip measures none of them (its CI is green), and the
catalog clone carries the keys for text my branch no longer produces.
Recorded as deliberate growth with check_i18n_drift.py
--update-baseline per the #1534/#1547 precedent; the eventual shrink is
the catalog cleanup batch in unixwin/winuxcmd-i18n.

baseline (GNU master differential), 2 real mismatches vs the live oracle:
- mkdir -m 888 printed the usage Try-hint; GNU mkdir.c:290 treats an
  invalid mode as a runtime operand error - one stderr line, no hint.
  mkdir.rs writes the line directly now.
- test -f /dev/null returned 0: the operand reaches the library as the
  NUL DOS device and metadata() succeeds on it; -f now rejects DOS char
  devices (GNU: char device is not a regular file, rc 1).

build-windows x64 ctest, 4 symlink rows the local runner skipped
(no symlink privilege) that the CI runner executes:
- readlink -f / realpath default / realpath -m on a dangling leaf link
  (dang -> z_absent_tgt) now resolve the leaf symlink to its target's
  path (<parent>/z_absent_tgt, rc 0) instead of echoing the link name -
  AllButLast splices the read_link target onto the canonical parent and
  folds it lexically; NoCheck does the same over the -m walk; -e keeps
  failing (probed GNU 9.4). canon unit test pins the class where
  symlinks are creatable, skips where they are not.
- realpath --relative-to: the common-prefix walk compared components
  case-sensitively, so the CI runner's lowercase-drive ctx.cwd ("d:\...")
  never matched the canonicalized target's "D:\..." and the output fell
  back to absolute. Component comparison is now case-insensitive
  (Windows path spellings are case-variants).

pgrep_inverse_excludes_matches failed once on CI and passes on rerun -
the #1553 pid-flake family, unrelated.

Refs #1488
caomengxuan666 added a commit that referenced this pull request Nov 10, 2026
…plets

Three CI findings from PR #1561's first run, each traced to root cause:

i18n-drift: the 25 new-drift rows are all stale zh-CN keys whose source
strings this PR deleted (the 10 C++ bodies + test_expr.hpp, incl.
command.readlink/realpath.error.file_name_too_long — the Rust
fsutil::reason statics replaced the keyed i18n::format calls). Verified
PR-introduced: main tip measures none of them (its CI is green), and the
catalog clone carries the keys for text my branch no longer produces.
Recorded as deliberate growth with check_i18n_drift.py
--update-baseline per the #1534/#1547 precedent; the eventual shrink is
the catalog cleanup batch in unixwin/winuxcmd-i18n.

baseline (GNU master differential), 2 real mismatches vs the live oracle:
- mkdir -m 888 printed the usage Try-hint; GNU mkdir.c:290 treats an
  invalid mode as a runtime operand error - one stderr line, no hint.
  mkdir.rs writes the line directly now.
- test -f /dev/null returned 0: the operand reaches the library as the
  NUL DOS device and metadata() succeeds on it; -f now rejects DOS char
  devices (GNU: char device is not a regular file, rc 1).

build-windows x64 ctest, 4 symlink rows the local runner skipped
(no symlink privilege) that the CI runner executes:
- readlink -f / realpath default / realpath -m on a dangling leaf link
  (dang -> z_absent_tgt) now resolve the leaf symlink to its target's
  path (<parent>/z_absent_tgt, rc 0) instead of echoing the link name -
  AllButLast splices the read_link target onto the canonical parent and
  folds it lexically; NoCheck does the same over the -m walk; -e keeps
  failing (probed GNU 9.4). canon unit test pins the class where
  symlinks are creatable, skips where they are not.
- realpath --relative-to: the common-prefix walk compared components
  case-sensitively, so the CI runner's lowercase-drive ctx.cwd ("d:\...")
  never matched the canonicalized target's "D:\..." and the output fell
  back to absolute. Component comparison is now case-insensitive
  (Windows path spellings are case-variants).

pgrep_inverse_excludes_matches failed once on CI and passes on rerun -
the #1553 pid-flake family, unrelated.

Refs #1488
caomengxuan666 added a commit that referenced this pull request Nov 11, 2026
…ve3b)

The mechanical replacement deletes the C++ numfmt body, so its 27
catalog keys (command.numfmt.error.*) are no longer produced by the
source extraction — the zh-CN catalog now carries them as standing
'extra' drift, exactly like the #1547/#1561 wiring precedents. New
diagnostics are emitted by the rust2 library through the bridge and
are GNU-shaped, not catalog-keyed. Recorded via
check_i18n_drift.py --update-baseline after local confirmation
(clone of unixwin/winuxcmd-i18n; growth is numfmt-scoped only).

Ref: #1488 (wave3b wiring)
caomengxuan666 added a commit that referenced this pull request Nov 11, 2026
The mechanical replacement deletes the C++ bodies of whoami/nproc/
unlink/sleep/hostname/uname/id/getconf, so their source strings are no
longer produced by the extraction: 23 keys disappear from the source
catalog (verified by diffing i18n_batch.extract on origin/main vs this
branch - all 23 belong to the eight wired bodies, e.g. 'sleep: missing
operand', 'unlink: missing operand', 'id: cannot get process identity',
'getconf: no variable specified'; zero keys added). The zh-CN catalog
now carries 21 of their legacy.* strings plus
command.sleep.error.invalid_interval as standing 'extra' drift, exactly
like the #1547/#1561/wave3b wiring precedents; two previously recorded
'missing' drifts (legacy.9b28a3702b3d6726 hostname, legacy.c9d02dd126c4a836
name too long) resolve as a side effect. No new diagnostics are
introduced: new-exe messages ride the rust2 bridge and are GNU-shaped.

Recorded via check_i18n_drift.py --update-baseline after local
confirmation: the same check against the published catalogs is green on
origin/main (e466808) and red only on this branch.

Ref: #1488 (wave2a wiring)
caomengxuan666 added a commit that referenced this pull request Nov 11, 2026
Deleting the seven wave2b C++ bodies (base64 base32 b2sum sha224sum
sha384sum tac truncate) orphaned their legacy-catalog source strings:
16 new legacy.* extra entries in zh-CN, all introduced by this PR
(merge-base b055b48 checks clean). Same deliberate-growth precedent
as #1547/#1561 and wave3b's numfmt wiring; the catalogs sync on the
next reviewed i18n batch.
caomengxuan666 added a commit that referenced this pull request Nov 11, 2026
Deleting the seven wave2b C++ bodies (base64 base32 b2sum sha224sum
sha384sum tac truncate) orphaned their legacy-catalog source strings:
16 new legacy.* extra entries in zh-CN, all introduced by this PR
(merge-base b055b48 checks clean). Same deliberate-growth precedent
as #1547/#1561 and wave3b's numfmt wiring; the catalogs sync on the
next reviewed i18n batch.

# Conflicts:
#	scripts/i18n-drift-baseline.json
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.
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.
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