2017-09-28 23:08:20 +02:00
|
|
|
From bcc9a315dae3aacf27854f16328c59e32eab2816 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dirk Mueller <dirk@dmllr.de>
|
|
|
|
Date: Thu, 28 Sep 2017 23:04:22 +0200
|
|
|
|
Subject: [PATCH 3/3] Tighten lib_regex to avoid false positive in python
|
|
|
|
bindings
|
|
|
|
|
|
|
|
Also add unit test coverage for it.
|
|
|
|
---
|
|
|
|
FilesCheck.py | 2 +-
|
|
|
|
test/test_files.py | 17 +++++++++++++++++
|
|
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
|
2017-10-04 15:59:08 +02:00
|
|
|
Index: rpmlint-rpmlint-1.10/FilesCheck.py
|
|
|
|
===================================================================
|
|
|
|
--- rpmlint-rpmlint-1.10.orig/FilesCheck.py
|
|
|
|
+++ rpmlint-rpmlint-1.10/FilesCheck.py
|
|
|
|
@@ -197,7 +197,7 @@ devel_regex = re.compile(r'(.*)-(debug(i
|
2017-09-28 23:08:20 +02:00
|
|
|
debuginfo_package_regex = re.compile(r'-debug(info)?$')
|
|
|
|
debugsource_package_regex = re.compile(r'-debugsource$')
|
|
|
|
use_debugsource = Config.getOption('UseDebugSource', False)
|
|
|
|
-lib_regex = re.compile(r'lib(64)?/lib[^/]*(\.so\..*|-[0-9.]+\.so)')
|
2017-10-04 15:59:08 +02:00
|
|
|
+lib_regex = re.compile(r'/lib(?:64)?/lib[^/]+(?:\.so\.[\d\.]+|-[\d\.]+\.so)$')
|
2017-09-28 23:08:20 +02:00
|
|
|
ldconfig_regex = re.compile(r'^[^#]*ldconfig', re.MULTILINE)
|
|
|
|
depmod_regex = re.compile(r'^[^#]*depmod', re.MULTILINE)
|
|
|
|
install_info_regex = re.compile(r'^[^#]*install-info', re.MULTILINE)
|
2017-10-04 15:59:08 +02:00
|
|
|
Index: rpmlint-rpmlint-1.10/test/test_files.py
|
|
|
|
===================================================================
|
|
|
|
--- rpmlint-rpmlint-1.10.orig/test/test_files.py
|
|
|
|
+++ rpmlint-rpmlint-1.10/test/test_files.py
|
|
|
|
@@ -62,3 +62,22 @@ def test_scm_regex():
|
2017-09-28 23:08:20 +02:00
|
|
|
assert scm_regex.search('/bar/foo,v')
|
|
|
|
assert scm_regex.search('bar/.svnignore')
|
|
|
|
assert scm_regex.search('bar/.git/refs')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def test_lib_regex():
|
|
|
|
+ from FilesCheck import lib_regex
|
|
|
|
+
|
|
|
|
+ # true matches
|
|
|
|
+ assert all(
|
|
|
|
+ lib_regex.search(x) for x in
|
|
|
|
+ ('/lib/libnsl-2.26.so',
|
2017-10-04 15:59:08 +02:00
|
|
|
+ '/usr/lib64/libgnomeui.so.3',
|
2017-09-28 23:08:20 +02:00
|
|
|
+ '/lib64/libgcc_s.so.1'))
|
|
|
|
+
|
|
|
|
+ # false positives
|
|
|
|
+ assert not any(
|
|
|
|
+ lib_regex.search(x) for x in
|
|
|
|
+ ('/usr/share/gdb/auto-load/usr/lib/libglib-2.0.so.0.4600.1-gdb.py',
|
2017-10-01 22:20:21 +02:00
|
|
|
+ '/usr/share/doc/findlib/lib-1.0.so',
|
|
|
|
+ '/usr/lib64/libvulkan_radeon.so',
|
2017-10-04 15:59:08 +02:00
|
|
|
+ '/usr/lib64/rsocket/binary',))
|