From: Michael Tremer Date: Thu, 3 Nov 2022 20:10:18 +0000 (+0000) Subject: scripts: Fix reading binary data in check-interpreters X-Git-Tag: 0.9.28~150 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be92c0b427b17b07e886990e0a3703b4e7f0f1b4;p=pakfire.git scripts: Fix reading binary data in check-interpreters Signed-off-by: Michael Tremer --- diff --git a/src/scripts/check-interpreters b/src/scripts/check-interpreters index 4565756ca..ba7e882e6 100644 --- a/src/scripts/check-interpreters +++ b/src/scripts/check-interpreters @@ -38,14 +38,15 @@ main() { # Find all executable files for file in $(find "${buildroot}" -type f -perm /111 | sort); do - local first_line="$(grep -q "^#!" "${file}" && head -n1 "${file}")" + local shebang="$(head -c2 "${file}")" # Skip files that are not scripts - if [ "${first_line:0:2}" != "#!" ]; then + if [ "${shebang:0:2}" != "#!" ]; then continue fi - local interpreter="${first_line:2}" + local interpreter="$(head -n1 "${file}")" + interpreter="${interpreter:2}" case "${interpreter}" in # Interpreters in /usr/local are illegal