Skip to content

xargs: print the command line for -t as GNU does - #936

Open
jayhemnani9910 wants to merge 1 commit into
uutils:mainfrom
jayhemnani9910:xargs-verbose-command
Open

jayhemnani9910 wants to merge 1 commit into
uutils:mainfrom
jayhemnani9910:xargs-verbose-command

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

xargs -t prints the Rust debug form of the Command, which lists every environment variable:

$ echo 'a b' | env -i HOME=/home/u LANG=en_US.UTF-8 PATH=/usr/bin:/bin xargs -t echo
env -i HOME="/home/u" LANG="en_US.UTF-8" PATH="/usr/bin:/bin" "echo" "a" "b"
a b

GNU prints the command and its arguments on one line, each quoted only where a shell would need it (shell_escape_quoting_style in print_args):

$ printf '"a b" c$d\n' | xargs -t echo
echo 'a b' 'c$d'

The line is now built from get_program() and get_args() with uucore's QuotingStyle::SHELL_ESCAPE. This enables uucore's quoting-style feature, which brings in the icu locale crates (16 new entries in Cargo.lock).

New test xargs_verbose_prints_the_command_line fails on main; cargo test passes, clippy and fmt clean.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 03:07

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.80%. Comparing base (d71f324) to head (0bc8150).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #936   +/-   ##
=======================================
  Coverage   92.79%   92.80%           
=======================================
  Files          37       37           
  Lines        8038     8046    +8     
  Branches      403      403           
=======================================
+ Hits         7459     7467    +8     
  Misses        437      437           
  Partials      142      142           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Oct 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 15 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 20 untouched benchmarks


Comparing jayhemnani9910:xargs-verbose-command (0bc8150) with main (d71f324)

Open in CodSpeed

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.

2 participants