Project

General

Profile

Bug #10216

xargs does not properly detect when -P is negative

Added by Robert Mustacchi 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
2019-01-11
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

While testing some other changes, I noticed that the util-test test suite was failing in xargs. Specifically it was failing test 19 which is where we call xargs -P -3. This was happily driving on. I suspect that the code was relying on the idea that strtoul of -3 would fail. Instead, it actually happily converts it to a rather high value when it should be an error.

This instead changes it to check for a signed value and error appropriately. We also properly document what xargs -P 0 means.

History

#1

Updated by Electric Monk 9 months ago

  • Status changed from New to Closed

git commit 7c71d71894ca896e2718a24b51b39b0e5f9c27e6

commit  7c71d71894ca896e2718a24b51b39b0e5f9c27e6
Author: Robert Mustacchi <rm@joyent.com>
Date:   2019-01-16T18:55:22.000Z

    10216 xargs does not properly detect when -P is negative
    Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Reviewed by: Andy Fiddaman <af@citrus-it.net>
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF