History log of /src/usr.bin/xargs/xargs.c (Results 1 – 25 of 333)
Revision Date Author Comments
# a7fa987a 26-Jul-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

xargs: Limit -n to {ARG_MAX}

Since it's not possible to pass more than {ARG_MAX} bytes on the command
line, it's also not possible to pass more than {ARG_MAX} individual
arguments. Therefore, {ARG_

xargs: Limit -n to {ARG_MAX}

Since it's not possible to pass more than {ARG_MAX} bytes on the command
line, it's also not possible to pass more than {ARG_MAX} individual
arguments. Therefore, {ARG_MAX} is a reasonable upper bound for the -n
option. This resolves both the arithmetic overflow issue and the CI OOM
issue, so we can safely re-enable the test.

Fixes: eab91d008165
Fixes: 2682a1552724
MFC after: 1 week
Reviewed by: jlduran, emaste
Differential Revision: https://reviews.freebsd.org/D51536

show more ...


# 5fbdcd65 19-Apr-2024 Martin Tournoij <martin@arp242.net>

xargs: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBS

xargs: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

show more ...


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals.

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

show more ...


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# eab91d00 13-Jul-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 1048a870 13-Jul-2023 Daniel Tameling <tamelingdaniel@gmail.com>

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 replacemen

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

show more ...


# 202adb22 13-Jul-2023 Daniel Tameling <tamelingdaniel@gmail.com>

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,

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

show more ...


# fbc445ad 05-Jun-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

xargs: Consistently use strtonum() to parse arguments.

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


# 6d777389 05-Jun-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

xargs: Fix typo in error message.

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


# 21ef48af 17-Apr-2023 Yuri Pankov <yuripv@FreeBSD.org>

xargs: improve foundeof check for -E

4aeb63826e0f got it almost correct (we can't use strcmp() here as
current argument isn't guaranteed to be NUL-terminated), but we also
need to check that current

xargs: improve foundeof check for -E

4aeb63826e0f got it almost correct (we can't use strcmp() here as
current argument isn't guaranteed to be NUL-terminated), but we also
need to check that current argument length is equal to that of eofstr.

PR: 270867
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D39583

show more ...


# 0ca740d9 16-Oct-2022 liu-du <duliujimmy@hotmail.com>

xargs: fix exit code when using -P

currently when xargs runs in parallel mode (e.g. -P2), it somtimes
incorrectly returns zero exit code. this commit fix it and also adds
tests.

Reviewed by: mjg
P

xargs: fix exit code when using -P

currently when xargs runs in parallel mode (e.g. -P2), it somtimes
incorrectly returns zero exit code. this commit fix it and also adds
tests.

Reviewed by: mjg
PR: 267110

show more ...


# f058359b 05-Jul-2022 Tom Jones <thj@FreeBSD.org>

xargs: terminate if line replacement cannot be constructed

If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/x

xargs: terminate if line replacement cannot be constructed

If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).

Reviewed by: oshogbo
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35574

show more ...


# 0d2dcf21 12-Dec-2020 Yuri Pankov <yuripv@FreeBSD.org>

xargs: compile yesexpr as ERE

yesexpr is an extended regular expression for quite some time now,
use appropriate flag when compiling it.

PR: 238762
Reviewed by: kevans
Differential Revision: https

xargs: compile yesexpr as ERE

yesexpr is an extended regular expression for quite some time now,
use appropriate flag when compiling it.

PR: 238762
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D27509

show more ...


# dc940832 21-Sep-2020 Kyle Evans <kevans@FreeBSD.org>

xargs: add some long options for GNU compatibility

These are low-effort to add, so let's just do it.

Reported by: "LukeShu" on Hacker News (-r / --no-run-if-empty)
MFC after: 1 week


# ab825606 03-Apr-2020 Mark Johnston <markj@FreeBSD.org>

xargs: Fix exit status expression when a child process fails to exec.

PR: 244327
Submitted by: thomas.duffy.99@alumni.brown.edu
MFC after: 1 week


# a7fa987a 26-Jul-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

xargs: Limit -n to {ARG_MAX}

Since it's not possible to pass more than {ARG_MAX} bytes on the command
line, it's also not possible to pass more than {ARG_MAX} individual
arguments. Therefore, {ARG_

xargs: Limit -n to {ARG_MAX}

Since it's not possible to pass more than {ARG_MAX} bytes on the command
line, it's also not possible to pass more than {ARG_MAX} individual
arguments. Therefore, {ARG_MAX} is a reasonable upper bound for the -n
option. This resolves both the arithmetic overflow issue and the CI OOM
issue, so we can safely re-enable the test.

Fixes: eab91d008165
Fixes: 2682a1552724
MFC after: 1 week
Reviewed by: jlduran, emaste
Differential Revision: https://reviews.freebsd.org/D51536

show more ...


# 5fbdcd65 19-Apr-2024 Martin Tournoij <martin@arp242.net>

xargs: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBS

xargs: use getline() instead of fgetln()

This replaces fgetln() with getline(). The main reason for this is
portability, making things easier for people who want to compile these
tools on non-FreeBSD systems.

I appreciate that's probably not the top concern for FreeBSD base tools,
but fgetln() is impossible to port to most platforms, as concurrent
access is essentially impossible to implement fully correct without the
line buffer on the FILE struct. Other than this, many generic FreeBSD
tools compile fairly cleanly on Linux with a few small changes.

Most uses of fgetln() pre-date getline() support (added in 2009 with
69099ba2ec8b), and there's been some previous patches (ee3ca711a898
8c98e6b1a7f3 1a2a4fc8ce1b) for other tools.

Obtained from: https://github.com/dcantrell/bsdutils and
https://github.com/chimera-linux/chimerautils
Signed-off-by: Martin Tournoij <martin@arp242.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/893

show more ...


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals.

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix

show more ...


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a pe

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# eab91d00 13-Jul-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 1048a870 13-Jul-2023 Daniel Tameling <tamelingdaniel@gmail.com>

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 replacemen

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

show more ...


# 202adb22 13-Jul-2023 Daniel Tameling <tamelingdaniel@gmail.com>

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,

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

show more ...


# fbc445ad 05-Jun-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

xargs: Consistently use strtonum() to parse arguments.

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


12345678910>>...14