[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #51151] [wishlist] xargs -o support for interactive commands
From: |
Andreas Metzler |
Subject: |
[bug #51151] [wishlist] xargs -o support for interactive commands |
Date: |
Wed, 31 May 2017 13:37:18 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0 |
URL:
<http://savannah.gnu.org/bugs/?51151>
Summary: [wishlist] xargs -o support for interactive commands
Project: findutils
Submitted by: ametzler
Submitted on: Wed 31 May 2017 07:37:17 PM CEST
Category: xargs
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.6.0
Fixed Release: None
_______________________________________________________
Details:
Report by Thorsten Glaser in https://bugs.debian.org/725392:
The manual page of GNU xargs mentions this:
xargs sh -c 'emacs "$@" < /dev/tty' emacs
Launches the minimum number of copies of Emacs needed, one after
the
other, to edit the files listed on xargs' standard input. This
example
achieves the same effect as BSD's -o option, but in a more flexible
and
portable way.
BSD’s ‘-o’ option is documented thus:
-o Reopen stdin as /dev/tty in the child process before executing
the command. This is useful if you want xargs to run an interac-
tive application.
IMHO, the -o option is much less cumbersome to type/remember, and for
the sake of reverse portability (support applications that _already_
use the BSD variant), and especially given that the GNU maintainers
already know of it, the -o option ought to be added to GNU xargs as
well.
Side effect: avoids launching another shell, and, more importantly
to some, avoids quoting hell.
(That being said, /bin/sh on FreeBSD and derivates thereof has
slightly broken (for hysterical raisins) behaviour when sh -c cmd
is followed by “--” so the portability the GNU maintainers assert
for the sh variant is not exactly true either.)
-------------------------------------------------
That said I (Andreas) am little bit of two minds on this. The issue has come
up before in https://bugs.debian.org/5956
| Consider the following command:
|
| echo bar | (echo foo | xargs --interactive grep)
|
| What should grep's stdin be, /dev/tty or the stdout of "echo
| bar"? Is the answer different for other programs? Why? (I
| won't give my answers; the point is that reasonable people give
| different answers to these questions. Some of the preferred
| answers aren't even doable.)
|
| Mixing batch mode and interactive tools tends to cause problems.
| This situation is one of them. Not giving any stdin is about the
| best you can do, since it gives the least amount of surprises
| by not giving the wrong answer half the time.
|
| However, a new option to xargs that makes xargs read the
| filenames from some other file than stdin, giving stdin to the
| program being run, would be a good thing.
It was the resolved with this change:
| * New upstream version
| - New option --arg-file=file and extended documentation about
| stdin-handling (short in manpage, more extensive in info).
| (Closes: #5956)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51151>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #51151] [wishlist] xargs -o support for interactive commands,
Andreas Metzler <=