[packages/rpm-build-tools] check for bad bash shebangs
baggins
baggins at pld-linux.org
Wed Aug 12 09:25:11 CEST 2020
commit cd0845cf35d3f24e9b95df426bc8186d98f5c5df
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Wed Aug 12 09:24:51 2020 +0200
check for bad bash shebangs
check-shebang.py | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/check-shebang.py b/check-shebang.py
index 0f66385..90075bc 100755
--- a/check-shebang.py
+++ b/check-shebang.py
@@ -19,6 +19,7 @@ rep = {
'python3': [],
'perl': [],
'ruby': [],
+ 'bash': [],
}
skip_files = [".h", ".c", ".cc", ".gif", ".png", ".jpg", ".ko", ".gz", ".o"]
@@ -71,6 +72,8 @@ for root, dirs, files in os.walk(args.sourcedir):
rep['perl'].append(fpath)
elif re.compile(r'^#!\s*/usr/bin/env\s+ruby\s').match(shebang):
rep['ruby'].append(fpath)
+ elif re.compile(r'^#!\s*/usr/bin/env\s+bash\s').match(shebang):
+ rep['bash'].append(fpath)
except FileNotFoundError:
pass
@@ -98,3 +101,4 @@ gf("%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python2(\s|$),#!%{__python}\\1,' -
gf("%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+python3(\s|$),#!%{__python3}\\1,' \\", rep['python3'])
gf("%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+perl(\s|$),#!%{__perl}\\1,' \\", rep['perl'])
gf("%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+ruby(\s|$),#!%{__ruby}\\1,' \\", rep['ruby'])
+gf("%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+bash(\s|$),#!/bin/bash\\1,' \\", rep['bash'])
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/cd0845cf35d3f24e9b95df426bc8186d98f5c5df
More information about the pld-cvs-commit
mailing list