bugfindutils - Bugs: bug #20273, xargs -E and find -ok consume too...

 
 

bug #20273: xargs -E and find -ok consume too much seekable input

Submitter:  Eric Blake <ericb>
Submitted:  Tue 26 Jun 2007 10:17:13 PM UTC
   
 
Category:  xargs Severity:  3 - Normal
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  ericb
Originator Name:  Eric Blake Open/Closed:  Closed
Release:  4.1.20 Fixed Release:  4.3.9
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 08 Sep 2007 12:50:15 PM UTC, comment #6: 

Yes, this is fixed on both 4.2.31+ and 4.3.8+, and is just waiting for a release.

Eric Blake <ericb>
Group administrator
Sat 08 Sep 2007 12:47:55 PM UTC, comment #5: 

Eric fixed this in the 4.3.x tree; I guess this bug could be marked fixed.

James Youngman <jay>
Group administrator
Fri 17 Aug 2007 09:26:17 PM UTC, comment #4: 

On the other hand, rather than making find use the closein module, I decided it was easier to fix yesno within gnulib proper (that way, the same bug in mv, rm, cp, etc. is fixed at the same time).  Once I write a testcase and check in the patch here:
http://www.nabble.com/yesno-module-consumes-too-much-input-tf4287835.html

then findutils will only need a patch to ./import-gnulib.config to pick up the gnulib patch, and touchup of the NEWS wording.

Eric Blake <ericb>
Group administrator
Fri 17 Aug 2007 06:26:46 PM UTC, comment #3: 

find -ok suffers from the same fate; so it looks like I will need to patch find to use closein, just like I have already patched xargs.

Eric Blake <ericb>
Group administrator
Thu 28 Jun 2007 01:11:34 PM UTC, comment #2: 

I've applied http://lists.gnu.org/archive/html/findutils-patches/2007-06/msg00035.html for CVS head, and am now working on backporting it to the branch (which involves updating the branch's use of gnulib from 2007-02-24 to at least 2007-06-09).

Eric Blake <ericb>
Group administrator
Wed 27 Jun 2007 12:57:21 PM UTC, comment #1: 

I verified that the bug is still present all the way through 4.3.8, so I'm marking this bug confirmed.

Eric Blake <ericb>
Group administrator
Tue 26 Jun 2007 10:17:13 PM UTC, original submission:  

POSIX requires the following behavior when stdin is seekable:

$ cat blah
1
2
3
$ (xargs -E2 echo; cat) < blah
1
3
$

On systems where exit() does not follow the POSIX rule of restoring seekable input streams back to the next unread character, xargs fails to reset the seekable stream, leading to this result (tested on a Linux machine with glibc 2.3 and xargs 4.1.20):

$ (xargs -E2 echo; cat) < blah
1
$

Although I haven't yet had time to test that the latest findutils still has the bug on this particular Linux machine, I suspect the bug will remain until the point that xargs switches to using the gnulib closein module (it currently only uses the closeout module, which leaves stdin alone).

Machines like Solaris or recent cygwin (1.5.24 or later) do not have this bug, because exit() implies fflush(stdin) which obeys POSIX in this regard.

Eric Blake <ericb>
Group administrator

 

(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 (Posted a comment)
  • -email is unavailable- added by ericb (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.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-11-11 jay Open/ClosedOpen Closed
        Fixed ReleaseNone 4.3.9
    2007-09-08 ericb StatusIn Progress Fixed
    2007-08-17 ericb Summaryxargs -E consumes too much seekable input xargs -E and find -ok consume too much seekable input
    2007-08-17 ericb StatusFixed In Progress
    2007-06-28 ericb StatusConfirmed Fixed
    2007-06-27 ericb StatusNeeds Copyright Assignment Confirmed
        Assigned toNone ericb
        Summaryxargs -E consumes too much input xargs -E consumes too much seekable input

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code