From: AdrianF <adrian.freihofer@siemens.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH v2 05/14] devtool: deploy-target: fix run strip under pseudo
Date: Tue, 4 Aug 2026 13:59:29 +0200 [thread overview]
Message-ID: <20260804120034.378787-6-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20260804120034.378787-1-adrian.freihofer@siemens.com>
From: Adrian Freihofer <adrian.freihofer@siemens.com>
Any file modification on pseudo-tracked files must happen inside the
pseudo fakeroot environment so the pseudo database stays in sync with
the real filesystem. Stripping was done outside pseudo, which is
conceptually wrong: tools that replace files (temp+rename) change
inodes, and pseudo loses track of the new inodes, causing the
deployment tar to embed incorrect ownership and permissions.
This probably went unnoticed because GNU strip modifies files in place without
changing their inodes. llvm-strip replaces files via a temp file and
rename, making the ownership corruption visible.
The old code was manually prepending path to the parent process's PATH
so strip_cmd could be found, then restoring it. The new code passes the
strip script to exec_fakeroot_no_d, which already sets PATH = path in
the subprocess's environment — so strip_cmd is findable there without
touching the parent's PATH at all.
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
scripts/lib/devtool/deploy.py | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 7866cfbaae..6a75538fb0 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -9,7 +9,9 @@
import logging
import os
import shutil
+import shlex
import subprocess
+import sys
import tempfile
import bb.utils
@@ -221,10 +223,21 @@ def deploy_no_d(srcdir, workdir, path, strip_cmd, libdir, base_libdir, max_proce
exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "rm -rf %s" % recipe_outdir, shell=True)
exec_fakeroot_no_d(fakerootcmd, fakerootenv, path, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True)
- oldpath = os.environ['PATH']
- os.environ['PATH'] = ':'.join([os.environ['PATH'], path or ''])
- oe.package.strip_execs(args.recipename, recipe_outdir, strip_cmd, libdir, base_libdir, max_process)
- os.environ['PATH'] = oldpath
+ # Strip under pseudo so that it records any inode replacements made by
+ # the strip tool before the deployment tar reads this directory.
+ strip_script = (
+ 'import sys\n'
+ 'sys.path[:] = %r\n'
+ 'import oe.package\n'
+ 'oe.package.strip_execs(%r, %r, %r, %r, %r, %r)\n'
+ ) % (sys.path, args.recipename, recipe_outdir, strip_cmd, libdir,
+ base_libdir, max_process)
+ ret = exec_fakeroot_no_d(
+ fakerootcmd, fakerootenv, path,
+ '%s -c %s' % (shlex.quote(sys.executable), shlex.quote(strip_script)),
+ shell=True)
+ if ret != 0:
+ raise DevtoolError('Failed to strip files for deployment')
filelist = []
inodes = set({})
--
2.55.0
next prev parent reply other threads:[~2026-08-04 12:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 11:59 [PATCH v2 00/14] devtool ide-sdk: clang and lldb support AdrianF
2026-08-04 11:59 ` [PATCH v2 01/14] oe-selftest: devtool: use stat for reading user/group names in ide-sdk tests AdrianF
2026-08-04 11:59 ` [PATCH v2 02/14] devtool: ide-sdk: fix duplicate -p flag in _target_ssh_args AdrianF
2026-08-04 11:59 ` [PATCH v2 03/14] devtool: ide-sdk: fix $@ overwritten by set in install_and_deploy script AdrianF
2026-08-04 11:59 ` [PATCH v2 04/14] devtool: ide-sdk: fix meson compile_commands.json AdrianF
2026-08-04 11:59 ` AdrianF [this message]
2026-08-04 11:59 ` [PATCH v2 06/14] oe-selftest: devtool ide-sdk: cover breakpoints in exe, header and library AdrianF
2026-08-04 11:59 ` [PATCH v2 07/14] oe-selftest: devtool ide-sdk: add real debug coverage for meson+code AdrianF
2026-08-04 11:59 ` [PATCH v2 08/14] devtool: ide-sdk debugger back-end abstraction AdrianF
2026-08-04 11:59 ` [PATCH v2 09/14] devtool: ide-sdk: wait for gdbserver port before returning AdrianF
2026-08-04 11:59 ` [PATCH v2 10/14] devtool: ide-sdk add LLDB support for clang toolchain AdrianF
2026-08-04 11:59 ` [PATCH v2 11/14] devtool: ide-sdk: add LLDB support for ide=none (clang toolchain) AdrianF
2026-08-04 11:59 ` [PATCH v2 12/14] meta-selftest: refactor cpp examples into .inc files and add clang variants AdrianF
2026-08-04 11:59 ` [PATCH v2 13/14] oe-selftest: devtool ide-sdk: add clang/LLDB test AdrianF
2026-08-07 15:11 ` [OE-core] " Mathieu Dubois-Briand
2026-08-07 15:17 ` Freihofer, Adrian
2026-08-07 15:44 ` Mathieu Dubois-Briand
2026-08-09 9:46 ` adrian.freihofer
2026-08-04 11:59 ` [PATCH v2 14/14] oe-selftest: devtool ide-sdk: add test for ide=none LLDB/clang support AdrianF
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=20260804120034.378787-6-adrian.freihofer@siemens.com \
--to=adrian.freihofer@siemens.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox