[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/21/2013 04:20 AM, Daniel P. Berrange wrote:
> On Thu, Mar 21, 2013 at 05:00:58PM +0800, Zhang Xiaohe wrote:
>> This patch makes '~' and '$HOME' can be recognized by virsh in
>> interactive mode. These two variables are replaced with real
>> path.
> 
> If we're going to the trouble of expanding $HOME, then we might
> as well just make it expand arbitrary environment variables
> rather than hardcoding $HOME.

In other words, if we're going to do this, go all the way and use
wordexp() to get shell-like expansion, instead of reinventing it
ourselves.  Except that wordexp() is not portable to mingw, and not
provided in gnulib.

> 
> Also, we'll need a way to escape the special meaning of '~'
> and '$' to get them treated as literal characters instead of
> special characters.

We already have the ability to quote characters, so that we can embed
spaces; our quoting rules are (intentionally) copied on shell rules, so
they would still work with a wordexp() approach.

-- 
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]