aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/xargs
Commit message (Collapse)AuthorAgeFilesLines
* xargs: Convert tests to ATFDag-Erling Smørgrav2025-07-264-39/+194
| | | | | | | | Also add license and copyright statement, with permission from the original author. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51537
* xargs: Limit -n to {ARG_MAX}Dag-Erling Smørgrav2025-07-264-6/+6
| | | | | | | | | | | | | | 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
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* xargs: use getline() instead of fgetln()Martin Tournoij2024-04-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | 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
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-274-8/+0
| | | | | | | | 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
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-167-7/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* xargs tests: Disable the test added in commit eab91d008165Mark Johnston2023-07-311-2/+4
| | | | | | 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.
* xargs: Install missing test output.Jose Luis Duran2023-07-132-1/+2
| | | | | | | Fixes: eab91d008165e7bbf8ca7b87eabe4dc8bf3da191 MFC after: 1 week Reviewed by: des Differential Revision: https://reviews.freebsd.org/D41033
* xargs: Fix test case count.Dag-Erling Smørgrav2023-07-131-1/+1
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* xargs: Prevent overflow in linelen calculation if nargs is large.Dag-Erling Smørgrav2023-07-133-1/+3
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D41023
* xargs: disallow -R0 and -L0Daniel Tameling2023-07-131-1/+3
| | | | | | | | | | | | 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
* xargs: fix -R so that it accepts negative numbers againDaniel Tameling2023-07-134-2/+8
| | | | | | | | | | | | | 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
* xargs: Consistently use strtonum() to parse arguments.Dag-Erling Smørgrav2023-06-051-15/+14
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40425
* xargs: Fix typo in error message.Dag-Erling Smørgrav2023-06-051-1/+1
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* Additions to targets/pseudo/host-toolsSimon J. Gerraty2023-04-272-0/+17
| | | | | More tools needed to be built for Linux. These are the ones that "just work".
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+0
|
* xargs: improve foundeof check for -EYuri Pankov2023-04-171-2/+5
| | | | | | | | | | 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
* xargs: fix exit code when using -Pliu-du2022-10-172-5/+14
| | | | | | | | | 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
* xargs: fix description of strnsubst return valueTom Jones2022-07-051-1/+1
| | | | | | Reported by: oshogbo Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35574
* xargs: terminate if line replacement cannot be constructedTom Jones2022-07-052-7/+16
| | | | | | | | | | | | 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
* pkgbase: Put more binaries/lib in runtimeEmmanuel Vadot2021-12-211-0/+2
| | | | | | | | | Move some needed binaries/libs from FreeBSD-utilities to FreeBSD_runtime. This is everything needed to boot to multiuser with FreeBSD-rc installed. MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33435
* xargs: compile yesexpr as EREYuri Pankov2020-12-121-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=368580
* xargs: add some long options for GNU compatibilityKyle Evans2020-09-212-10/+27
| | | | | | | | | | 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 Notes: svn path=/head/; revision=365954
* xargs(1): Add EXAMPLES to man pageFernando Apesteguía2020-06-111-2/+28
| | | | | | | | | | | | | Add EXAMPLES covering options I, J, L, n, P. While here, fix warning (STYLE: no blank before trailing delimiter: Fl P,) Bumping .Dd Approved by: bcr@ Differential Revision: https://reviews.freebsd.org/D25214 Notes: svn path=/head/; revision=362060
* xargs: Fix exit status expression when a child process fails to exec.Mark Johnston2020-04-031-1/+1
| | | | | | | | | PR: 244327 Submitted by: thomas.duffy.99@alumni.brown.edu MFC after: 1 week Notes: svn path=/head/; revision=359596
* userland: Fix several typos and minor errorsEitan Adler2017-12-271-1/+1
| | | | | | | | | | | - duplicate words - typos - references to old versions of FreeBSD Reviewed by: imp, benno Notes: svn path=/head/; revision=327230
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-202-0/+4
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Renumber copyright clause 4Warner Losh2017-02-283-3/+3
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedEnji Cooper2016-05-041-23/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299094
* MFHGlen Barber2016-03-101-0/+11
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296625
| * DIRDEPS_BUILD: Connect MK_TESTS.Bryan Drewery2016-03-091-0/+11
| | | | | | | | | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296587
* | First pass to fix the 'tests' packages.Glen Barber2016-02-021-0/+4
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295171
* Fix type mismatches for malloc(3) and Co.Ulrich Spörlein2015-12-291-2/+2
| | | | | | | | | | | | This is rather pedantic, as for most architectures it holds that sizeof(type *) == sizeof(type **) Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722 Notes: svn path=/head/; revision=292864
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andEnji Cooper2015-10-121-2/+0
| | | | | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison Notes: svn path=/head/; revision=289172
* Fix the racy xargs -P0 -n2 test added in r286289Enji Cooper2015-08-212-3/+3
| | | | | | | | | | | Sort the output obtained from xargs and the expected output to ensure the end result versus the input file is stable Differential Revision: D3432 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> Notes: svn path=/head/; revision=287005
* Disable the -P0 testEnji Cooper2015-08-211-1/+1
| | | | | | | | | It's unreliable (sometimes it passes, sometimes it fails) Reported by: Jenkins (many times over the past few weeks) Notes: svn path=/head/; revision=287004
* fix regression in xargs -Px (introduced in r286289) and add regression testsAllan Jude2015-08-086-6/+17
| | | | | | | | | | | PR: 202152 Submitted by: jbeich (original), Nikolai Lifanov (final) Reviewed by: jbeich Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D3330 Notes: svn path=/head/; revision=286461
* xargs now takes -P0, creating as many concurrent processes as possibleAllan Jude2015-08-042-3/+19
| | | | | | | | | | | | | | PR: 199976 Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com> Reviewed by: mjg, bjk Approved by: bapt (mentor) MFC after: 1 month Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D2616 Notes: svn path=/head/; revision=286289
* Convert atoi(3) to stronum(3) which allows to arguments and report proper errorsBaptiste Daroussin2015-07-141-6/+13
| | | | | | | | | to the users Obtained from: OpenBSD Notes: svn path=/head/; revision=285552
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802