Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@busybox.net
To: buildroot@uclibc.org
Subject: [Buildroot] [Bug 13986] New: Host python3 fails to run after relocate-sdk.sh
Date: Sat, 15 Jun 2024 14:59:06 +0000	[thread overview]
Message-ID: <bug-13986-163@https.bugs.busybox.net/> (raw)

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

                 reply	other threads:[~2024-06-15 14:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-13986-163@https.bugs.busybox.net/ \
    --to=bugzilla@busybox.net \
    --cc=buildroot@uclibc.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