Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ${EDITOR} with spaces (was: Re: [PATCH] initialization of main keymap)



On 2022-09-04 12:48:20 +0200, Mikael Magnusson wrote:
> On 9/4/22, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > Vincent Lefevre wrote on Fri, Sep 02, 2022 at 15:15:33 +0200:
> >> Yes, the current behavior (with or without the patch) is definitely
> >> incorrect. For instance, https://unix.stackexchange.com/a/4861/74516
> >> suggests to set VISUAL to the full-screen editor, and either leave
> >> EDITOR unset or set it to "vi -e" (just in case a special line mode
> >> would be needed in some context). So a user who would use VISUAL=emacs
> >> and EDITOR="vi -e" would probably be annoyed by the current behavior.
> >
> > Is $EDITOR meant to be used in a system(3) manner, as «system("${EDITOR}
> > ${(q-)filename}")»,
> > or in an execve(2) manner, as «execl($EDITOR, $EDITOR, $filename)»?
> > (plus or minus a «--» guard in both cases)
> 
> In practice, if you want $EDITOR to contain options to your editor,
> you have to make a wrapper script and put it in a path without spaces,
> because programs all assume different answers to your question.

Indeed, for EDITOR, under "mailx", POSIX says "name of a utility"
and not "command". This is a bit unclear about the possibility of
full pathnames, but under "more", POSIX says "If the last pathname
component in EDITOR is either vi or ex, [...]" so it is now clear
that EDITOR may contain a full pathname (there wasn't any practical
reason for a restriction).

For VISUAL, POSIX says "pathname of a utility".

So, in both cases, options should not be accepted, i.e. spaces
should be regarded as part of the name (though I wonder whether
this is portable in practice).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author