[PATCH] Use eval() to shell-parse $EDITOR for pass-edit

Allan Odgaard lists+pass at simplit.com
Thu Nov 28 22:15:24 CET 2019

On 28 Nov 2019, at 22:00, Tobias Girstmair wrote:

> On Fri, Nov 29, 2019 at 09:51:42AM +1300, martin f. krafft wrote:
>> That's all I have in /usr/bin here ;)
> I've got /usr/bin/i3-sensible-editor and it _does_ eval it (not that i 
> have a strong opinion on this topic):
>    for editor in "$VISUAL" "$EDITOR" nano nvim vim vi emacs pico qe mg 
> jed gedit mcedit gvim; do
> 	if command -v "$editor" > /dev/null 2>&1; then
> 	    exec "$editor" "$@"
> 	fi
>    done

I don’t know what the above is, but that does not use `eval` and it 
doesn’t even seem to support arguments as part of the `EDITOR` 
variable (as it uses quotes for the variable expansion, so `command` 
will see the command with arguments as a single shell word and fail).

`crontab` also does not support arguments as part of the `EDITOR` 
variable, but everything else that I am aware of does.

I have not seen anything use `eval` and I think it’s a bad idea 
because it’s not a specification, it’s just “run it as a shell 
line” which can have different meaning depending on the shell.

Definitely the proper solution is to have `EDITOR` point to a shell 
script rather than try to treat the `EDTIOR` variable as an inline shell 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20191128/4a2d0ec9/attachment.html>

More information about the Password-Store mailing list