[clang] 8cbd3f4 - [analyzer] SATestBuild.py: Be defensive against corrupt plist files.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Wed May 13 04:13:10 PDT 2020
Author: Artem Dergachev
Date: 2020-05-13T14:13:00+03:00
New Revision: 8cbd3f431a919e3398683bb5b72fdd781798bcc8
URL: https://github.com/llvm/llvm-project/commit/8cbd3f431a919e3398683bb5b72fdd781798bcc8
DIFF: https://github.com/llvm/llvm-project/commit/8cbd3f431a919e3398683bb5b72fdd781798bcc8.diff
LOG: [analyzer] SATestBuild.py: Be defensive against corrupt plist files.
Added:
Modified:
clang/utils/analyzer/SATestBuild.py
Removed:
################################################################################
diff --git a/clang/utils/analyzer/SATestBuild.py b/clang/utils/analyzer/SATestBuild.py
index 347f1e2dd5e0..42b2658f5303 100755
--- a/clang/utils/analyzer/SATestBuild.py
+++ b/clang/utils/analyzer/SATestBuild.py
@@ -58,6 +58,7 @@
import sys
import threading
import time
+from xml.parsers.expat import ExpatError
try:
import queue
except ImportError:
@@ -485,10 +486,14 @@ def CleanUpEmptyPlists(SBOutputDir):
for F in glob.glob(SBOutputDir + "/*/*.plist"):
P = os.path.join(SBOutputDir, F)
- Data = plistlib.readPlist(P)
- # Delete empty reports.
- if not Data['files']:
- os.remove(P)
+ try:
+ Data = plistlib.readPlist(P)
+ # Delete empty reports.
+ if not Data['files']:
+ os.remove(P)
+ continue
+ except ExpatError as e:
+ print('Error parsing plist file %s: %s' % (P, str(e)))
continue
More information about the cfe-commits
mailing list