diff mbox series

[v2] kernel-devsrc: fix incorrect python shebang replacement

Message ID 20251028101807.2085945-1-jiaying.song.cn@windriver.com
State New
Headers show
Series [v2] kernel-devsrc: fix incorrect python shebang replacement | expand

Commit Message

Song, Jiaying (CN) Oct. 28, 2025, 10:18 a.m. UTC
From: Jiaying Song <jiaying.song.cn@windriver.com>

Update the sed replacement rule to strictly match '/usr/bin/python'
(with no trailing characters)

The previous sed rule was too broad and could incorrectly change Python
shebangs such as in
/lib/modules/6.16.11-yocto-standard/build/scripts/macro_checker.py from
'#!/usr/bin/python3' to '#!/usr/bin/env python33'.

Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bruce Ashfield Oct. 28, 2025, 12:22 p.m. UTC | #1
Looks good to me!

Bruce

On Tue, Oct 28, 2025 at 6:18 AM <jiaying.song.cn@windriver.com> wrote:

> From: Jiaying Song <jiaying.song.cn@windriver.com>
>
> Update the sed replacement rule to strictly match '/usr/bin/python'
> (with no trailing characters)
>
> The previous sed rule was too broad and could incorrectly change Python
> shebangs such as in
> /lib/modules/6.16.11-yocto-standard/build/scripts/macro_checker.py from
> '#!/usr/bin/python3' to '#!/usr/bin/env python33'.
>
> Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
> ---
>  meta/recipes-kernel/linux/kernel-devsrc.bb | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb
> b/meta/recipes-kernel/linux/kernel-devsrc.bb
> index 04dd683dde..411c99ba30 100644
> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> @@ -400,7 +400,7 @@ do_install() {
>      for ss in $(find $kerneldir/build/scripts -type f -name '*'); do
>          sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss"
>          sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss"
> -        sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss"
> +        sed -i 's,/usr/bin/python$,/usr/bin/env python3,' "$ss"
>      done
>
>      chown -R root:root ${D}
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 04dd683dde..411c99ba30 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -400,7 +400,7 @@  do_install() {
     for ss in $(find $kerneldir/build/scripts -type f -name '*'); do
         sed -i 's,/usr/bin/python2,/usr/bin/env python3,' "$ss"
         sed -i 's,/usr/bin/env python2,/usr/bin/env python3,' "$ss"
-        sed -i 's,/usr/bin/python,/usr/bin/env python3,' "$ss"
+        sed -i 's,/usr/bin/python$,/usr/bin/env python3,' "$ss"
     done
 
     chown -R root:root ${D}