bugfindutils - Bugs: bug #49466, xargs with 2>&1 returns...


bug #49466: xargs with 2>&1 returns error code in macOS 10.12

Submitted by:  None
Submitted on:  Fri 28 Oct 2016 08:19:31 AM UTC  
Category: xargsSeverity: 3 - Normal
Item Group: Wrong resultStatus: None
Privacy: PublicAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: OpenRelease: 4.6.0
Fixed Release: None

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Sun 23 Jul 2017 11:54:03 PM UTC, comment #6:

This issue appears to be fixed: it no longer reproduces for me with macOS 10.12.6. I suspect it was caused by the same underlying behavior change to poll described here: https://github.com/curl/curl/issues/1057 (fixed in 10.12.2).

Michael Cahill <michaelcahill>
Sun 23 Jul 2017 09:28:15 PM UTC, comment #5:

Could you provide a system call trace?

James Youngman <jay>
Project Administrator
Tue 07 Feb 2017 03:21:03 AM UTC, comment #4:

This only appears on MaxOS 10.12.

Tue 22 Nov 2016 01:00:52 PM UTC, comment #3:

I could not reproduce this problem with findutils-4.6.0 freshly-built with LLVM 6.1.0 on Mac OS X 10.11.6. Therefore, the system call trace output Bernhard mentions is our best next step for understanding what is happening.

AIUI the relevant tool on Mac OS X is "trace -E" rather than "strace" but I'm not familiar with it. Another good option is to investigate with a debugger.

James Youngman <jay>
Project Administrator
Tue 22 Nov 2016 03:51:55 AM UTC, comment #2:

I'm seeing the same thing, here is the stack trace as reported by Apple's crash reporter:

This change avoids the crash by not checking the file descriptors for stdin, stdout or stderr, but tbh I can't follow all of what's going on in there:

I hope that helps,

Michael Cahill <michaelcahill>
Fri 28 Oct 2016 02:16:08 PM UTC, comment #1:

I don't see any reason for xargs to fail here; it doesn't even
see the "2>&1" redirection as the shell is evaluating this.
In effect, this should be identical to

echo a | /usr/local/bin/xargs > /dev/null 2> /dev/null

So the reason could be a bug in your shell, or the file /dev/null
(which is usually a special character device to discard any input,
or still xargs. You could run xargs under investigation of a tool
like 'strace' (which I don't know whether it is available on MacOS)
to see a bit more what happens:

echo a | strace -o xargs.trace /usr/bin/xargs > /dev/null 2>&1 ; echo $?

The output in 'xargs.trace' would be quite interesting.

Thanks & have a nice day,

Bernhard Voelker <berny>
Project Member
Fri 28 Oct 2016 08:19:31 AM UTC, original submission:

[sunrunaway:~]$ echo a | /usr/bin/xargs > /dev/null 2>&1 ; echo $?
[sunrunaway:~]$ echo a | /usr/local/bin/xargs > /dev/null 2>&1 ; echo $?



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #38827:  QQ20161028-0.png added by None (267KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by jay (Posted a comment)
  • -unavailable- added by michaelcahill (Posted a comment)
  • -unavailable- added by berny (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 28 Oct 2016 08:19:31 AM UTCNoneAttached File-=>Added QQ20161028-0.png, #38827

    Back to the top

    Powered by Savane 3.1-cleanup1