Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Bug 13986] New: Host python3 fails to run after relocate-sdk.sh
@ 2024-06-15 14:59 bugzilla
  0 siblings, 0 replies; only message in thread
From: bugzilla @ 2024-06-15 14:59 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=13986

            Bug ID: 13986
           Summary: Host python3 fails to run after relocate-sdk.sh
           Product: buildroot
           Version: 2021.02.3
          Hardware: All
                OS: Linux
            Status: RESOLVED
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned@buildroot.uclibc.org
          Reporter: dennis.peeten@heliox-energy.com
                CC: buildroot@uclibc.org, yann.morin.1998@free.fr
  Target Milestone: ---
                CC: yann.morin.1998@free.fr
            Status: RESOLVED
        Resolution: MOVED

The host python3 fails to start after relocating an SDK.

Reproduce:

Build an sdk with BR2_PACKAGE_HOST_PYTHON3=y
Untar the sdk to some location ${RELOCATED_SDK}.
Relocate the sdk by running ${RELOCATED_SDK}/relocate-sdk.sh
Run ${RELOCATED_SDK}/bin/python3

Result:

python fails to start, spewing confusing error messages.

Expected:

python starts with an interactive prompt. 

Note: running python3 from the build dir and running python3 from the relocated
sdk dir WITHOUT running the relocate-sdk.sh script does result in the expected
behaviour.

The problem is that the relocate-sdk.sh script also substitutes paths in the
.pyc byte code files, after which they become corrupted.

The relocate-sdk.sh script converts files who's MIME type starts with 'text/'.
The `file` utility on my machine (Debian 11) reports the MIME type of .pyc
files to be 'text/x-bytecode.python'. 

I'm not sure what the best solution is. But for now I've just changed the
relocate script on my end:

diff --git a/support/misc/relocate-sdk.sh b/support/misc/relocate-sdk.sh
index caabeaa6f6..8d381c41c3 100755
--- a/support/misc/relocate-sdk.sh
+++ b/support/misc/relocate-sdk.sh
@@ -36,7 +36,9 @@ echo "Relocating the buildroot SDK from ${OLDPATH} to
${NEWPATH} ..."
 export LC_ALL=C
 # Replace the old path with the new one in all text files
 grep -lr "${OLDPATH}" . | while read -r FILE ; do
-    if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" !=
"${LOCFILE}" ]
+    MIME="$(file -b --mime-type "${FILE}")"
+    if echo ${MIME} | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] &&
+        ! ( echo ${MIME} | grep -q '^text/x-bytecode' )
     then
         sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}"
     fi


Kind regards,
Dennis Peeten.

--- Comment #1 from Yann E. MORIN <yann.morin.1998@free.fr> ---
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-15 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-15 14:59 [Buildroot] [Bug 13986] New: Host python3 fails to run after relocate-sdk.sh bugzilla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox