mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@univention.de> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
f00d216182
commit
f065c8c4aa
1 file changed
+5
-4
@@ -249,11 +249,12 @@ class TapdiskController(object):
|
||||
_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 @@ class TapdiskController(object):
|
||||
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)
|
||||
|
||||
|
||||