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

Eric Blake eblake at redhat.com
Fri Mar 22 20:56:03 UTC 2013


On 03/22/2013 03:34 AM, Christophe Fergeau wrote:
> On Thu, Mar 21, 2013 at 09:43:02PM -0600, Eric Blake wrote:
>> Expanding everything means re-implementing what the shell does.
>> wordexp() would be ideal for this, except that wordexp() is not portable
>> enough.
> 
> Maybe wordexp() could be used on platform which support it, and on
> platforms that do not have it, it would not be used, and env var would not
> be expanded?
> Or do we want to have identical behaviour for virsh on all platforms to
> avoid confusion?

I think the confusion aspect must not be underestimated.  If I write a
virsh script on Linux, and then port it to a Windows machine, I would
still want it to have the same effect on my guests.  But if I relied on
expansions, which happened to work on Linux but are missing on mingw, my
script would change semantics.

Also, we strive hard to avoid backward-incompatible changes; a script
that was written before expansions, but which used unquoted '$', should
still work after expansions are added.  Maybe we could make expansions
be off by default, and provide a new virsh command to opt-in; but at
that point, we are back to the question of why not script the shell to
do it in the first place.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130322/e3764377/attachment-0001.sig>


More information about the libvir-list mailing list