bugfindutils - Bugs: bug #13878, xargs exits with exitcode 1...

 
 

bug #13878: xargs exits with exitcode 1 instead of 123 if invoked command fails

Submitter:  Andreas Metzler <ametzler>
Submitted:  Thu 21 Jul 2005 05:33:26 PM UTC
   
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Glenn Ammons Open/Closed:  Closed
Release:  4.2.22 Fixed Release:  4.2.24
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 22 Jul 2005 08:47:05 PM UTC, comment #1: 

That was an interesting problem.  The issue is that child_error is changed in wait_for_all() after exit() has already been called on (since we fall off the end of main()).   That means that it's too late by then to change the return value.  As a workaround for this problem we now call _exit() when this happens, passing the correct return value.    It might have been neater to just call wait_for_all() before returning from main().  Anyway, the attached patch (which I have committed to the development code) fixes the problem.


James Youngman <jay>
Group administrator
Thu 21 Jul 2005 05:33:26 PM UTC, original submission:  

Hello,
this is http://bugs.debian.org/319085 reported by Glenn Ammons:

---------------------
xargs exits with the wrong status when the command exits with status 1:

    % false; echo $?
    1
    % echo foo | xargs -t false; echo $?
    false foo
    0

The exit status ought to be 123, according to the man page:

    xargs exits with the following status:
    0 if it succeeds
    123 if any invocation of the command exited with status 1-125
---------------------
I've verifioed that this applies to 4.2.22 and current CVS, 4.120 worked as documented.
             thanks, cu andreas

Andreas Metzler <ametzler>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #3263:  xargs-child-failure-exit-123.patch added by jay (2KiB - text/x-patch - Fix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ametzler (Originator Email)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2005-07-29 jay Open/ClosedOpen Closed
        Fixed ReleaseNone 4.2.24
    2005-07-22 jay StatusNone Fixed
        Assigned toNone jay
        Attached File- Added xargs-child-failure-exit-123.patch, #2734
    2005-07-21 ametzler Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.14-d582.
    Corresponding source code