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
F103125964: D3330.diff
Thu, Nov 21, 8:33 AM
Unknown Object (File)
Tue, Nov 19, 6:25 PM
Unknown Object (File)
Fri, Nov 15, 10:09 AM
Unknown Object (File)
Mon, Nov 4, 10:47 PM
Unknown Object (File)
Mon, Nov 4, 7:41 PM
Unknown Object (File)
Sat, Nov 2, 2:41 AM
Unknown Object (File)
Wed, Oct 30, 1:51 AM
Unknown Object (File)
Oct 16 2024, 3:22 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 Not Applicable
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.