Skip to contentSkip to conversation

devtool: prevent 'devtool modify -n' from corrupting kernel Git repos

PATCH In review Enrico Jörns 3 participants 6 messages Mar 23 – Jun 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtool: prevent 'devtool modify -n' from corrupting kernel Git repos

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.

---
 scripts/lib/devtool/standard.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/lib/devtool/standard.py +2 -1
index b706d9c7a1..42fb13872d 100644
@@ -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')
Signature · 1 line
2.47.3
#1 lore raw

Hi Yoann,

Quoted 13 lines · Enrico Jörns via lists.openembedded.org

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.

Quoted 4 lines

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

Can you please pick this devtool fix from the following upstream commit to stable branches scarthgap and kirkstone?

d383ea37e4 ("devtool: prevent 'devtool modify -n' from corrupting kernel Git repos")

Thanks and best regards!
Frieder

#2 lore raw
Quoted 16 lines · Frieder Schrempf

Hi Yoann,

Quoted 13 lines · Enrico Jörns via lists.openembedded.org

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.

Quoted 7 lines
Quoted 4 lines

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

Can you please pick this devtool fix from the following upstream commit to stable branches scarthgap and kirkstone?

Sorry, kirkstone is EOL of course. So only scarthgap.

Quoted 5 lines

d383ea37e4 ("devtool: prevent 'devtool modify -n' from corrupting kernel Git repos")

Thanks and best regards!
Frieder

#3 lore raw
In reply to Frieder Schrempf
Quoted 19 lines · Frieder Schrempf

Hi Yoann,

Quoted 16 lines · Enrico Jörns via lists.openembedded.org

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.

Quoted 7 lines
Quoted 1 line

Can you please pick this devtool fix from the following upstream commit to stable branches scarthgap and kirkstone?

d383ea37e4 ("devtool: prevent 'devtool modify -n' from corrupting kernel Git repos")

Hello,

I've added it to my scarthgap review branch.

Thanks!

Quoted 2 lines

Thanks and best regards!
Frieder

Signature · 2 lines
Yoann Congal
Smile ECS
#4 lore raw

Hi Yoann,

Quoted 25 lines · Yoann Congal
Quoted 24 lines · Frieder Schrempf

Hi Yoann,

Quoted 13 lines · Enrico Jörns via lists.openembedded.org

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.

Quoted 4 lines

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

Can you please pick this devtool fix from the following upstream commit to stable branches scarthgap and kirkstone?

Quoted 8 lines
Quoted 2 lines

d383ea37e4 ("devtool: prevent 'devtool modify -n' from corrupting kernel Git repos")

Hello,

I've added it to my scarthgap review branch.

Thanks!

I'm not seeing this in your latest scarthgap patch review. Am I missing something?

Thanks
Frieder

#5 lore raw
Quoted 31 lines · Frieder Schrempf

Hi Yoann,

Quoted 28 lines · Yoann Congal
Quoted 26 lines · Frieder Schrempf

Hi Yoann,

Quoted 13 lines · Enrico Jörns via lists.openembedded.org

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.

Quoted 4 lines

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

Can you please pick this devtool fix from the following upstream commit to stable branches scarthgap and kirkstone?

d383ea37e4 ("devtool: prevent 'devtool modify -n' from corrupting kernel Git repos")

Quoted 7 lines
Quoted 5 lines

Hello,

I've added it to my scarthgap review branch.

Thanks!

I'm not seeing this in your latest scarthgap patch review. Am I missing something?

No, I did, sorry: I simply lost this patch.
I've re-added it to the queue, it should be in either the next one or the one after that.

Thanks for the ping,

Regards,

Quoted 3 lines

Thanks
Frieder

Signature · 2 lines
Yoann Congal
Smile ECS