Discussion:
sdiff: subsidiary program 'emacsclient -c -nw' not found
(too old to reply)
Faru Guredo
2014-10-13 23:42:34 UTC
Permalink
I am using ‘emacsclient -c -nw’ as my $EDITOR, and today I found that
etc-update utility can’t open $EDITOR because of the error message in the
subject.
Paul Eggert
2014-10-14 05:33:26 UTC
Permalink
Post by Faru Guredo
I am using ‘emacsclient -c -nw’ as my $EDITOR
EDITOR is supposed to be a program, not a program with arguments. Create a
shell script called 'foo' that does what you want and set EDITOR to 'foo'.
Faru Guredo
2014-10-14 11:23:04 UTC
Permalink
Post by Paul Eggert
EDITOR is supposed to be a program, not a program with arguments.
Neither POSIX-2008 nor any other standard I know doesn’t specify what
EDITOR should contain.
Post by Paul Eggert
Create a shell script called 'foo' that does what you want and set EDITOR
to 'foo'.
That’s a hacky solution. And Occam doesn’t like it. I have to drag ‘~/bin’
folder or something like that for root just because stupid programs don’t
recognize programs and programs with keys. What will it lead to then?
Second variable in environment that can contain $EDITOR with keys?

Thanks for the reply, anyway.
Post by Paul Eggert
Post by Faru Guredo
I am using ‘emacsclient -c -nw’ as my $EDITOR
EDITOR is supposed to be a program, not a program with arguments. Create
a shell script called 'foo' that does what you want and set EDITOR to 'foo'.
Eric Blake
2014-10-14 13:23:49 UTC
Permalink
[adding the Austin Group]
Post by Paul Eggert
EDITOR is supposed to be a program, not a program with arguments.
And I've seen more programs that pass $EDITOR to the shell unquoted,
specifically to allow such arguments, than programs that do not do so.
I think sdiff is in the minority here for trying to pass "$EDITOR" as a
single shell word, so _I_ would agree with the change, but I'm not the
maintainer. On the other hand, I just experimented on my system (Fedora
20); POSIX specifies that both crontab and more will honor EDITOR, but
in my testing, crontab allowed arguments while more tried to treat it as
a single shell word.

(I help maintain a program 'virsh' for my day job, and I changed that to
intentionally honors EDITOR with arguments several years ago [1], but as
that is not a standard program, you can discount that anecdote by
considering me to be biased)

[1] libvirt.org/git/?p=libvirt.git;a=commitdiff;h=f3661756
Neither POSIX-2008 nor any other standard I know doesn’t specify what
EDITOR should contain.
POSIX _does_ give a hint about it:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html

"Invoke an editor to edit the current file being examined. If standard
input is being examined, the results are unspecified. The name of the
editor shall be taken from the environment variable EDITOR, or shall
default to vi. If the last pathname component in EDITOR is either vi or
ex, the editor shall be invoked with a -c linenumber command line
argument, where linenumber is the line number of the file line
containing the display line currently displayed as the first line of the
screen. It is implementation-defined whether line-setting options are
passed to editors other than vi and ex."

which implies that EDITOR typically ends in a pathname component, not in
arguments, if 'more' is supposed to use 'basename($EDITOR)' as its
determination of whether to pass '-c linenumber' as additional
arguments. But it is worth raising a defect to the Austin Group (the
people in charge of POSIX) if you think the standard should give more
details and either explicitly allow or deny the interpretation of EDITOR
as a program with arguments.

It would certainly be worth opening a bug report at
http://austingroupbugs.net/bug_report_page.php, but I don't have a good
feel for whether the behavior of treating EDITOR with arguments should
be allowed, forbidden, or left implementation-defined on a per-usage basis.
Post by Paul Eggert
EDITOR is supposed to be a program, not a program with arguments. Create
a shell script called 'foo' that does what you want and set EDITOR to 'foo'.
This solution will always work, no matter what POSIX says about EDITOR.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Andreas Schwab
2014-10-14 16:33:52 UTC
Permalink
Post by Eric Blake
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html
Also:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mailx.html

"Edit the given messages. The messages shall be placed in a temporary
file and the utility named by the EDITOR variable is invoked to edit
each file in sequence."

Contrast with:

"LISTER
Determine a string representing the command for writing the contents of
the folder directory to standard output when the folders command is
given (see folders in Commands in mailx). Any string acceptable as a
command_string operand to the sh -c command shall be valid."

Andreas.
--
Andreas Schwab, ***@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Loading...