From 3433a3cc77a05af3a7e0588899f61028b5546e64 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 1 Oct 2017 14:00:26 +0200 Subject: [PATCH] Tighten wrong-script-interpreter check to lower false positives The check wasn't looking if the file is actually marked as executable or in one of the known-scripts-only directories. Without this patch, the check will fire on documentation examples that just happen to be detected as script, but where the shebang isn't actually captured by the find_requires rpm scripts. Omit warning about those, as there are more likely legitimate reasons. --- FilesCheck.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FilesCheck.py b/FilesCheck.py index 1852b38..0b93e73 100644 --- a/FilesCheck.py +++ b/FilesCheck.py @@ -848,7 +848,10 @@ class FilesCheck(AbstractCheck.AbstractCheck): elif interpreter or mode_is_exec or script_regex.search(f): if interpreter: res = interpreter_regex.search(interpreter) - if (res and res.group(1) == 'env') or not res: + is_wrong_interpreter = (not res or (res and + res.group(1) == 'env')) + if ((mode_is_exec or script_regex.search(f)) and + is_wrong_interpreter): printError(pkg, 'wrong-script-interpreter', f, interpreter, interpreter_args) elif not nonexec_file and not \ -- 2.14.1