From patchwork Mon Oct 19 14:58:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87737CCF2EB for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36687.1792421922257607795 for ; Mon, 19 Oct 2026 07:58:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=VdVVNsJ/; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 666A0202C for ; Mon, 19 Oct 2026 07:58:38 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3F5D33F673 for ; Mon, 19 Oct 2026 07:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421921; bh=eh9/npw1cVcR87A/1Y5w/RHfCugOOciIB6nvj2l/3go=; h=From:To:Subject:Date:From; b=VdVVNsJ/1KBYlsGfJ/lCGeh5MXkUN7e3eKyU3HmowoRVp4XUTFM2y3VQHlJkvBPR6 C8wkvw3Ww9IMdcOPDTBYwO2EXXnawT2wn8rfDD72OdhC6Sej5DOdSJ2fZpZhb/hiVu YVa3hXKngUM6FkTwMgD39CxVFBSIFwhJ3zqXqnvg= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/6] lib/oe/sstatesig: cache the user/group lookups in OEOuthashBasic Date: Mon, 19 Oct 2026 15:58:32 +0100 Message-ID: <20261019145837.2487873-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248183 The hash includes the user/group names for every file in the sstate object, so we can save a little time by wrapping pwd.getpwuid() and grp.getgrgid() in a lru_cache. In a microbenchmark on my machine, repeated calls of getpwuid() take 0.56ms but the caching wrapper takes 0.09ms. Signed-off-by: Ross Burton --- meta/lib/oe/sstatesig.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 9928f3af495..145bc59617d 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -550,6 +550,11 @@ def OEOuthashBasic(path, sigfile, task, d): import grp import re import fnmatch + import functools + + # Caches to speed lookups + lookup_uid = functools.lru_cache(lambda uid: pwd.getpwuid(uid).pw_name) + lookup_gid = functools.lru_cache(lambda gid: grp.getgrgid(gid).gr_name) def update_hash(s): s = s.encode('utf-8') @@ -652,8 +657,8 @@ def OEOuthashBasic(path, sigfile, task, d): add_perm(stat.S_IXOTH, 'x') try: - update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name) - update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name) + update_hash(" %10s" % lookup_uid(s.st_uid)) + update_hash(" %10s" % lookup_gid(s.st_gid)) except KeyError as e: msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match " "any user/group on target. This may be due to host contamination." % From patchwork Mon Oct 19 14:58:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101292 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33AD6CCF2E5 for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36688.1792421922794514305 for ; Mon, 19 Oct 2026 07:58:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=X7i5RgMV; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 28250204C for ; Mon, 19 Oct 2026 07:58:39 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EBB7A3F673 for ; Mon, 19 Oct 2026 07:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421922; bh=XQAZmxByKSUmqKWwXwVDeI9uG4FaOCJyaQ9G+NHEKpw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=X7i5RgMVtP9pNOkNeXB7oIIm+yhTENpPtQ4jALBBV5FQe1oET71OHnDxEcoxS97+j ZkeKis0D0ndaFtgOac9ljjn+WGnDPIu5rajaVQgZHGyArh4jLeydTeMQiW0rPzQSd7 9ZmmgKd/+gewLO8nU2ub7pVOUXkY1Vrz3cTuL6mc= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/6] lib/oe/cachedpath: add is_executable() functions Date: Mon, 19 Oct 2026 15:58:33 +0100 Message-ID: <20261019145837.2487873-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261019145837.2487873-1-ross.burton@arm.com> References: <20261019145837.2487873-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248184 Add is_exexcutable(), which returns True if the path has any executable bits set in the file mode. Signed-off-by: Ross Burton --- meta/lib/oe/cachedpath.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meta/lib/oe/cachedpath.py b/meta/lib/oe/cachedpath.py index 68c85807d9f..462094192d2 100644 --- a/meta/lib/oe/cachedpath.py +++ b/meta/lib/oe/cachedpath.py @@ -121,6 +121,12 @@ class CachedPath(object): def lstat(self, path): return self.calllstat(path) + def is_executable(self, path): + """ + Test if the file has any executable bits set. + """ + return bool(self.stat(path).st_mode & (statmod.S_IXUSR | statmod.S_IXGRP | statmod.S_IXOTH)) + def walk(self, top, topdown=True, onerror=None, followlinks=False): # Matches os.walk, not os.path.walk() From patchwork Mon Oct 19 14:58:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B4A4CCF2E6 for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.36689.1792421923520804369 for ; Mon, 19 Oct 2026 07:58:43 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=sPjDTdmE; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DA549202C for ; Mon, 19 Oct 2026 07:58:39 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AD11E3F673 for ; Mon, 19 Oct 2026 07:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421923; bh=f8ueY5GHiTFjheE0Ym5YzgvuB6l3ffB2wQ11zgOt1AU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sPjDTdmEE8WS6bygQTU+XKRfLk6hKdHz8psM/IZhZDggEWm7wK8p11yADhavXqxQh bkta+CWKhaejGtmebX0Y+lOn/Q8co1mKdNbZjStt+sOauYxtLGeEv9i7leobuceoDm MhE3D2D08kZ+Xbe+tfV7OPl2jIMPWoWmyWfCpr04= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/6] lib/oe/package: use cachedpath.is_executable() instead of os.access() Date: Mon, 19 Oct 2026 15:58:34 +0100 Message-ID: <20261019145837.2487873-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261019145837.2487873-1-ross.burton@arm.com> References: <20261019145837.2487873-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248185 os.access() asks if the *current user* can run the specified binary, which isn't what we care about when packaging. We simply want to know if the binary has executable bits set so check the mode, using cachedpath.is_executable() to avoid another stat() call. Signed-off-by: Ross Burton --- meta/lib/oe/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 5d4966be295..5938798cef0 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -1780,7 +1780,7 @@ def process_shlibs(pkgfiles, d): darwin_so(file, needed, sonames, pkgver) elif hostos.startswith("mingw"): mingw_dll(file, needed, sonames, pkgver) - elif os.access(file, os.X_OK) or lib_re.match(file): + elif cpath.is_executable(file) or lib_re.match(file): linuxlist.append(file) if linuxlist: From patchwork Mon Oct 19 14:58:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D258CCF2E8 for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36899.1792421924487287577 for ; Mon, 19 Oct 2026 07:58:44 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=jLfFWeFk; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 954F1202C for ; Mon, 19 Oct 2026 07:58:40 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6EBE13F673 for ; Mon, 19 Oct 2026 07:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421923; bh=XTvFSa2g48AZPKXHicOnSkzILzhB698ml7wqQFsk/Mg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jLfFWeFkCB0wZcegmbb4btTcbmOfviemuePW1peXDPpDX06mPSKfiUwzh41WvHPCv lh23kxLaShunN6AnUFfilAyJxgswDnwiF2JilPjFXGpRuLHXkSWJlrRnwNCzEqopFC xYiCHdu1gT7PqwnFIyegSPuP8YK5K09vVCmIopCE= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/6] lib/oe/package: improve regex when looking for libraries Date: Mon, 19 Oct 2026 15:58:35 +0100 Message-ID: <20261019145837.2487873-4-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261019145837.2487873-1-ross.burton@arm.com> References: <20261019145837.2487873-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248186 Don't match() on .*\.so as that has false-positives for files named like "file.something". Instead, search for ".so" followed by either a dot or the end of the filename. Note that in an ideal world we'd reuse the elffiles list, which has already been populated for the debug stripping. Unfortunately at present this is not accessible here. Signed-off-by: Ross Burton --- meta/lib/oe/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 5938798cef0..8ecb2555f3a 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -1619,7 +1619,7 @@ def process_shlibs(pkgfiles, d): bb.note("not generating shlibs") return - lib_re = re.compile(r"^.*\.so") + lib_re = re.compile(r"\.so(?:\.|$)") libdir_re = re.compile(r".*/%s$" % d.getVar('baselib')) packages = d.getVar('PACKAGES') @@ -1780,7 +1780,7 @@ def process_shlibs(pkgfiles, d): darwin_so(file, needed, sonames, pkgver) elif hostos.startswith("mingw"): mingw_dll(file, needed, sonames, pkgver) - elif cpath.is_executable(file) or lib_re.match(file): + elif cpath.is_executable(file) or lib_re.search(file): linuxlist.append(file) if linuxlist: From patchwork Mon Oct 19 14:58:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99B7ACCF2EA for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36900.1792421924952534236 for ; Mon, 19 Oct 2026 07:58:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=mJp/IAwC; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4EC11204C for ; Mon, 19 Oct 2026 07:58:41 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 27CB63F673 for ; Mon, 19 Oct 2026 07:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421924; bh=T3FtB6M331nUkHXu6CHxwX9qHQ1SK/JMOFbCKXs1h2Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mJp/IAwCxBCSFCKITN1e1qVZvnMGnggVTCRwuMXSqduE79ZnWeiTd9vurKo5v/YqW aQJhoPC93dbu9vtEBTRV24Apu5XYIQpzT8zCPJzOOPzsuBHckIfEbgCss76K3G5qk9 lHFGXu2PgG+7pSd+u9FSEEK2hRl9OzlSDMWWMFlo= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 5/6] lib/oe/package: use elfutils instead of objdump to extract SONAME etc Date: Mon, 19 Oct 2026 15:58:36 +0100 Message-ID: <20261019145837.2487873-5-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261019145837.2487873-1-ross.burton@arm.com> References: <20261019145837.2487873-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248187 Currently the process_shlibs() function uses OBJDUMP (typically, objdump from binutils) to extract the NEEDED/SONAME/RPATH values from the ELF. However, there is no explicit dependency on binutils in do_package, instead it comes into the sysroot via the default toolchain dependencies in do_configure, so a recipe that does INHIBIT_DEFAULT_DEPS and also packages an executable file will try and then fail to run objdump. Currently this error is silently ignored, which is acceptable if the executable is a script, but if the recipe contains ELFs without ever depending on binutils (precompiled, or a different toolchain) then the shlibs code won't actually run correctly. do_package() already depends on elfutils-native for eu-srcfiles, so switch the code to use eu-readelf instead. Also use subprocess.run() with a command list instead of a string to os.popen(). The os.popen() code didn't have any error handling meaning it silently ignored both "objdump not found" and "file is not ELF", we can assume that eu-readelf exists but we still need to absorb errors from not passing a valid ELF. Signed-off-by: Ross Burton --- meta/lib/oe/package.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index 8ecb2555f3a..e706e359cc3 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -1654,23 +1654,24 @@ def process_shlibs(pkgfiles, d): needed = set() sonames = set() ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '') - cmd = d.getVar('OBJDUMP') + " -p " + shlex.quote(file) + " 2>/dev/null" - fd = os.popen(cmd) - lines = fd.readlines() - fd.close() rpath = tuple() + cmd = ["eu-readelf", "--dynamic", file] + # Don't check for errors as we may be passed non-ELF + ret = subprocess.run(cmd, capture_output=True, text=True) + + lines = ret.stdout.splitlines() for l in lines: - m = re.match(r"\s+RPATH\s+([^\s]*)", l) + m = re.match(r"\s+RPATH\s+.+\[(.+)\]", l) if m: rpaths = m.group(1).replace("$ORIGIN", ldir).split(":") rpath = tuple(map(os.path.normpath, rpaths)) for l in lines: - m = re.match(r"\s+NEEDED\s+([^\s]*)", l) + m = re.match(r"\s+NEEDED\s+.+\[(.+)\]", l) if m: dep = m.group(1) if dep not in needed: needed.add((dep, file, rpath)) - m = re.match(r"\s+SONAME\s+([^\s]*)", l) + m = re.match(r"\s+SONAME\s+.+\[(.+)\]", l) if m: this_soname = m.group(1) prov = (this_soname, ldir, pkgver) From patchwork Mon Oct 19 14:58:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 101293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35EFACCF2E7 for ; Mon, 19 Oct 2026 14:58:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36901.1792421925817928763 for ; Mon, 19 Oct 2026 07:58:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@arm.com header.s=foss header.b=QWAKYJte; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06B89202C for ; Mon, 19 Oct 2026 07:58:42 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D43893F673 for ; Mon, 19 Oct 2026 07:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1792421925; bh=bVTYlDNWIXR/yUwg++B6Sb4IzkR+4yoA6st/JSs3Xco=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QWAKYJteEd6Y34ku6kQbHU7Taf5CbTRFWqwOjOD4h5T60De4JpAmDwq7ZxNctA/c2 /VKlsPK/d7oZ1zOh9mu88uaHoPvINqR/MZkhPs3x7zrGKQU7RQL+OZ8OTRbh2vwHT+ mhqKW44lfTcpjOsOGtbOvxIvnfvSuN0p73/qEwu4= From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 6/6] lib/oe/package: fix logic error in file permission checks Date: Mon, 19 Oct 2026 15:58:37 +0100 Message-ID: <20261019145837.2487873-6-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261019145837.2487873-1-ross.burton@arm.com> References: <20261019145837.2487873-1-ross.burton@arm.com> MIME-Version: 1.0 X-ARM-No-Footer: NoDisclaimer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 19 Oct 2026 14:58:52 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248188 Various bits of package.py manipulate executables on disk, for example stripping the binary or extracting the debug info. Some recipes write read-only libraries (notably, perl-native) so we need to check for this and add writable permissions briefly. However, this logic was incorrect. The line is: if not os.access(file, os.W_OK) or os.access(file, os.R_OK): 'not' has higher precedence than 'or', so this is "if not writable, or if readable" so we were always changing the permissions, even on files we can read and write. The desired behaviour is to change permissions if we can't read or write the file, which can be done in a single access check: if not os.access(file, os.R_OK | os.W_OK): Signed-off-by: Ross Burton --- meta/lib/oe/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index e706e359cc3..a0bde50ed63 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -30,7 +30,7 @@ def runstrip(file, elftype, strip, extra_strip_sections=''): # 16 - kernel module newmode = None - if not os.access(file, os.W_OK) or os.access(file, os.R_OK): + if not os.access(file, os.R_OK | os.W_OK): origmode = os.stat(file)[stat.ST_MODE] newmode = origmode | stat.S_IWRITE | stat.S_IREAD os.chmod(file, newmode) @@ -780,7 +780,7 @@ def splitdebuginfo(file, dvar, dv, d): objcopy = d.getVar("OBJCOPY") newmode = None - if not os.access(file, os.W_OK) or os.access(file, os.R_OK): + if not os.access(file, os.R_OK | os.W_OK): origmode = os.stat(file)[stat.ST_MODE] newmode = origmode | stat.S_IWRITE | stat.S_IREAD os.chmod(file, newmode) @@ -822,7 +822,7 @@ def splitstaticdebuginfo(file, dvar, dv, d): dvar = d.getVar('PKGD') newmode = None - if not os.access(file, os.W_OK) or os.access(file, os.R_OK): + if not os.access(file, os.R_OK | os.W_OK): origmode = os.stat(file)[stat.ST_MODE] newmode = origmode | stat.S_IWRITE | stat.S_IREAD os.chmod(file, newmode)