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

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

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

Attachment: signature.asc
Description: OpenPGP digital signature

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