On Mon, 2 Apr 2018 23:46:17 -0400 Boruch Baum <boruch_b...@gmx.com> wrote:
> Subject: moreutils: vidir does not accept variable assignments in $EDITOR
> Package: moreutils
> Version: 0.60-1
> Severity: normal
>
> Dear Maintainer,
>
> vidir exits with exit code 2 and the message "exited nonzero,
> aborting" when $EDITOR includes a variable assignment prefix such as
> the following:
>
> TERM=xterm-256color emacsclient -nw -c --alternate-editor=""

I think you see this because vidir doesn't do real parsing of the
$EDITOR/$VISUAL command line but only splits it on whitespace and pass it
to system(). This means it can't handle quotes properly like the shell
would. Here's a test case illustrating this:

$> export VISUAL='printf %s\n "two words" "" arg'

If vidir inkoved this command line correctly, the output would be like the
following:
----
two words

arg
----

But this what I get:

$> vidir .
"two
words"
""
arg
<path-to-vidir-temp-file>

So the quotes are passed as literal '"' instead of being stripped and
quoted values with spaces are split.

I believe something like what  Parse::CommandLine (
https://metacpan.org/pod/Parse::CommandLine) does is needed.

-- Gustav

Reply via email to