Page MenuHomeFreeBSD

fix regression in xargs -Px and add regression tests
ClosedPublic

Authored by allanjude on Aug 7 2015, 1:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 18, 1:04 AM
Unknown Object (File)
Tue, Jun 17, 10:42 PM
Unknown Object (File)
Mon, Jun 16, 4:37 AM
Unknown Object (File)
Tue, Jun 10, 11:04 PM
Unknown Object (File)
Tue, Jun 10, 10:05 AM
Unknown Object (File)
May 26 2025, 3:24 AM
Unknown Object (File)
May 26 2025, 2:26 AM
Unknown Object (File)
May 11 2025, 2:33 PM
Subscribers

Details

Summary

jbeich reported that xargs -Px doesn't work anymore because
of a botched rebase. This is true, but easy to fix. See attached patch.
I also added test cases to xargs to test -P functionality in the future.

There is Bugzilla 202152 about this.

Test Plan

kyua -k /usr/tests usr.bin/xargs

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 11
Build 11: arc lint + arc unit

Event Timeline

lifanov_mail.lifanov.com retitled this revision from to fix regression in xargs -Px and add regression tests.
lifanov_mail.lifanov.com updated this object.
lifanov_mail.lifanov.com edited the test plan for this revision. (Show Details)
jbeich edited edge metadata.
  • Code looks OK but see inline nit.
  • Tests look OK for rS286289 scope as it didn't touch how processes are spawned.

Note, I'm not a src/ committer to have much weight.

usr.bin/xargs/xargs.c
173–174

Unreachable as errstr conditional above already checks valid range:

$ printf 'a\nb\nc\n' | xargs -P -1 echo
xargs: -P -1: too small
This revision is now accepted and ready to land.Aug 7 2015, 2:51 PM
lifanov_mail.lifanov.com edited edge metadata.

You are right, maxprocs < 0 is unreachable

This revision now requires review to proceed.Aug 7 2015, 2:56 PM

You are right, maxprocs < 0 is unreachable. I updated the diff.

In the process of being switched from strtoul() to strtonum(), a check against endptr was not removed, causing xargs to segfault

This patch fixes that, and adds a set of regression tests against the -P flag, that were previously missing.

I would like to commit this, to fix the previous commit.

bapt edited edge metadata.
This revision is now accepted and ready to land.Aug 8 2015, 5:49 PM
allanjude edited reviewers, added: lifanov_mail.lifanov.com; removed: allanjude.
This revision was automatically updated to reflect the committed changes.