[csw-devel] SF.net SVN: gar:[20195] csw/mgar/gar/v2/lib/python
chninkel at users.sourceforge.net
chninkel at users.sourceforge.net
Mon Jan 21 20:34:17 CET 2013
Revision: 20195
http://gar.svn.sourceforge.net/gar/?rev=20195&view=rev
Author: chninkel
Date: 2013-01-21 19:34:17 +0000 (Mon, 21 Jan 2013)
Log Message:
-----------
gar/v2: add more elfdump lines to be ignored
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/inspective_package.py
csw/mgar/gar/v2/lib/python/inspective_package_test.py
Modified: csw/mgar/gar/v2/lib/python/inspective_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package.py 2013-01-21 16:39:54 UTC (rev 20194)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py 2013-01-21 19:34:17 UTC (rev 20195)
@@ -258,15 +258,17 @@
# later by check functions,
ignored_error_re = re.compile(
r"""[^:]+:(\s\.((SUNW_l)?dynsym|symtab):\s
- (index\[\d+\]:\s
+ ((index\[\d+\]:\s)?
(suspicious\s(local|global)\ssymbol\sentry:\s[^:]+:\slies
\swithin\s(local|global)\ssymbol\srange\s\(index\s[<>=]+\s\d+\)
|bad\ssymbol\sentry:\s[^:]+:\ssection\[\d+\]\ssize:\s0(x[0-9a-f]+)?
- :\ssymbol\s\(address\s0x[0-9a-f]+,\ssize\s0x[0-9a-f]+\)
- \slies\soutside\sof\scontaining\ssection
+ :\s(symbol\s\(address\s0x[0-9a-f]+,\ssize\s0x[0-9a-f]+\)
+ \slies\soutside\sof\scontaining\ssection
+ |is\ssmaller\sthan\ssymbol\ssize:\s\d+)
- |bad\ssymbol\sentry:\s:\sinvalid\sshndx:\s\d+)
+ |bad\ssymbol\sentry:\s:\sinvalid\sshndx:\s\d+
+ |)
|invalid\ssh_link:\s0)
@@ -436,7 +438,7 @@
|Version\sDefinition|Syminfo)
\sSection:
\s+(?:\.SUNW_version|\.gnu\.version_[rd]
- |\.dynsym|\.SUNW_syminfo|.symtab)\s*$
+ |\.(SUNW_l)?dynsym|\.SUNW_syminfo|.symtab)\s*$
|\s*(?:index\s+)?version\s+dependency\s*$ # Version needed header
@@ -537,13 +539,16 @@
r'|\t\t\(file .* size=0(?:x[0-9a-f]+)?; file .*'
r'size=0x(?:[0-9a-f]+)?\)'
r'|\t.* size used; possible data truncation')
+ copy_relocation_error = (r'\tsymbol (?P<copy_reloc_symbol>\S+):'
+ r' file \S+: copy relocation symbol'
+ r' may have been displacement relocated')
blank_line = (r'^\s*$')
- common_re = (r"(%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s)"
+ common_re = (r"(%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s)"
% (found_re, symbol_not_found_re, only_so, version_so,
stv_protected, sizes_differ, sizes_info,
sizes_one_used, unreferenced_object, unused_object,
unused_search_path, blank_line, move_offset_error,
- relocation_error))
+ relocation_error, copy_relocation_error))
m = re.match(common_re, line)
response = None
if m:
@@ -607,6 +612,11 @@
response["soname"] = None
response["path"] = None
response["symbol"] = d['reloc_symbol']
+ elif d["copy_reloc_symbol"]:
+ response["state"] = 'relocation-issue'
+ response["soname"] = None
+ response["path"] = None
+ response["symbol"] = d['copy_reloc_symbol']
else:
raise package.StdoutSyntaxError("Could not parse %s with %s"
Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-01-21 16:39:54 UTC (rev 20194)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-01-21 19:34:17 UTC (rev 20195)
@@ -268,6 +268,58 @@
self.assertEqual(BINARY_ELFINFO, ip.GetBinaryElfInfo())
+ def testGetBinaryElfInfoWithIgnoredErrors(self):
+ fake_binary = 'opt/csw/bin/foo'
+ fake_package_path = '/fake/path/CSWfoo'
+ fake_elfdump_output = '''
+Version Needed Section: .SUNW_version
+ index file version
+ [2] libc.so.1 SUNW_1.1
+
+Symbol Table Section: .dynsym
+ index value size type bind oth ver shndx name
+ [1] 0x00000000 0x00000000 FUNC GLOB D 2 UNDEF fopen64
+
+Syminfo Section: .SUNW_syminfo
+ index flags bound to symbol
+ [1] DBL [1] libc.so.1 fopen64
+'''
+ fake_elfdump_errors = '''
+/opt/csw/bin/foo: .dynsym: index[26]: bad symbol entry: : invalid shndx: 26
+/opt/csw/bin/foo: .dynsym: bad symbol entry: : invalid shndx: 23
+/opt/csw/bin/foo: .dynsym: index[108]: suspicious local symbol entry: _END_: lies within global symbol range (index >= 27)
+/opt/csw/bin/foo: .dynsym: index[4]: bad symbol entry: toto: section[24] size: 0: symbol (address 0x36b7fc, size 0x4) lies outside of containing section
+/opt/csw/bin/foo: .dynsym: bad symbol entry: Xt_app_con: section[28] size: 0: is smaller than symbol size: 4
+'''
+ fake_binary_elfinfo = {'opt/csw/bin/foo': {
+ 'symbol table': [
+ {'shndx': 'UNDEF', 'soname': 'libc.so.1', 'bind': 'GLOB',
+ 'symbol': 'fopen64', 'version': 'SUNW_1.1',
+ 'flags': 'DBL', 'type': 'FUNC'},
+ ],
+ 'version needed': [
+ {'version': 'SUNW_1.1', 'soname': 'libc.so.1'},
+ ],
+ 'version definition': [],
+ }
+ }
+ ip = inspective_package.InspectivePackage(fake_package_path)
+ self.mox.StubOutWithMock(ip, 'ListBinaries')
+ self.mox.StubOutWithMock(ip, 'GetBasedir')
+ self.mox.StubOutWithMock(ip, 'GetFilesDir')
+ ip.ListBinaries().AndReturn([fake_binary])
+ ip.GetBasedir().AndReturn('')
+ ip.GetFilesDir().AndReturn('root')
+
+ self.mox.StubOutWithMock(shell, 'ShellCommand')
+ args = [common_constants.ELFDUMP_BIN,
+ '-svy',
+ os.path.join(fake_package_path, "root", fake_binary)]
+ shell.ShellCommand(args).AndReturn((0, fake_elfdump_output, fake_elfdump_errors))
+ self.mox.ReplayAll()
+
+ self.assertEqual(fake_binary_elfinfo, ip.GetBinaryElfInfo())
+
def testGetLddMinusRlinesRoot(self):
ip = inspective_package.InspectivePackage("/tmp/CSWfake")
self.mox.StubOutWithMock(ip, 'GetBasedir')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list