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)
Sun, Nov 19, 12:14 PM
Unknown Object (File)
Mon, Nov 13, 11:10 AM
Unknown Object (File)
Oct 25 2023, 5:40 AM
Unknown Object (File)
Sep 15 2023, 3:34 PM
Unknown Object (File)
Sep 5 2023, 3:51 AM
Unknown Object (File)
Aug 29 2023, 5:11 PM
Unknown Object (File)
Aug 18 2023, 6:44 AM
Unknown Object (File)
Aug 10 2023, 7:40 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.