Page MenuHomeFreeBSD

fix regression in xargs -Px and add regression tests
ClosedPublic

Authored by allanjude on Aug 7 2015, 1:35 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

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
174 ↗(On Diff #7754)

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.