tools/qvm-start: use vm.run_with_args to call losetup in the VM
This will fix handling filenames with spaces and shell special characters. Reported by @v6ak Fixes QubesOS/qubes-issues#4860
This commit is contained in:
parent
a35cb46342
commit
a2629b1239
@ -193,11 +193,11 @@ class TC_00_qvm_start(qubesadmin.tests.QubesTestCase):
|
||||
as mock_run:
|
||||
mock_run.return_value = (b'/dev/loop7', b'')
|
||||
qubesadmin.tools.qvm_start.main([
|
||||
'--cdrom=other-vm:/home/some/image.iso',
|
||||
'--cdrom=other-vm:/home/some image.iso',
|
||||
'some-vm'],
|
||||
app=self.app)
|
||||
mock_run.assert_called_once_with(
|
||||
'losetup -f --show /home/some/image.iso',
|
||||
'losetup -f --show \'/home/some image.iso\'',
|
||||
user='root')
|
||||
self.assertAllCalled()
|
||||
|
||||
|
@ -115,8 +115,9 @@ def get_drive_assignment(app, drive_str):
|
||||
loop_name = subprocess.check_output(
|
||||
['sudo', 'losetup', '-f', '--show', ident])
|
||||
else:
|
||||
loop_name, _ = backend_domain.run(
|
||||
'losetup -f --show ' + ident, user='root')
|
||||
loop_name, _ = backend_domain.run_with_args(
|
||||
'losetup', '-f', '--show', ident,
|
||||
user='root')
|
||||
except subprocess.CalledProcessError:
|
||||
raise qubesadmin.exc.QubesException(
|
||||
'Failed to setup loop device for %s', ident)
|
||||
|
Loading…
Reference in New Issue
Block a user