From 9a446ffeace87a82e77e489db2471cde867bbcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 8 Dec 2021 15:19:35 +0000 Subject: [PATCH] brp-mangle-shebangs: also mangle shebangs of JavaScript executables Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2030427 Unfortunately, the MIME type of JavaScript executables is not text/... but application/javascript. See RFC 4329. After considering various approaches to fix this problem, including: 1) limiting the number of characters `file` reads 2) using `eu-elfclassify` instead of `file` This seems like the most sensible approach to fix this one particular problem. If more instances are found problematic in the future, we'll keep adding the MIME types. See the linked bugzilla, the eu-elfclassify pull request [1], and the devel mailing list thread [2] for details about this problem and the considered solutions. [1]: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/145 [2]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/K3QCBUXYR6ZA34I777X6F2RYJKKECJLM/ --- brp-mangle-shebangs | 2 +- redhat-rpm-config.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs index ef85ee4..ab7af60 100755 --- a/brp-mangle-shebangs +++ b/brp-mangle-shebangs @@ -76,7 +76,7 @@ cd "$RPM_BUILD_ROOT" # (Take care to exclude filenames which would mangle "file" output). find -executable -type f ! -path '*:*' ! -path $'*\n*' \ | file -N --mime-type -f - \ -| grep -P ".+(?=: text/)" \ +| grep -P ".+(?=: (text/|application/javascript))" \ | { fail=0 while IFS= read -r line; do diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 3921bca..5e97b9e 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 190 +Version: 191 Release: 1%{?dist} # No version specified. License: GPL+ @@ -189,6 +189,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Wed Dec 08 2021 Miro HronĨok - 191-1 +- brp-mangle-shebangs: also mangle shebangs of JavaScript executables +- Resolves: rhbz#2030427 + * Thu Dec 02 2021 Neal Gompa - 190-1 - Make vpath builddir not include arch-specific info Resolves: rhbz#1984679