Description of problem: I love the added automatic shebang check in redhat-rpm-config. However below file The brp-mangle-shebangs script returns an error for https://github.com/bundler/bundler/blob/v1.16.1/lib/bundler/templates/Executable included in rubygem-bundler RPM package. This file works as a template file. So, this result of the check is wrong. I wish the brp-mangle-shebangs file will be improved to skip this kind of valid files. Right now I will set `%undefine __brp_mangle_shebangs` to avoid this check. But ideally I want to use this awesome check. Version-Release number of selected component (if applicable): redhat-rpm-config-92-1.fc28.noarch How reproducible: Steps to Reproduce: 1. $ cd git:bundler/bundler.git 2. $ cd bundler/lib/bundler/templates 3. Then $ RPM_BUILD_ROOT=$(pwd) sh -x ~/fed/redhat-rpm-config/brp-mangle-shebangs + '[' -z /home/jaruga/git/bundler/lib/bundler/templates -o /home/jaruga/git/bundler/lib/bundler/templates = / ']' + cd /home/jaruga/git/bundler/lib/bundler/templates + fail=0 ++ find -executable -type f ++ xargs --no-run-if-empty file -N --mime-type ++ grep -Po '^\K.+(?=: text/)' + for f in $(find -executable -type f | xargs --no-run-if-empty file -N --mime-type | grep -Po "^\K.+(?=: text/)") ++ stat -c %y ./Executable + ts='2018-01-02 14:51:39.505092825 +0100' + read orig_shebang +++ grep -Po '#!\K.*' +++ echo '#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>' ++ trim /usr/bin/env '<%=' 'Bundler.settings[:shebang]' '||' 'RbConfig::CONFIG["ruby_install_name"]' '%>' ++ printf %s '/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>' + shebang='/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>' + '[' -z '/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>' ']' + '[' '/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>' '!=' / ']' + echo '*** ERROR: ./Executable has shebang which doesn'\''t start with '\''/'\'' (/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>)' *** ERROR: ./Executable has shebang which doesn't start with '/' (/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>) + fail=1 + continue + exit 1 The message "ERROR: ./Executable has shebang which doesn't start with '/' (/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG["ruby_install_name"] %>)" is not right. Because the line starts with "/". Actual results: The script file exits error status. Expected results: The script file exits success status (= 0). Additional info:
The file should not have executable bit. https://src.fedoraproject.org/rpms/rubygem-bundler/c/774469dcf8fe0b5c839880bbf5aa3f6b17652b24?branch=master
Just to elaborate a bit, although I worry about templates, this case does not qualify IMO.
OK. But the message "ERROR: ./Executable has shebang which doesn't start with '/' is not correct. Because actually the line starts with '/'. I still think the message can be improved.
Actually, thx for pointing this out, because looking into the code, it seems the error message is correct, but the code is wrong. Created PR fixing this: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/16 Unfortunately, I am not happy with the outcome, since if the code was correct, Bundler would be building with modified template without notice ...
So the error should be gone: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/51f1c667482c3852a61087df24fbc72a4ae45ed6 Although now the shebang would be mangled, which is not what we want. The discussion should continue in bug 1541318.