[libvirt] [PATCH 2/2] virsh: support VISUAL, and allow metacharacters in EDITOR

Matthias Bolte matthias.bolte at googlemail.com
Sat Mar 13 14:35:49 UTC 2010


2010/3/12 Eric Blake <eblake at redhat.com>:
> Common Unix practice is to prefer VISUAL over EDITOR, particularly if
> the editor of choice spawns a new window.  Thus, it is also common to
> see settings like EDITOR='emacs -nw', with the expectation that the
> shell will parse this as an argument to 'emacs' and not try to invoke
> a file containing a space.
>
> If a user puts junk in EDITOR, they deserve what they get (much more
> than virsh will misbehave); furthermore, sudo scrubs EDITOR by
> default.  So the blind use of metacharacters in EDITOR should not be
> considered too much of a security issue.
>
> * tools/virsh.c (editFile): Prefer VISUAL over EDITOR.  Don't
> reject shell metacharacters in EDITOR.
> * tools/virsh.pod (edit, net-edit, ENVIRONMENT): Document VISUAL.
> ---

> @@ -639,10 +639,15 @@ of C<virsh>
>  The hypervisor to connect to by default. Set this to a URI, in the same
>  format as accepted by the B<connect> option.
>
> -=item EDITOR
> +=item VISUAL
>
>  The editor to use by the B<edit> and B<net-edit> options.
>
> +=item EDITOR
> +
> +The editor to use by the B<edit> and B<net-edit> options, if C<VISUAL>
> +is not set.
> +

There is also a pool-edit and iface-edit command.

ACK.

Matthias




More information about the libvir-list mailing list