SHA256
1
0
forked from pool/rpmlint
rpmlint/0001-Tighten-wrong-script-interpreter-check-to-lower-fals.patch

33 lines
1.7 KiB
Diff

From 3433a3cc77a05af3a7e0588899f61028b5546e64 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
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(-)
Index: rpmlint-rpmlint-1.10/FilesCheck.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/FilesCheck.py
+++ rpmlint-rpmlint-1.10/FilesCheck.py
@@ -861,7 +861,10 @@ class FilesCheck(AbstractCheck.AbstractC
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 \