fix(coreutils-port): allow safe clap macros in uu_app validator#1620
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | d6f1bed | Commit Preview URL | May 09 2026, 01:46 AM |
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.
Motivation
uu_appvalidator ran after rewriting and unconditionally rejected every macro, which broke legitimate rewritten/expected macros likeenv!("CARGO_PKG_VERSION")andclap::value_parser!used in generated clap builders.Command::newroot + disallowed side-effect methods) while restoring regeneration availability for normal coreutils sources.Description
visit_expr_macroincrates/bashkit-coreutils-port/src/args.rsto allowlist safe builder macros by deferring to a newis_allowed_command_builder_macrohelper instead of rejecting all macros.is_allowed_command_builder_macrowhich permitsenv!, unqualifiedvalue_parser!, andclap::value_parser!paths used by the rewriter and uutils sources.validate_uu_app_body, rootCommand::newrequirement, andis_disallowed_chain_methodside-effect method blacklist.accepts_expected_builder_macrosandrejects_unexpected_macro_in_builder_chainto cover the rewrittenuucore::crate_version!()→env!case and to ensure unexpected macros (e.g.format!) are still rejected.Testing
cargo fmt --allwhich completed successfully.cargo test -p bashkit-coreutils-portand all tests passed (27 passed, 0 failed), including the new regression tests which validate allowed and disallowed macro behaviors.Codex Task