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
F86206417: D3330.id7785.diff
Mon, Jun 17, 12:06 AM
Unknown Object (File)
Fri, May 31, 8:13 AM
Unknown Object (File)
Thu, May 23, 3:14 PM
Unknown Object (File)
Tue, May 21, 4:29 AM
Unknown Object (File)
May 14 2024, 5:51 AM
Unknown Object (File)
May 11 2024, 12:48 AM
Unknown Object (File)
Apr 26 2024, 5:27 AM
Unknown Object (File)
Apr 26 2024, 5:19 AM
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.