All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Heimer <anders.heimer@est.tech>
To: openembedded-core@lists.openembedded.org
Cc: Anders Heimer <anders.heimer@est.tech>
Subject: [PATCH] oe: pass gcc and tmux commands as lists
Date: Fri, 19 Jun 2026 11:26:31 +0200	[thread overview]
Message-ID: <20260619092631.1982181-1-anders.heimer@est.tech> (raw)

Avoid shell=True in subprocess calls.

Handle OSError if gcc cannot be started.

Signed-off-by: Anders Heimer <anders.heimer@est.tech>
---
 meta/lib/oe/terminal.py | 4 ++--
 meta/lib/oe/utils.py    | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 013d77581d..ec65b616ab 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -283,8 +283,8 @@ def check_tmux_pane_size(tmux):
     if not check_tmux_version('1.9'):
         return False
     try:
-        p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux,
-                shell=True,stdout=sub.PIPE,stderr=sub.PIPE)
+        p = sub.Popen([tmux, "list-panes", "-F", "#{?pane_active,#{pane_height},}"],
+                stdout=sub.PIPE, stderr=sub.PIPE)
         out, err = p.communicate()
         size = int(out.strip())
     except OSError as exc:
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 18c48a145f..558073d3b1 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -433,10 +433,12 @@ def get_host_gcc_version(d, taskcontextonly=False):
         # datastore PATH does not contain session PATH as set by environment-setup-...
         # this breaks the install-buildtools use-case
         # env["PATH"] = d.getVar("PATH")
-        output = subprocess.check_output("gcc --version", \
-                    shell=True, env=env, stderr=subprocess.STDOUT).decode("utf-8")
+        output = subprocess.check_output(["gcc", "--version"], \
+                    env=env, stderr=subprocess.STDOUT).decode("utf-8")
     except subprocess.CalledProcessError as e:
         bb.fatal("Error running gcc --version: %s" % (e.output.decode("utf-8")))
+    except OSError as e:
+        bb.fatal("Error running gcc --version: %s" % e)
 
     match = re.match(r".* (\d+\.\d+)\.\d+.*", output.split('\n')[0])
     if not match:


                 reply	other threads:[~2026-06-19  9:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260619092631.1982181-1-anders.heimer@est.tech \
    --to=anders.heimer@est.tech \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.