Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
As part of the rebase to libvirt 0.8.7 in RHEL 6.1, libvirt gained the ability to have better support for guests with spaces in their names. However, this support is incomplete, and an attempt to snapshot such a domain causes a shell syntax error.
Version-Release number of selected component (if applicable):
v0.8.7-6.el6
How reproducible:
100%
Steps to Reproduce:
1. create and run a guest named "a b" (note: virt-manager might not allow this, so it may require manual creation of an xml file and 'virsh define file.xml')
2. try 'virsh managedsave "a b"
Actual results:
/var/log/libvirt/qemu/a\ b.log:
sh: -c: line 0: syntax error near unexpected token `b'
sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; }
Expected results:
should work
Additional info:
Reported and patched upstream:
https://www.redhat.com/archives/libvir-list/2011-February/msg00360.html
commit f370fc37f964984ba40584dab1de340ce7e44bac
Author: Philipp Hahn <hahn>
Date: Fri Feb 11 13:59:11 2011 +0100
qemu: Fix escape_monitor(escape_shell(command))
Suspending a VM which contains shell meta characters doesn't work with
libvirt-0.8.7:
/var/log/libvirt/qemu/andreas_231-ne\ doch\ nicht.log:
sh: -c: line 0: syntax error near unexpected token `doch'
sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; }
Although target="andreas_231-ne doch nicht" contains shell meta
characters (here: blanks), they are not properly escaped by
src/qemu/qemu_monitor_{json,text}.c#qemuMonitor{JSON,Text}MigrateToFile()
First, the filename needs to be properly escaped for the shell, than
this command line has to be properly escaped for qemu again.
For this to work, remove the old qemuMonitorEscapeArg() wrapper, rename
qemuMonitorEscape() to it removing the handling for shell=TRUE, and
implement a new qemuMonitorEscapeShell() returning strings using single
quotes.
Using double quotes or escaping special shell characters with backslashes
would also be possible, but the set of special characters heavily
depends on the concrete shell (dsh, bash, zsh) and its setting (history
expansion, interactive use, ...)
Signed-off-by: Philipp Hahn <hahn>
checked with libvirt-0.8.7-7.el6.x86_64 FAILED
libvirt-0.8.7-7.el6.x86_64
#virsh start test
Domain test started
# virsh managedsave test
Domain test state saved by libvirt
# virsh start 'a b'
Domain a b started
# virsh managedsave 'a b'
error: Failed to save domain a b state
error: cannot send monitor command '{"execute":"query-migrate"}': Connection reset by peer
set bug status to ASSIGNED
retested with libvirt-0.8.7-7.el6.x86_64
#virsh start test
Domain test started
# virsh managedsave test
Domain test state saved by libvirt
# virsh start 'a b'
Domain a b started
# virsh managedsave 'a b'
Domain a b state saved by libvirt
Addtional info :
this result is from the scratch installed libvirt . And the result from Comment 17 is the libvirt updated from old packages .
Can't reproduce this bug with the new installed libvirt . So set bug status to VERIFIED for now. Once meet this bug again . Will reopen this for further investigation .
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHBA-2011-0596.html
Description of problem: As part of the rebase to libvirt 0.8.7 in RHEL 6.1, libvirt gained the ability to have better support for guests with spaces in their names. However, this support is incomplete, and an attempt to snapshot such a domain causes a shell syntax error. Version-Release number of selected component (if applicable): v0.8.7-6.el6 How reproducible: 100% Steps to Reproduce: 1. create and run a guest named "a b" (note: virt-manager might not allow this, so it may require manual creation of an xml file and 'virsh define file.xml') 2. try 'virsh managedsave "a b" Actual results: /var/log/libvirt/qemu/a\ b.log: sh: -c: line 0: syntax error near unexpected token `b' sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; } Expected results: should work Additional info: Reported and patched upstream: https://www.redhat.com/archives/libvir-list/2011-February/msg00360.html commit f370fc37f964984ba40584dab1de340ce7e44bac Author: Philipp Hahn <hahn> Date: Fri Feb 11 13:59:11 2011 +0100 qemu: Fix escape_monitor(escape_shell(command)) Suspending a VM which contains shell meta characters doesn't work with libvirt-0.8.7: /var/log/libvirt/qemu/andreas_231-ne\ doch\ nicht.log: sh: -c: line 0: syntax error near unexpected token `doch' sh: -c: line 0: `cat | { dd bs=4096 seek=1 if=/dev/null && dd bs=1048576; } Although target="andreas_231-ne doch nicht" contains shell meta characters (here: blanks), they are not properly escaped by src/qemu/qemu_monitor_{json,text}.c#qemuMonitor{JSON,Text}MigrateToFile() First, the filename needs to be properly escaped for the shell, than this command line has to be properly escaped for qemu again. For this to work, remove the old qemuMonitorEscapeArg() wrapper, rename qemuMonitorEscape() to it removing the handling for shell=TRUE, and implement a new qemuMonitorEscapeShell() returning strings using single quotes. Using double quotes or escaping special shell characters with backslashes would also be possible, but the set of special characters heavily depends on the concrete shell (dsh, bash, zsh) and its setting (history expansion, interactive use, ...) Signed-off-by: Philipp Hahn <hahn>