forked from pool/rpmlint
- add postin-speedup.diff, binaryinfo-speedup.diff
OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=363
This commit is contained in:
parent
1c2e4af3e4
commit
68c088a14f
106
binaryinfo-speedup.diff
Normal file
106
binaryinfo-speedup.diff
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
From 4d995b87763076cc2aca25b7836e106708bd926f Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||||
|
Date: Fri, 23 Oct 2015 23:43:16 +0200
|
||||||
|
Subject: [PATCH] Skip checks for problematic function calls if common prefix
|
||||||
|
does not match
|
||||||
|
|
||||||
|
The regexes have a common prefix. If the prefix does not match, none of
|
||||||
|
the regexes will match, continue with the next line.
|
||||||
|
---
|
||||||
|
BinariesCheck.py | 53 ++++++++++++++++++++++++++++++++---------------------
|
||||||
|
1 file changed, 32 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/BinariesCheck.py b/BinariesCheck.py
|
||||||
|
index d2ed87a..52a7aae 100644
|
||||||
|
--- a/BinariesCheck.py
|
||||||
|
+++ b/BinariesCheck.py
|
||||||
|
@@ -28,14 +28,14 @@ DEFAULT_SYSTEM_LIB_PATHS = (
|
||||||
|
def create_regexp_call(call):
|
||||||
|
if type(call) == type([]):
|
||||||
|
call = '(?:' + '|'.join(call) + ')'
|
||||||
|
- r = "\s+FUNC\s+.*?\s+(%s(?:@GLIBC\S+)?)(?:\s|$)" % call
|
||||||
|
+ r = ".*?\s+(%s(?:@GLIBC\S+)?)(?:\s|$)" % call
|
||||||
|
return re.compile(r)
|
||||||
|
|
||||||
|
|
||||||
|
def create_nonlibc_regexp_call(call):
|
||||||
|
if type(call) == type([]):
|
||||||
|
call = '(?:' + '|'.join(call) + ')'
|
||||||
|
- r = "\s+FUNC\s+.*?\s+UND\s+(%s)\s?.*$" % call
|
||||||
|
+ r = ".*?\s+UND\s+(%s)\s?.*$" % call
|
||||||
|
return re.compile(r)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -51,6 +51,7 @@ class BinaryInfo:
|
||||||
|
stack_exec_regex = re.compile('^..E$')
|
||||||
|
undef_regex = re.compile('^undefined symbol:\s+(\S+)')
|
||||||
|
unused_regex = re.compile('^\s+(\S+)')
|
||||||
|
+ call_regex = re.compile('\s0\s+FUNC\s+(.*)')
|
||||||
|
exit_call_regex = create_regexp_call('_?exit')
|
||||||
|
fork_call_regex = create_regexp_call('fork')
|
||||||
|
# regexp for setgid setegid setresgid set(?:res|e)?gid
|
||||||
|
@@ -103,25 +104,8 @@ class BinaryInfo:
|
||||||
|
cmd.append(path)
|
||||||
|
res = Pkg.getstatusoutput(cmd)
|
||||||
|
if not res[0]:
|
||||||
|
- for l in res[1].splitlines():
|
||||||
|
- if BinaryInfo.mktemp_call_regex.search(l):
|
||||||
|
- self.mktemp = True
|
||||||
|
-
|
||||||
|
- if BinaryInfo.setgid_call_regex.search(l):
|
||||||
|
- self.setgid = True
|
||||||
|
-
|
||||||
|
- if BinaryInfo.setuid_call_regex.search(l):
|
||||||
|
- self.setuid = True
|
||||||
|
-
|
||||||
|
- if BinaryInfo.setgroups_call_regex.search(l):
|
||||||
|
- self.setgroups = True
|
||||||
|
-
|
||||||
|
- if BinaryInfo.chdir_call_regex.search(l):
|
||||||
|
- self.chdir = True
|
||||||
|
-
|
||||||
|
- if BinaryInfo.chroot_call_regex.search(l):
|
||||||
|
- self.chroot = True
|
||||||
|
-
|
||||||
|
+ lines = res[1].splitlines()
|
||||||
|
+ for l in lines:
|
||||||
|
r = BinaryInfo.needed_regex.search(l)
|
||||||
|
if r:
|
||||||
|
self.needed.append(r.group(1))
|
||||||
|
@@ -154,6 +138,33 @@ class BinaryInfo:
|
||||||
|
self.exec_stack = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
+ if l.startswith("Symbol table"):
|
||||||
|
+ break
|
||||||
|
+
|
||||||
|
+ for l in lines:
|
||||||
|
+ r = BinaryInfo.call_regex.search(l)
|
||||||
|
+ if not r:
|
||||||
|
+ continue
|
||||||
|
+ l = r.group(1)
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.mktemp_call_regex.search(l):
|
||||||
|
+ self.mktemp = True
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.setgid_call_regex.search(l):
|
||||||
|
+ self.setgid = True
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.setuid_call_regex.search(l):
|
||||||
|
+ self.setuid = True
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.setgroups_call_regex.search(l):
|
||||||
|
+ self.setgroups = True
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.chdir_call_regex.search(l):
|
||||||
|
+ self.chdir = True
|
||||||
|
+
|
||||||
|
+ if BinaryInfo.chroot_call_regex.search(l):
|
||||||
|
+ self.chroot = True
|
||||||
|
+
|
||||||
|
if BinaryInfo.forbidden_functions:
|
||||||
|
for r_name, func in BinaryInfo.forbidden_functions.items():
|
||||||
|
ret = func['f_regex'].search(l)
|
||||||
|
--
|
||||||
|
2.7.0
|
||||||
|
|
47
postin-speedup.diff
Normal file
47
postin-speedup.diff
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From 1436dd7bc41115af658cf8f36a3149ab90a61fcf Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||||
|
Date: Sun, 1 Nov 2015 19:32:57 +0100
|
||||||
|
Subject: [PATCH] Expand postin/postun once per pkg instead once per file
|
||||||
|
|
||||||
|
---
|
||||||
|
FilesCheck.py | 20 ++++++++++----------
|
||||||
|
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
Index: rpmlint-rpmlint-1.8/FilesCheck.py
|
||||||
|
===================================================================
|
||||||
|
--- rpmlint-rpmlint-1.8.orig/FilesCheck.py
|
||||||
|
+++ rpmlint-rpmlint-1.8/FilesCheck.py
|
||||||
|
@@ -863,6 +863,16 @@ class FilesCheck(AbstractCheck.AbstractC
|
||||||
|
elif debuginfo_package:
|
||||||
|
printError(pkg, 'empty-debuginfo-package')
|
||||||
|
|
||||||
|
+ # Prefetch scriptlets, strip quotes from them (#169)
|
||||||
|
+ postin = pkg[rpm.RPMTAG_POSTIN] or \
|
||||||
|
+ pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
|
||||||
|
+ if postin:
|
||||||
|
+ postin = quotes_regex.sub('', postin)
|
||||||
|
+ postun = pkg[rpm.RPMTAG_POSTUN] or \
|
||||||
|
+ pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
|
||||||
|
+ if postun:
|
||||||
|
+ postun = quotes_regex.sub('', postun)
|
||||||
|
+
|
||||||
|
# Unique (rdev, inode) combinations
|
||||||
|
hardlinks = {}
|
||||||
|
|
||||||
|
@@ -976,16 +986,6 @@ class FilesCheck(AbstractCheck.AbstractC
|
||||||
|
printError(pkg, 'non-standard-executable-perm', f,
|
||||||
|
"%o" % perm)
|
||||||
|
|
||||||
|
- # Prefetch scriptlets, strip quotes from them (#169)
|
||||||
|
- postin = pkg[rpm.RPMTAG_POSTIN] or \
|
||||||
|
- pkg.scriptprog(rpm.RPMTAG_POSTINPROG)
|
||||||
|
- if postin:
|
||||||
|
- postin = quotes_regex.sub('', postin)
|
||||||
|
- postun = pkg[rpm.RPMTAG_POSTUN] or \
|
||||||
|
- pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)
|
||||||
|
- if postun:
|
||||||
|
- postun = quotes_regex.sub('', postun)
|
||||||
|
-
|
||||||
|
if not devel_pkg:
|
||||||
|
if lib_path_regex.search(f):
|
||||||
|
lib_file = True
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jan 21 12:19:02 UTC 2016 - dmueller@suse.com
|
||||||
|
|
||||||
|
- add postin-speedup.diff, binaryinfo-speedup.diff
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 20 09:22:21 UTC 2016 - krahmer@suse.com
|
Wed Jan 20 09:22:21 UTC 2016 - krahmer@suse.com
|
||||||
|
|
||||||
|
@ -106,6 +106,10 @@ Patch47: check-for-self-provides.diff
|
|||||||
Patch48: add-check-for-tmpfiles-created-at-r.diff
|
Patch48: add-check-for-tmpfiles-created-at-r.diff
|
||||||
Patch49: remove-files-attr-not-set-check.diff
|
Patch49: remove-files-attr-not-set-check.diff
|
||||||
Patch50: fix-shared-library-matching.diff
|
Patch50: fix-shared-library-matching.diff
|
||||||
|
# https://github.com/rpm-software-management/rpmlint/commit/1436dd7bc41115af658cf8f36a3149ab90a61fcf.patch
|
||||||
|
Patch51: postin-speedup.diff
|
||||||
|
# https://github.com/rpm-software-management/rpmlint/commit/37fe9d4f237c2cb29fcb3b60d1ece189e578eeaf.patch and followup regression fixes
|
||||||
|
Patch52: binaryinfo-speedup.diff
|
||||||
# PATCHLIST END
|
# PATCHLIST END
|
||||||
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
|
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
Loading…
Reference in New Issue
Block a user