diff --git a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh index e7d7d1326174..eb6e7715385c 100644 --- a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh @@ -82,7 +82,7 @@ wrapQtAppsHook() { find "$targetDir" -executable -print0 | while IFS= read -r -d '' file do - isELF "$file" || continue + isELFExec "$file" || continue if [ -f "$file" ] then diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index ebcedce60b87..311292169ecd 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -212,6 +212,18 @@ isELF() { if [ "$magic" = $'\177ELF' ]; then return 0; else return 1; fi } +# Return success if the specified file is an ELF object +# and its e_type is ET_EXEC (executable file) +isELFExec() { + grep -ao -P '^\177ELF.{11}\x00\x02' "$1" >/dev/null +} + +# Return success if the specified file is an ELF object +# and its e_type is ET_DYN (shared object file) +isELFDyn() { + grep -ao -P '^\177ELF.{11}\x00\x03' "$1" >/dev/null +} + # Return success if the specified file is a script (i.e. starts with # "#!"). isScript() {