Skip to content

xargs: only blanks and newlines separate arguments - #920

Merged
sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:xargs-blank-separators
Oct 25, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:xargs-blank-separators

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

The input reader splits on is_ascii_whitespace(), so CR and FF inside a word end the argument (VT does not). GNU xargs, and POSIX in the C locale, separate arguments only at blanks (space, tab) and newlines; CR, VT and FF are skipped before an argument but kept inside one:

$ printf 'a\rb\fc\vd e\n' | xargs printf '[%s]' | od -c
GNU 4.10:  [ a \r b \f c \v d ] [ e ]
main:      [ a ] [ b ] [ c \v d ] [ e ]

A file with CRLF line endings is the common case: a b\r\n gave b instead of b\r.

New test test_whitespace_delimited_reader_only_blanks_separate; it fails on main. cargo test green, clippy clean. Same output as GNU for the input above, for CRLF input with -L1, and for lines of only \r\f\v and blanks.

CR, VT and FF were treated like spaces inside the input, so 'a\rb' became
two arguments. GNU xargs (and POSIX in the C locale) skips them before an
argument but keeps them inside one.
Copilot AI balanced review requested due to automatic review settings October 25, 2026 06:49

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 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.63%. Comparing base (6cb9447) to head (c7483f4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #920   +/-   ##
=======================================
  Coverage   92.62%   92.63%           
=======================================
  Files          37       37           
  Lines        7808     7818   +10     
  Branches      392      392           
=======================================
+ Hits         7232     7242   +10     
  Misses        435      435           
  Partials      141      141           

☔ 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 25, 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-blank-separators (c7483f4) with main (6cb9447)

Open in CodSpeed

@github-actions

Copy link
Copy Markdown

Commit c7483f4 has test result changes:

GNU findutils testsuite:

Test results comparison:
  Current:   TOTAL: 495 / PASSED: 431 / FAILED: 63 / SKIPPED: 1
  Reference: TOTAL: 495 / PASSED: 426 / FAILED: 68 / SKIPPED: 1

Changes from main branch:
  TOTAL: +0
  PASSED: +5
  FAILED: -5

Test improvements (5):
  + L2_2
  + l1_2
  + space
  + space-r
  + sv-bug-18714

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 316 / PASSED: 276 / FAILED: 34 / SKIPPED: 6
  Reference: TOTAL: 316 / PASSED: 276 / FAILED: 34 / SKIPPED: 6

No result in this run (1) - hung, crashed, or renamed:
  ? posix/depth (was PASS)

@sylvestre
sylvestre merged commit 51f3499 into uutils:main Oct 25, 2026
34 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

@jayhemnani9910
jayhemnani9910 deleted the xargs-blank-separators branch November 13, 2026 14:31
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.

3 participants