Files
findutils/xargs
Bernhard Voelker 169161fa0e xargs: wait for process before prompting in interactive mode (-p)
In interactive mode, there is a race between xargs prompting
about the next command to be run, vs. the execution of the
echo command:

  $ echo 1 2 | xargs -n 1 -p
  /bin/echo 1 ?...y
  /bin/echo 2 ?...1
  y
  2

This behavior violates POSIX:
(http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html):

  The xargs utility shall then invoke the constructed command line
  and wait for its completion. This sequence shall be repeated until
  one of the following occurs: [...]

* xargs/xargs.c (xargs_do_exec): Move the code for waiting for forked
processes up, so that the child process terminates before we prompt
for the next command.
* NEWS: Mention the fix.

Reported by jidanni@jidanni.org in
http://lists.gnu.org/archive/html/bug-findutils/2013-07/msg00015.html
2013-09-21 23:18:19 +01:00
..