Re: [PATCH] Make virsh support '~' and '$HOME' in interactive mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/21/2013 09:18 PM, Zhang Xiaohe wrote:

> Originally, I think '~' and '$HOME' is most commonly used, so it should
> be acceptable to just expand these.
> But now I'm confused. You said
>> if we're going to do this, go all the way

Expanding just '~' and '$HOME' but nothing else is a disservice to the
user.  If we're going to expand anything, then we should be consistent
and allow for the expansion of all variables.

> and
>> Interactive virsh does not need to be a full-blown shell.
> I'm not sure but are you suggesting that "no need to add this expansion" ?

Expanding everything means re-implementing what the shell does.
wordexp() would be ideal for this, except that wordexp() is not portable
enough.  By the time we end up rewriting enough code to do what
wordexp() already could do, we are adding lots of bloat into virsh to
make it mimic what /bin/sh can already do.

Ergo, I think that this patch idea is not worth it.  If a user wants
shell expansions, they should let the shell do it, when building up the
virsh command line.  That is, instead of trying to do expansions in a
virsh interactive session:

$ virsh
virsh# echo $HOME

you should just let the shell do it beforehand:

$ virsh "echo $HOME"

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]