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

2013-03-22 Thread Christophe Fergeau
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

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

2013-03-22 Thread Eric Blake
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

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

2013-03-21 Thread Zhang Xiaohe
This patch makes '~' and '$HOME' can be recognized by virsh in interactive mode. These two variables are replaced with real path. eg: virsh # pwd /home/libvirt virsh # cd ~/rpmbuild virsh # pwd /root/rpmbuild see https://bugzilla.redhat.com/show_bug.cgi?id=806793 Signed-off-by: Zhang Xiaohe

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

2013-03-21 Thread Daniel P. Berrange
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

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

2013-03-21 Thread Eric Blake
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,

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

2013-03-21 Thread Zhang Xiaohe
于 2013年03月21日 21:08, Eric Blake 写道: On 03/21/2013 04:20 AM, Daniel P. Berrange wrote: 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

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

2013-03-21 Thread Eric Blake
On 03/21/2013 07:33 PM, Zhang Xiaohe wrote: 于 2013年03月21日 21:08, Eric Blake 写道: On 03/21/2013 04:20 AM, Daniel P. Berrange wrote: 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

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

2013-03-21 Thread Zhang Xiaohe
于 2013年03月22日 10:17, Eric Blake 写道: On 03/21/2013 07:33 PM, Zhang Xiaohe wrote: 于 2013年03月21日 21:08, Eric Blake 写道: On 03/21/2013 04:20 AM, Daniel P. Berrange wrote: 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

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

2013-03-21 Thread Eric Blake
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

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

2013-03-21 Thread Zhang Xiaohe
于 2013年03月22日 11:43, Eric Blake 写道: 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