Skip to content

chore: sync uutils/coreutils argument surfaces and vendored modules - #2896

Closed
chaliy wants to merge 2 commits into
mainfrom
chore/coreutils-args-drift
Closed

chaliy wants to merge 2 commits into
mainfrom
chore/coreutils-args-drift

Conversation

@chaliy

@chaliy chaliy commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Automated regeneration of argument surfaces and vendored modules
ported from uutils/coreutils.

Source revision: f56bd018d (was 6a7d199ed)
Utilities: cat ls mktemp od readlink realpath shuf stat tac tee truncate
Vendored modules: format
Trigger: .github/workflows/coreutils-args-drift.yml

This PR bumps UUTILS_REVISION in
crates/bashkit/src/builtins/generated/mod.rs, the matching
<util>_args.rs files, and any vendored module trees
atomically — args codegen, module-vendor mode, and the
body-drift harness all stay aligned to the same rev.

Review the diff to confirm whether upstream:

  • Added flags we should now expose
  • Removed/renamed flags we should drop or migrate
  • Reworded help text in user-visible ways
  • Changed body code in vendored modules (e.g. format/)

Squash-merge as a human so the merge commit is attributed
correctly per AGENTS.md. Intermediate bot commits in this PR
are discarded by squash.

Design: knowledge/runtimes/coreutils-args-port.md.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

chaliy and others added 2 commits November 9, 2026 09:33
The weekly `Coreutils Args Drift` run went red on 2026-11-09 with 13
compile errors against uutils/coreutils@6a7d199ed. Two unrelated upstream
refactors landed in shapes the port tool had no rewrite for, so both the
regenerated `format/` module and `ls_args.rs` referenced things bashkit
does not link.

uucore's `FormatError` moved from a hand-written `impl Display` to
`#[derive(thiserror::Error)]`, which put every `translate!` /
`translate_text!` call inside an `#[error("{}", ...)]` attribute. The
Fluent pass only walked expressions, so all eleven arms came through
unfolded:

    error: cannot find macro `translate_text` in this scope
      --> crates/bashkit/src/builtins/generated/format/mod.rs:68:19
    68 | #[error("{}", translate_text!("format-error-write", ...))]

Folding now walks attribute token streams as well. Call arguments are
carried as raw `TokenStream` rather than `Expr`, because upstream writes
thiserror's `.0` field shorthand there (`String::from_utf8_lossy(.0)`),
which tokenizes but is not valid expression syntax; the tokens are
interpolated verbatim so thiserror still binds them to the field. Since
only the macro's leaf ident is replaced, a qualified
`uucore::translate!(…)` in attribute position is now a hard error rather
than an emitted `uucore :: "literal"`.

Separately, `--quoting-style` moved into the shared
`uucore::quoting_style::parser`, so `ls` stopped defining `QUOTING_STYLE`
and started re-exporting it, and its arg chain began calling
`clap_quoting_argument()`. Args mode now inlines registered uucore
clap-helper items: a const/static is spliced in where `mod options`
re-exported it (keeping `options::QUOTING_STYLE` and the `use options::*`
glob resolving), builder functions are emitted at file root, call sites
are flattened to the bare item, the `use uucore::<m>;` is dropped, and
`translate!` keys resolve against uucore's own locales rather than the
utility's.

`CLAP_HELPER_MODULES` is an allowlist, same TM-INF-025 reasoning as the
`uu_app()` shape validator: third-party uutils source must not be able to
pull arbitrary uucore code into a generated parser by naming it. An
unregistered path is left untouched and surfaces as a compile error.
Inside a registered module only literal consts/statics and non-generic,
nullary, non-async `Arg`/`Command` builders with a single tail expression
inline; a `#[cfg]` on a candidate aborts the port, because resolving it
would need cargo feature evaluation the port does not do.

Regenerated everything against 6a7d199ed and bumped `UUTILS_REVISION`.
Beyond the two fixes the only behavioral drift carried in is upstream's:
`stat` gained `--format`/`--printf` `overrides_with`, and `ls
--quoting-style` help text lost its trailing period when the definition
moved to uucore. Ported paths are byte-identical between 6a7d199ed and
today's upstream HEAD.

Six new tests, each verified to fail with its fix reverted. The
differential harness and the uutils multicall build were not run locally
(this sandbox refuses to build third-party sources); the drift workflow
itself covers them.

Claude-Session: https://claude.ai/code/session_01Wy7MByfFw9dxbuNwL2LgfQ
… modules

Regenerated by `bashkit-coreutils-port` against uutils/coreutils@f56bd018d.

Utilities: cat ls mktemp od readlink realpath shuf stat tac tee truncate

Vendored modules: format
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 50756c7 Commit Preview URL

Branch Preview URL
Nov 09 2026, 09:41 AM

chaliy commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this PR is an artifact of a verification run, not a genuine drift sync, and merging it would land a worse version of #2895.

I dispatched coreutils-args-drift.yml on eve/clever-mccarthy-kvmta6 to exercise the uutils multicall build and the differential harness for #2895, which can't run in my sandbox. The run went green (42594438665) — which is the point — but open-pr then did its normal job. Since actions/checkout resolves to the dispatching ref, it branched chore/coreutils-args-drift off my branch rather than main, so this PR carries:

It does not carry 041ce94, the review fixes on #2895 that refuse a clap-helper import binding the item under another name. So this is #2895 minus its follow-up, plus a cosmetic rev bump.

#2895 is the PR to review. The residual drift here is real but trivial — ported paths are byte-identical between 6a7d199ed and f56bd018d, so it is only the pin comment — and next Monday's scheduled run will raise it from main on its own. Closing this does not shadow that: since #2745 the workflow matches --state open only, so a closed drift PR no longer absorbs later runs the way #2161 did.


Generated by Claude Code

@chaliy chaliy closed this Nov 9, 2026

@bashkit-pr-reviewer bashkit-pr-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of the coreutils args/vendored-module sync. The port-tool changes are fail-closed throughout (validators bail on unknown shapes, Fluent errors abort the port), generated diffs match their described upstream causes, and the knowledge doc was updated in the same change. One P2 robustness gap below; no blocking issues.

path.push(n.ident.to_string());
out.push(path);
}
UseTree::Rename(r) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Renamed helper imports (use uucore::<m>::<sub>::<ITEM> as <ALIAS>) silently produce uncompilable output instead of failing at port time. use_tree_paths keeps only the original ident (path.push(r.ident.to_string()), dropping r.rename), and splice_clap_helper_imports re-emits the definition under that original name (let name = &tail[2]; ... resolved.consts.get(name)), while all call sites keep referring to <ALIAS>. The port then exits success and the breakage only surfaces at cargo build. Same root cause as a second latent path: nothing asserts the emitted items are free of uucore-rooted paths (the flattener only visits uu_app + util-file helpers, never mod options or the inlined helper bodies), so any future non-use-item helper reference also becomes a build break rather than a port-time bail. Suggested fix: bail on UseTree::Rename in helper paths (or re-emit the alias), and add a final scan that bails if any uucore-rooted path remains in the emitted items. Not reachable with today's single-registry-entry inputs (upstream uses no renames; the inlined clap_quoting_argument is self-contained), and the failure mode is loud, hence P2.

@bashkit-pr-reviewer

Copy link
Copy Markdown

Review summary (head 50756c7)

Bot-authored uutils sync (9cc868b → f56bd01): clap-helper inlining in bashkit-coreutils-port, regenerated arg surfaces, vendored format/* + num_parser refresh, knowledge updates. Verdict: sound, no blocking issues.

Findings: 1 × P2 — renamed helper imports (... as ALIAS) lose the alias in use_tree_paths/splice_clap_helper_imports (args.rs:1298, :1552) and emit uncompilable output instead of bailing; likewise no final uucore-remnant assertion on emitted items. Latent only (single registry entry, no upstream renames; failure mode is a loud build break). See inline comment.

Spot-checks beyond the diff: port logic is fail-closed (shape validators bail, FluentPass errors abort, unknown-translate* macros in attributes error); generated format/* + num_parser contain no host env/fs/net/process/unsafe refs; UUTILS_REVISION bump to f56bd018d is consistent between generated/mod.rs and all file headers; FormatError's thiserror conversion preserves messages ({0}/.0 shorthand, strip_errno shim in format_support exists); ls --quoting-style inlining resolves via use options::* + spliced pub const QUOTING_STYLE; stat --format/--printf mutual overrides_with matches GNU last-wins; new unit tests cover the helper-inlining gates and attribute-position translate! folding, and the args-port knowledge doc was updated in the same change.

Could not review: nothing — the full 71 KiB diff (24 files) was retrieved (truncated: false). Note the PR body says "32 files"; the actual diff contains 24. No build/test run (no cargo in this shell); correctness of port output relies on CI compile + drift workflows.

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