Bug 267111 - xargs returns incorrect exit code when run in parallel mode
Summary: xargs returns incorrect exit code when run in parallel mode
Status: Closed DUPLICATE of bug 267110
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-16 05:09 UTC by Du Liu
Modified: 2022-10-16 05:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Du Liu 2022-10-16 05:09:15 UTC
when xargs runs in parallel mode (using -P flag), it may sometimes return incorrect exit code. 

The following code shows current (incorrect) behaviour: /bin directory exists, /foo directory does not exist. `echo /bin /foo | xargs -n1 -P2 test -d` sometimes return 0 sometimes return 1:

```
root@freebsd:~ # test -d /bin
root@freebsd:~ # echo $?
0
root@freebsd:~ # test -d /foo
root@freebsd:~ # echo $?
1
root@freebsd:~ # echo /bin /foo | xargs -n1 -P2 test -d
root@freebsd:~ # echo $?
0
root@freebsd:~ # echo /bin /foo | xargs -n1 -P2 test -d
root@freebsd:~ # echo $?
1
root@freebsd:~ # echo /bin /foo | xargs -n1 -P2 test -d
root@freebsd:~ # echo $?
0
```
Comment 1 Du Liu 2022-10-16 05:23:17 UTC
sorry, this is a duplicated

*** This bug has been marked as a duplicate of bug 267110 ***