diff mbox series

[2/3] builders: pass getproperties command as argv list

Message ID 20260611061330.733392-3-anders.heimer@est.tech
State New
Headers show
Series Avoid shell use | expand

Commit Message

Anders Heimer June 11, 2026, 6:13 a.m. UTC
String commands are processed by the worker shell, which is fragile for
quoting and unnecessary when the command and arguments are already known.
Pass getproperties.py as an argv list so builddir and buildername values
are delivered as arguments without shell interpretation.

AI-Generated: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Anders Heimer <anders.heimer@est.tech>
---
 builders.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/builders.py b/builders.py
index 55f0769..418ef1b 100644
--- a/builders.py
+++ b/builders.py
@@ -141,7 +141,11 @@  def create_builder_factory():
     f.addStep(steps.JSONPropertiesDownload(workerdest="build-properties.json"))
 
     f.addStep(steps.SetPropertyFromCommand(
-        command=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py %(prop:builddir)s/build %(prop:buildername)s"),
+        command=[
+            util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py"),
+            util.Interpolate("%(prop:builddir)s/build"),
+            util.Property("buildername"),
+        ],
         extract_fn=extract_json_props,
         name='Load build revisions',
         haltOnFailure=True))
@@ -364,7 +368,11 @@  def create_parent_builder_factory(buildername, waitname):
     factory.addStep(steps.JSONPropertiesDownload(workerdest="build-properties.json"))
 
     factory.addStep(steps.SetPropertyFromCommand(
-        command=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py %(prop:builddir)s/build %(prop:buildername)s"),
+        command=[
+            util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py"),
+            util.Interpolate("%(prop:builddir)s/build"),
+            util.Property("buildername"),
+        ],
         extract_fn=extract_json_props,
         name='Load build revisions',
         haltOnFailure=True))