[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bugs #7340] xargs -n does not execute commands in a timely manner
From: |
James Youngman |
Subject: |
[bugs #7340] xargs -n does not execute commands in a timely manner |
Date: |
Sun, 05 Dec 2004 12:24:51 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5 |
This mail is an automated notification from the bugs tracker
of the project: findutils.
/**************************************************************************/
[bugs #7340] Latest Modifications:
Changes by:
James Youngman <address@hidden>
'Date:
Sun 12/05/04 at 17:18 (GMT)
What | Removed | Added
---------------------------------------------------------------------------
Assigned to | None | jay
Status | Open | Closed
Fixed Release | None | 4.2.9
------------------ Additional Follow-up Comments ----------------------------
You can download a release of findutils in which this problem is
fixed from ftp://alpha.gnu.org/gnu/findutils.
The releases on alpha.gnu.org are for testing purposes, so please
take the time to download the release and verify that your
problem has been solved. Once the release has been sufficiently
tested, it can be uploaded to ftp.gnu.org for everybody to use it.
/**************************************************************************/
[bugs #7340] Full Item Snapshot:
URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=7340>
Project: findutils
Submitted by: Stewart Brodie
On: Tue 01/20/04 at 14:15
Category: xargs
Severity: 5 - Average
Item Group: None
Resolution: Fixed
Privacy: Public
Assigned to: jay
Originator Name:
Originator Email:
Status: Closed
Release: None
Fixed Release: 4.2.9
Summary: xargs -n does not execute commands in a timely manner
Original Submission: When the number of parameters to the xargs subcommand is
limited by using -n <num>, xargs does not execute the subcommand until it has
seen the end of the input stream OR num+1 arguments. This can result in
unnecessary delays in execution where the command to be executed is known (it
has seen num args) since it isn't actually executed until more arguments are
discovered (or the input stream ends).
A (lame, but the best I could think of right now) example which assumes date
outputs 6 words:
$ for i in 1 2 3 4; do date;date;sleep 3; done | xargs -n 6
Example output from this is shown below, with me inserting <delay 3 seconds>
where the 3 second delays occur:
Tue Jan 20 14:09:35 GMT 2004
<delay 3 seconds>
Tue Jan 20 14:09:35 GMT 2004
Tue Jan 20 14:09:38 GMT 2004
<delay 3 seconds>
Tue Jan 20 14:09:38 GMT 2004
Tue Jan 20 14:09:41 GMT 2004
<delay 3 seconds>
Tue Jan 20 14:09:41 GMT 2004
Tue Jan 20 14:09:44 GMT 2004
<delay 3 seconds>
Tue Jan 20 14:09:44 GMT 2004
There is no apparent reason why the delays are occurring where they are - the
second echo should be being executed as soon as 6 parameters are available, no?
I don't think that the current behaviour is desirable (and it's a nuisance for
my use of it).
I've tested this against findutils 4.1.7, but I've examined the latest
(revision 1.17 of xargs/xargs.c) in CVS and it hasn't changed in this regard.
I think it would be fairly easy to fix this behaviour by inserting a check for
reaching max_args near the end of the push_arg function after the new
(non-NULL) argument has been added to the argument array, and calling do_exec
immediately if the limit has been reached.
But I'm not certain, hence I'm not supplying a proposed patch at the moment.
Does anybody else agree?
Follow-up Comments
------------------
-------------------------------------------------------
Date: Sun 12/05/04 at 17:18 By: James Youngman <jay>
You can download a release of findutils in which this problem is
fixed from ftp://alpha.gnu.org/gnu/findutils.
The releases on alpha.gnu.org are for testing purposes, so please
take the time to download the release and verify that your
problem has been solved. Once the release has been sufficiently
tested, it can be uploaded to ftp.gnu.org for everybody to use it.
-------------------------------------------------------
Date: Wed 11/24/04 at 17:01 By: James Youngman <jay>
This problem is fixed in the CVS code for findutils.
To resolve your problem, you could either wait for the
next official release of findutils, or check out a copy
of the code from the CVS repository for findutils.
-------------------------------------------------------
Date: Mon 11/01/04 at 10:47 By: Stewart Brodie <sbrodie>
I disagree. I have improved testit.sh to more clearly demonstrate the problem.
It now has two echo commands with a sleep between them. The first echo
provides enough parameters for xargs to run immediately before the sleep
occurs. It doesn't actually execute until the echo after the sleep has
executed.
I have tested and reproduced this behaviour against both versions 4.1.7 and
4.2.3.
-------------------------------------------------------
Date: Sat 10/16/04 at 20:20 By: James Youngman <jay>
I have just retested this problem in findutils 4.2.0 with the "testit.sh"
script (attached). It looks right to me, could you comment on whether you
agree?
File Attachments
-------------------
-------------------------------------------------------
Date: Mon 11/01/04 at 10:47 Name: test_sb.sh Size: 86B By: sbrodie
Simple shell script demonstrating the delay
http://savannah.gnu.org/bugs/download.php?item_id=7340&item_file_id=1825
-------------------------------------------------------
Date: Sat 10/16/04 at 20:20 Name: testit.sh Size: 179B By: jay
http://savannah.gnu.org/bugs/download.php?item_id=7340&item_file_id=1767
For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=7340>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bugs #7340] xargs -n does not execute commands in a timely manner,
James Youngman <=