Repository navigation
xargs: read -I input lines like GNU - #921
Conversation
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #921 +/- ##
==========================================
+ Coverage 92.63% 92.65% +0.01%
==========================================
Files 37 37
Lines 7818 7837 +19
Branches 392 393 +1
==========================================
+ Hits 7242 7261 +19
Misses 435 435
Partials 141 141 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Commit 560f18d has test result changes: GNU findutils testsuite: bfs testsuite: |
Merging this PR will not alter performance1 warning
Comparing |
There was a problem hiding this comment.
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.
|
Commit b333720 has test result changes: GNU findutils testsuite: bfs testsuite: |
| .no_stdout(); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
please add a test for the unbalanced quote case with -I too ("Unterminated quote", exit 1)
it is the visible change for find | xargs -I{}
-I split the input at raw newlines, so leading blanks stayed in the argument, blank lines ran the command, quotes and backslashes were kept literally and -E was ignored. Read each line with the usual quoting rules instead, keeping blanks inside the line.
echo is not a portable way to see the arguments on Windows.
b333720 to
563c2e1
Compare
There was a problem hiding this comment.
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.
|
Commit 563c2e1 has test result changes: GNU findutils testsuite: |
Builds on #920: the first commit here is that PR, the second is this change.
With
-I, the input is split at raw newlines, so the line goes in as it is: leading blanks stay, a blank line still runs the command, quotes and backslashes are kept literally, and-Eis dropped. POSIX says unquoted blanks at the start of each line are ignored with-I, and GNU applies the usual quoting rules to the line:-Inow uses the whitespace reader in a mode where blanks inside a line don't split it: each line is one argument, with quotes and backslashes handled as without-I, leading blanks and blank lines skipped, and-Eapplied.-Iwith-dor-0is unchanged.This is visible for
find | xargs -I{}: a name with an unbalanced quote now fails with "Unterminated quote" (exit 1, as without-Iand as GNU), and a backslash in a name is taken as an escape.-d '\n'or-0keep raw names. One older difference shows up here too and is not changed: on a quote error uutils also drops the line read just before it (a\nb\nit'srunsaonly; GNU runsaandb).New tests
test_whitespace_delimited_reader_whole_linesandxargs_replace_reads_quoted_lines(the second fails on main).cargo testgreen, clippy clean. 17-I/-icases (with-E,-n1,-d,,-0, empty input, backslash-newline,'') give the same output as GNU 4.10, apart from the wording of the -I/-L conflict warning.