glibcymbols.read_abilist: Add check for duplicate symbols
authorFlorian Weimer <fweimer@redhat.com>
Tue, 16 Mar 2021 14:56:50 +0000 (15:56 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 16 Mar 2021 14:57:16 +0000 (15:57 +0100)
This detects some bogus abilist files.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
scripts/glibcsymbols.py

index e329ead..1bdd19e 100644 (file)
@@ -63,7 +63,10 @@ def read_abilist(path):
     with open(path) as inp:
         for line in inp:
             version, symbol, flags = line.strip().split(' ', 2)
-            result[VersionedSymbol(symbol, version)] = flags
+            versym = VersionedSymbol(symbol, version)
+            if versym in result:
+                raise IOError("{}: duplicate symbol {}".format(path, versym))
+            result[versym] = flags
     return result
 
 def abilist_lines(symbols):