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

 
 

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

Submitted by:  Andreas Metzler <ametzler>
Submitted on:  Thu 21 Jul 2005 05:33:26 PM UTC  
 
Category: xargsSeverity: 3 - Normal
Item Group: Wrong resultStatus: Fixed
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: Glenn AmmonsOpen/Closed: Closed
Release: 4.2.22Fixed Release: 4.2.24

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
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
  • -unavailable- added by ametzler (Originator Email)
  •  

    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):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 29 Jul 2005 10:27:23 PM UTCjayOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.2.24
    Fri 22 Jul 2005 08:47:05 PM UTCjayStatusNone=>Fixed
      Assigned toNone=>jay
      Attached File-=>Added xargs-child-failure-exit-123.patch, #2734
    Thu 21 Jul 2005 05:33:26 PM UTCametzlerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1