Do not use shlex_quote in get_pungi_buildinstall_cmd and get_pungi_ostree_cmd.

These methods return command as list which is never serialized to str and
never executed using bash. It is instead passed directly to
`kobo.shortcuts.run`.

The `shlex_quote` usage here actually breaks the code, because it adds
quotes there which are needed only if this command would be serialized
to string and passed to bash. But this never happens. As a result,
the arguments passed to `kobo.shortcuts.run` contain those extra
quotes.

In this commit the shlex_quote is removed completely from this
part of code.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2020-11-09 18:36:16 +01:00 committed by lsedlar
parent 295a60a704
commit 94bc5e286d
2 changed files with 60 additions and 2 deletions

View File

@ -199,7 +199,7 @@ class KojiWrapper(object):
cmd.append("%s=%d" % (k, v))
else:
for arg in force_list(v):
cmd.append(shlex_quote("%s=%s" % (k, arg)))
cmd.append("%s=%s" % (k, arg))
return cmd
@ -239,7 +239,7 @@ class KojiWrapper(object):
cmd.append("%s=%d" % (k, v))
else:
for arg in force_list(v):
cmd.append(shlex_quote("%s=%s" % (k, arg)))
cmd.append("%s=%s" % (k, arg))
return cmd

View File

@ -990,6 +990,64 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
],
)
def test_get_pungi_buildinstall_cmd(self):
args = {"product": "Fedora 23"}
cmd = self.koji.get_pungi_buildinstall_cmd(
"rrt",
"x86_64",
args,
channel=None,
packages=["lorax"],
mounts=["/tmp"],
weight=123,
chown_uid=456,
)
expected_cmd = [
"koji",
"--profile=custom-koji",
"pungi-buildinstall",
"--nowait",
"--task-id",
"--channel-override=runroot-local",
"--weight=123",
"--package=lorax",
"--mount=/tmp",
"--chown-uid=456",
"rrt",
"x86_64",
"product=Fedora 23",
]
self.assertEqual(cmd, expected_cmd)
def test_get_pungi_ostree_cmd(self):
args = {"product": "Fedora 23"}
cmd = self.koji.get_pungi_ostree_cmd(
"rrt",
"x86_64",
args,
channel=None,
packages=["lorax"],
mounts=["/tmp"],
weight=123,
)
expected_cmd = [
"koji",
"--profile=custom-koji",
"pungi-ostree",
"--nowait",
"--task-id",
"--channel-override=runroot-local",
"--weight=123",
"--package=lorax",
"--mount=/tmp",
"rrt",
"x86_64",
"product=Fedora 23",
]
self.assertEqual(cmd, expected_cmd)
RPM_QA_QF_OUTPUT = """
cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch