SHA256
1
0
forked from pool/rpmlint
rpmlint/0001-split-wrong-script-interpreter-into-env-script-inter.patch

63 lines
3.0 KiB
Diff

From a4618650898aece5c4838e71853310b54f6e29fa Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Sun, 1 Oct 2017 22:08:20 +0200
Subject: [PATCH] split wrong-script-interpreter into env-script-interpreter
For mere mortals, details message for wrong-script-interpreter
does not explain why the env as shebang is an issue. Splitting
that case into a separate diagnostic allows a more detailed
info message alongside that gives a better rationale.
---
FilesCheck.py | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
Index: rpmlint-rpmlint-1.10/FilesCheck.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/FilesCheck.py
+++ rpmlint-rpmlint-1.10/FilesCheck.py
@@ -863,12 +863,15 @@ class FilesCheck(AbstractCheck.AbstractC
elif interpreter or mode_is_exec or script_regex.search(f):
if interpreter:
res = interpreter_regex.search(interpreter)
- 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)
+ if (mode_is_exec or script_regex.search(f)):
+ if res and res.group(1) == 'env':
+ printError(pkg, 'env-script-interpreter',
+ f, interpreter,
+ interpreter_args)
+ elif not res:
+ printError(pkg, 'wrong-script-interpreter',
+ f, interpreter,
+ interpreter_args)
elif not nonexec_file and not \
(lib_path_regex.search(f) and
f.endswith('.la')):
@@ -1303,6 +1306,22 @@ Alternatively, if the file isn't suppose
it is not marked as being executable.
''',
+'env-script-interpreter',
+'''This script uses 'env' as an interpreter.
+For the rpm runtime dependency detection to work, the shebang
+#!/usr/bin/env python
+
+needs to be patched into
+#!/usr/bin/python
+
+otherwise the package dependency generator merely adds a dependency
+on /usr/bin/env rather than the actual interpreter /usr/bin/python.
+
+Alternatively, if the file should not be executed, then ensure that
+it is not marked as executable or don't install it in a path that
+is reserved for executables.
+''',
+
'non-executable-script',
'''This text file contains a shebang or is located in a path dedicated for
executables, but lacks the executable bits and cannot thus be executed. If