bugfindutils - Bugs: bug #38658, If the command exec() fails, xargs...

 
 

bug #38658: If the command exec() fails, xargs terminates prematurely

Submitter:  Ivan Zahariev <famzah>
Submitted:  Thu 04 Apr 2013 11:52:23 AM UTC
   
 
Category:  documentation Severity:  3 - Normal
Item Group:  Wrong result Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.4.2 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 05 Nov 2013 09:29:16 AM UTC, comment #4: 

xargs exits immediatly when you simulate exitcodes 124, 125, 126, 127. what for is that? in my opinion unsusable.

for backwards compatibility it should be new option to xargs that will make continue running if it is sense. a lot of commands returns 255. for example SVN client when repo is unavailable.

Grzegorz Szyszlo <znik>
Thu 04 Apr 2013 01:11:01 PM UTC, comment #3: 
Dmitry V. Levin <ldv>
Thu 04 Apr 2013 01:05:43 PM UTC, comment #2: 

This info isn't present in the Ubuntu man page. All I see there regarding this matter is:

If any invocation of the command exits with a status of 255,
xargs will stop immediately without reading any further input.
An error message is issued on stderr when this happens.


Is this an Ubuntu/Debian bug in the man page?

Please also provide a URL link to the official POSIX web page/document that you quoted.

Ivan Zahariev <famzah>
Thu 04 Apr 2013 12:31:56 PM UTC, comment #1: 

POSIX states: "If a command line meeting the specified requirements cannot be assembled, the utility cannot be invoked, an invocation of the utility is terminated by a signal, or an invocation of the utility exits with exit status 255, the xargs utility shall write a diagnostic message and exit without processing any remaining input."

That is, the behavior you expect would violate the standard.

Dmitry V. Levin <ldv>
Thu 04 Apr 2013 11:52:23 AM UTC, original submission:  

Here is an example:

$ echo 1 2 3 4 5 6 | xargs -n 1 badexec-name
xargs: badexec-name: No such file or directory


What I expect is that "xargs" tries to execute "badexec-name" for every command line argument from "1" to "6". Total of six execution tries. Similar to the following concept:

$ echo 1 2 3 4 5 6 | xargs -n 1 rm
rm: cannot remove `1': No such file or directory
rm: cannot remove `2': No such file or directory
rm: cannot remove `3': No such file or directory
rm: cannot remove `4': No such file or directory
rm: cannot remove `5': No such file or directory
rm: cannot remove `6': No such file or directory


Being unable to exec() a binary shouldn't be handled in a special way by stopping to process the incoming command-line arguments, and exiting prematurely. A call to exec() could fail for many reasons and some of them are non-permanent, meaning that the next call to exec() for the same command could be successful.

Ivan Zahariev <famzah>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  • -email is unavailable- added by znik (Posted a comment)
  • -email is unavailable- added by ldv (Posted a comment)
  • -email is unavailable- added by famzah (Submitted the item)
  •  

    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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-18 jay Categoryxargs documentation

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code