brp-mangle-shebangs: also mangle shebangs of JavaScript executables

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1998924

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/
This commit is contained in:
Miro Hrončok 2021-12-07 18:02:19 +01:00 committed by churchyard
parent d1702bd08e
commit faf5c36887
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 205
Version: 206
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -190,6 +190,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%doc buildflags.md
%changelog
* Tue Dec 07 2021 Miro Hrončok <mhroncok@redhat.com> - 206-1
- brp-mangle-shebangs: also mangle shebangs of JavaScript executables
- Fixes: rhbz#1998924
* Thu Nov 18 2021 Michal Domonkos <mdomonko@redhat.com> - 205-1
- Drop kernel-rpm-macros subpackage & kmod.attr (new home: kernel-srpm-macros)