[elbe-devel] [PATCH v3] build_sdk toolchain-shar-extract.sk.mako: only try to reloc ELF executables
Manuel Traut
manut at linutronix.de
Wed Apr 24 16:16:33 CEST 2019
On 15:40 Wed 24 Apr , Torben Hohn wrote:
> scripts are marked executable, but are not suposed to be relocated using
> patchelf. Trying to get patchelf to relocate a script yields an error,
> and stops the rlocation process.
>
> Use file to check whether the executables are actually elf files.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/makofiles/toolchain-shar-extract.sh.mako | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/elbepack/makofiles/toolchain-shar-extract.sh.mako b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> index 96810aad..6951dbc3 100644
> --- a/elbepack/makofiles/toolchain-shar-extract.sh.mako
> +++ b/elbepack/makofiles/toolchain-shar-extract.sh.mako
> @@ -280,7 +280,10 @@ if [ "$dl_path" = "" ] ; then
> exit 1
> fi
> executable_files=$($SUDO_EXEC find $native_sysroot -type f \
> - \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ")
> + \( -perm -0100 -o -perm -0010 -o -perm -0001 \) \
> + -exec sh -c "file {} | grep -Pi ': elf (32|64)-bit' > /dev/null" \; \
> + -printf "'%h/%f' ")
> +
tab instead of space, i'll fix it up during apply
> if [ "x$executable_files" = "x" ]; then
> echo "SDK relocate failed, could not get executalbe files"
> exit 1
> @@ -301,6 +304,14 @@ if [ x\$PATCHELF = "x" ]; then
> exit 1
> fi
>
> +FILECMD=\`which file 2>/dev/null\`
> +
> +if [ x\$FILECMD = "x" ]; then
> + echo "SDK could not be relocated. No file command found."
> + echo "use 'sudo apt install file' on Debian"
> + exit 1
> +fi
> +
I guess the position of this check is wrong. It should be done
before executable_files. The script created here, doesn't use
file at all.
> for exe in $executable_files; do
> if [ \`readlink -f \$exe\` == \`readlink -f $dl_path\` ]; then
> echo SKIP \$exe
> --
> 2.11.0
>
More information about the elbe-devel
mailing list