HomeFreeBSD

xargs: fix -R so that it accepts negative numbers again

Description

xargs: fix -R so that it accepts negative numbers again

fbc445addf9 converted the parsing of arguments to strtonum but made
the accepted range for -R too restrictive. As documented in the man
page, it should accept negative numbers.

Added a test for this, which was provided by Jose Luis Duran.

Fixes: fbc445addf9
MFC after: 1 week
Reviewed by: des, kevans
Differential Revision: https://reviews.freebsd.org/D41021

(cherry picked from commit 202adb2236104141dc02d512084a3cc4bbe734c7)

xargs: disallow -R0 and -L0

Both cases were interpreted as these flags are unset. This meant that
-R0 got converted to -R5 and that -L0 didn't have any effect at all.
Since make at most 0 replacements isn't useful and since call utility
for every 0 lines read doesn't make sense, throw an error for these
two cases.

MFC after: 1 week
Reviewed by: des, kevans
Differential Revision: https://reviews.freebsd.org/D41022

(cherry picked from commit 1048a870e3b6973a5be1193f3b45e6e867e8e1c0)

xargs: Prevent overflow in linelen calculation if nargs is large.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41023

(cherry picked from commit eab91d008165e7bbf8ca7b87eabe4dc8bf3da191)

xargs: Fix test case count.

MFC after: 1 week
Sponsored by: Klara, Inc.

(cherry picked from commit c65845d0bb2d17dc283ae5928f25e68212a30842)

xargs: Install missing test output.

Fixes: eab91d008165e7bbf8ca7b87eabe4dc8bf3da191
MFC after: 1 week
Reviewed by: des
Differential Revision: https://reviews.freebsd.org/D41033

(cherry picked from commit d234c8228ced5ea3aa86bd2e9eca79b87d8e6441)

xargs tests: Disable the test added in commit eab91d008165

This test has been triggering OOM kills in CI runs since it triggers an
allocation of 16GB. Temporarily disable the test until the problem is
solved one way or another.

(cherry picked from commit 2682a15527241278c9aa46c4907d3b07460b8ec0)

Details

Provenance
tamelingdaniel_gmail.comAuthored on Jul 13 2023, 8:06 PM
desCommitted on Sep 7 2023, 8:56 AM
Reviewer
des
Differential Revision
D41021: xargs: fix -R so that it accepts negative numbers again
Parents
rGe4dee290ff0b: stdbuf: Code cleanup.
Branches
Unknown
Tags
Unknown