Description of problem: virsh can't use '~' in interactive mode Version-Release number of selected component (if applicable): libvirt-client-0.9.10-6.el6.x86_64 libvirt-python-0.9.10-6.el6.x86_64 libvirt-0.9.10-6.el6.x86_64 How reproducible: 100% Steps to Reproduce: [root@daisy tmp]# virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # pwd /tmp virsh # attach-device rhel6.3 ../root/interface.xml Device attached successfully virsh # detach-device rhel6.3 ../root/interface.xml Device detached successfully virsh # attach-device rhel6.3 ~/interface.xml error: Failed to open file '~/interface.xml': No such file or directory virsh # save rhel6.3 ~/rhel6.3.save error: Failed to save domain rhel6.3 to ~/rhel6.3.save error: Failed to create file '/tmp/~/rhel6.3.save': Operation not permitted virsh # save win2008 $HOME/win2008.save error: Failed to save domain win2008 to $HOME/win2008.save error: Failed to create file '/tmp/$HOME/win2008.save': Operation not permitted virsh # Actual results: virsh do not support '~' ‘$HOME’ Expected results: support '~' ‘$HOME’ Additional info: This kind of usage is very common and many interactive command support this(like ftp)
Some info from Eric: ~ expansion is normally done by the shell, but only in certain positions on the command line. It might be worth teaching virsh how to do ~ expansion, since those arguments don't fall under the shell's rules. ~ expansion is just shorthand for $HOME. no-interactive mode works: [root@zhpeng ~]# virsh save win2008 $HOME/win2008.save Domain win2008 saved to /root/win2008.save [root@zhpeng ~]# virsh save win2008 ~/win2008.save Domain win2008 saved to /root/win2008.save
eh, I don't know... virsh is not a real shell, $ variables don't work work, you can't pipe, etc. why make an exception for '~' ? if someone provided a patch for this I'm sure we would take it but it doesn't belong in the bug tracker IMO