Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 019816e | Commit Preview URL Branch Preview URL |
May 08 2026, 10:21 PM |
Add the syn-based import rewriter for the manifest's `replace_with` action so modules referencing uucore-internal types can be vendored with substitutions, unblocking #1534's printf migration. Behaviour: - For each top-level `use` item, flatten the tree into leaf paths (preserving glob/rename semantics). - For each leaf, look up a `replace_with` substitution whose prefix matches; replace the matched prefix segments with `target`. - When the rewritten path's final segment differs from the original imported name, an `as <orig>` rename is inserted so call-site references still resolve. - Rebuild use items individually — use groups (`use a::{b, c};`) become separate `use` lines (the file is re-pretty-printed via `prettyplease::unparse` whenever any `replace_with` is in scope). - Existing `error` semantics unchanged; `inline` still bails with a follow-up message (separate from this change). - Validation: `replace_with` requires a non-empty `target`. Tests cover: prefix-match rewrite with rename insertion, no-rename when leaf matches, use-group flattening, alias preservation, and missing-target validation. Spec and module-doc updated. This is a focused incremental step toward #1534; the format/ vendor + printf migration land in follow-up PRs.
Extend the rewriter to support `action = "inline"` substitutions. Behaviour: - Each `inline` substitution names an `inline_source` file under the uutils dir. After porting the primary tree, the tool ports each inlined file to `<out_base>/<leaf>.rs` (where `<leaf>` is the prefix's final segment). - The inlined file goes through the same enforce + rewrite pipeline so its own transitive uucore references either substitute via another manifest stanza or surface explicitly. - Use-paths matching an `inline` substitution prefix are rewritten to `super::<leaf>::…` so the vendored module compiles. - Validation: `inline` substitutions require a non-empty `inline_source` field; missing field is rejected at port time. Tests cover: inlined file is vendored alongside, primary use-path is rewritten to `super::<leaf>`, banner is added to the inlined file, and missing-inline_source validation. Spec and module-doc updated. With `replace_with` (prior commit) and `inline` both supported, the rewriter foundation in `bashkit-coreutils-port` is complete; the remaining pieces of #1534 (vendor uucore::format, migrate printf.rs) land in follow-up PRs against this primitive.
Pin versions to uutils' workspace defaults. These deps back the upcoming vendored uucore::format module that #1534 will use for `printf`. Adding them in a separate commit so the vendor PR keeps to mechanical codegen output. Verified: - `cargo check -p bashkit` (default features): clean. - `cargo build -p bashkit --no-default-features`: clean. - `cargo test -p bashkit --lib`: 2230 passed. - `cargo clippy -p bashkit --all-targets -- -D warnings`: clean. (`cargo build --target wasm32-unknown-unknown` is broken on bashkit `main` independently of this change — `getrandom`'s wasm-js backend isn't enabled — so was not regression-tested here. Re-test once that pre-existing wasm build is restored.)
cargo-vet flagged the new format-vendor deps as unvetted. Add exemptions to match the existing entries for bigdecimal / num-traits in this manifest.
318b007 to
019816e
Compare
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.
What
Vendors
uucore::formatinto bashkit and migrates theprintfbuiltin to use the generated parser/formatter. Closes #1534.Why
The handwritten
printfparser duplicated uutils logic and made format parity harder to maintain. Vendoring the smallformat/runtime keeps wasm builds working while avoiding the large uucore runtime dependency.How
bashkit-coreutils-port port-modulewithreplace_with/inlinesupport, generated-doc/test stripping, relativeselfuse normalization, and absolute generated-module paths for inlined files.formatmanifest entry plus generatedformat/,extendedbigdecimal,num_parser, and bashkit-localformat_supportshims.printf.rsaround generated formatting while preserving bashkit shell integration,printf -vinternal-variable protection,%q, repeated-format behavior, zero-hex escape handling, and width/precision DoS caps outside generated code./privatecanonicalization.getrandom'swasm_jsfeature so the wasm public build gate stays green.Risk
printfformatting behavior changes from bashkit's handwritten implementation to uutils behavior. Existing spec tests, focused unit tests, no-leak checks, no-default/release/wasm builds, all-features clippy/test, andjust pre-prpassed locally.Checklist
cargo test -p bashkit-coreutils-portcargo test -p bashkit --lib printfcargo test -p bashkit --test spec_tests bash_spec_testscargo build -p bashkit --no-default-featurescargo build -p bashkit --target wasm32-unknown-unknowncargo build -p bashkit --releasecargo clippy --workspace --all-targets --all-features -- -D warningscargo test --all-featuresjust pre-pr