|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xend: insufficient quoting in tapdisk
# HG changeset patch
# User Philipp Hahn <hahn@xxxxxxxxxxxxx>
# Date 1322764229 0
# Node ID 3915bd95ade5b043d9780fe3f7917a06a5c5a6ae
# Parent 9c8aff3080024db56a85f41ea3534695e70ee8fd
xend: insufficient quoting in tapdisk
insufficient quoting between "tap-ctl list" and xend/server/BlktapController.py
BlktapController splits the output into lines using \n, then each line
at each space, and finally each of these 'words' at the '=', which
fails if the filename contains spaces.
As a quick work-around, the attached patch fixes the problem for me. That is,
until tap-ctl changes it's output format.
A more permanent solution would be to add proper quoting / escaping to tap-ctl
and un-quoting / de-escaping to BlktapController.py
Signed-off-by: Philipp Hahn <hahn@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r 9c8aff308002 -r 3915bd95ade5
tools/python/xen/xend/server/BlktapController.py
--- a/tools/python/xen/xend/server/BlktapController.py Thu Dec 01 18:28:18
2011 +0000
+++ b/tools/python/xen/xend/server/BlktapController.py Thu Dec 01 18:30:29
2011 +0000
@@ -249,11 +249,12 @@
_list = TapdiskController.exc('list')
if not _list: return []
- for line in _list.split('\n'):
+ for line in _list.splitlines():
tapdisk = TapdiskController.Tapdisk()
- for pair in line.split():
- key, value = pair.split('=')
+ # Since 'tap-ctl list' does not escape blanks in the path,
hard-code the current format using 4 pairs to prevent splitting the path
+ for pair in line.split(None, 4):
+ key, value = pair.split('=', 1)
if key == 'pid':
tapdisk.pid = value
elif key == 'minor':
@@ -264,7 +265,7 @@
elif key == 'state':
tapdisk.state = value
elif key == 'args' and value.find(':') != -1:
- tapdisk.dtype, tapdisk.image = value.split(':')
+ tapdisk.dtype, tapdisk.image = value.split(':', 1)
tapdisks.append(tapdisk)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |