URL:
  <http://savannah.gnu.org/bugs/?20273>

                 Summary: xargs -E consumes too much input
                 Project: findutils
            Submitted by: ericb
            Submitted on: Tuesday 06/26/2007 at 16:17
                Category: xargs
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: Needs Assignment
                 Privacy: Public
             Assigned to: None
         Originator Name: Eric Blake
        Originator Email: [EMAIL PROTECTED]
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.1.20
           Fixed Release: None

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?20273>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-findutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-findutils

Reply via email to