forked from pool/rpmlint
5e20a03ee9
Copy from Base:System/rpmlint based on submit request 30231 from user lnussel OBS-URL: https://build.opensuse.org/request/show/30231 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=50
69 lines
2.7 KiB
Diff
69 lines
2.7 KiB
Diff
--- BinariesCheck.py
|
|
+++ BinariesCheck.py
|
|
@@ -37,6 +37,8 @@
|
|
unused_regex = re.compile('^\s+(\S+)')
|
|
exit_call_regex = re.compile('\s+FUNC\s+.*?\s+(_?exit(?:@\S+)?)(?:\s|$)')
|
|
fork_call_regex = re.compile('\s+FUNC\s+.*?\s+(fork(?:@\S+)?)(?:\s|$)')
|
|
+ debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+')
|
|
+ symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+')
|
|
|
|
def __init__(self, pkg, path, file, is_ar, is_shlib):
|
|
self.readelf_error = False
|
|
@@ -51,6 +53,8 @@
|
|
self.exec_stack = False
|
|
self.exit_calls = []
|
|
fork_called = False
|
|
+ self.debuginfo = 0
|
|
+ self.symtab=0
|
|
self.tail = ''
|
|
|
|
is_debug = path.endswith('.debug')
|
|
@@ -103,6 +107,14 @@
|
|
fork_called = True
|
|
continue
|
|
|
|
+ if BinaryInfo.debuginfo_regex.search(l):
|
|
+ self.debuginfo=1
|
|
+ continue
|
|
+
|
|
+ if BinaryInfo.symtab_regex.search(l):
|
|
+ self.symtab=1
|
|
+ continue
|
|
+
|
|
if self.non_pic:
|
|
self.non_pic = 'TEXTREL' in res[1]
|
|
|
|
@@ -254,6 +266,17 @@
|
|
bin_info = BinaryInfo(
|
|
pkg, pkgfile.path, fname, is_ar, is_shlib)
|
|
|
|
+ # stripped static library
|
|
+ if is_ar:
|
|
+ if bin_info.readelf_error:
|
|
+ pass
|
|
+ elif not bin_info.symtab:
|
|
+ printError(pkg, 'static-library-without-symtab', fname)
|
|
+ elif not bin_info.debuginfo and \
|
|
+ (os.environ.get('BUILD_IS_RUNNING', None) == None or \
|
|
+ os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1):
|
|
+ printWarning(pkg, 'static-library-without-debuginfo', fname)
|
|
+
|
|
# so name in library
|
|
if is_shlib:
|
|
has_lib = True
|
|
@@ -485,6 +508,14 @@
|
|
'ldd-failed',
|
|
'''Executing ldd on this file failed, all checks could not be run.''',
|
|
|
|
+'static-library-without-symtab',
|
|
+'''The static library doesn't contain any symbols and therefore can't be linked
|
|
+against. This may indicated that it was strip.''',
|
|
+
|
|
+'static-library-without-debuginfo',
|
|
+'''The static library doesn't contain any debuginfo. Binaries linking against
|
|
+this static library can't be properly debugged.''',
|
|
+
|
|
'executable-stack',
|
|
'''The binary declares the stack as executable. Executable stack is usually an
|
|
error as it is only needed if the code contains GCC trampolines or similar
|