]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
find-requires: Only check for interpreters for executable files
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Feb 2023 13:04:32 +0000 (13:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 21 Feb 2023 13:04:32 +0000 (13:04 +0000)
This avoids collecting interpreters from firmware likes like QEMU
installs them for instance.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/scripts/find-requires

index 39c0d15680163127acfcc8e90774ae8cf18c8c82..836b027c46d4ec6e6af62d6ddbd3ca4644a161fb 100644 (file)
@@ -56,6 +56,11 @@ find_elf_interpreter() {
        local file="${1}"
        local filelist="${2}"
 
+       # Don't find interpreters for non-executable files
+       if [ ! -x "${file}" ]; then
+               return 0
+       fi
+
        local interpreter="$(readelf -l "${file}" 2>/dev/null | \
                grep "program interpreter" | tr -d "]" | awk '{ print $NF }')"
 
@@ -105,6 +110,11 @@ find_weak_symbols() {
 find_script_interpreter() {
        local file="${1}"
 
+       # Don't find interpreters for non-executable files
+       if [ ! -x "${file}" ]; then
+               return 0
+       fi
+
        local first_line="$(grep -q "^#!" "${file}" && head -n1 "${file}")"
 
        # Skip files that are not scripts