]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
devtool: prevent 'devtool modify -n' from corrupting kernel Git repos
authorEnrico Jörns <ejo@pengutronix.de>
Mon, 23 Mar 2026 23:19:31 +0000 (00:19 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 26 Mar 2026 11:14:46 +0000 (11:14 +0000)
Running 'devtool modify -n' on a kernel recipe that inherits
'kernel-yocto' can unintentionally corrupt an existing Git repo or
worktree.

The work-shared optimization introduced in 3c3a9bae ("devtool/standard.py:
Update devtool modify to copy source from work-shared if its already
downloaded") is not skipped when '--no-extract' ('args.no_extract') is set.

As a result, for kernel builds where STAGING_KERNEL_DIR was already
populated when running 'devtool modify -n', the existing source tree is
overwritten (via oe.path.copyhardlinktree()) with the contents of
STAGING_KERNEL_DIR.

Fix by adding 'and not args.no_extract' to the kernel-yocto guard
condition.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/devtool/standard.py

index b706d9c7a140a233ce65b45b8db1b8cc21a5c0fe..42fb13872d3a9d3b2d971fd968ad7170b16a6e50 100644 (file)
@@ -801,7 +801,8 @@ def modify(args, config, basepath, workspace):
         commits = {}
         check_commits = False
 
-        if bb.data.inherits_class('kernel-yocto', rd):
+        if bb.data.inherits_class('kernel-yocto', rd) and not args.no_extract:
+
             # Current set kernel version
             kernelVersion = rd.getVar('LINUX_VERSION')
             srcdir = rd.getVar('STAGING_KERNEL_DIR')