Skip to content

Commit 7c24b83

Browse files
committed
[fix] Lock report file when writing
When the compilation database contains the compilation of a file twice then file writing may conflict and result a corrupted report file. Fixes #4629
1 parent 09f27e7 commit 7c24b83

File tree

1 file changed

+2
-1
lines changed
  • tools/report-converter/codechecker_report_converter/report/parser

1 file changed

+2
-1
lines changed

tools/report-converter/codechecker_report_converter/report/parser/plist.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import logging
1414
import os
1515
import plistlib
16+
import portalocker
1617
import traceback
1718
import sys
1819

@@ -530,7 +531,7 @@ def convert(
530531
def write(self, data: Any, output_file_path: str):
531532
""" Creates an analyzer output file from the given data. """
532533
try:
533-
with open(output_file_path, 'wb') as f:
534+
with portalocker.Lock(output_file_path, 'wb') as f:
534535
plistlib.dump(data, f)
535536
except TypeError as err:
536537
LOG.error('Failed to write plist file: %s', output_file_path)

0 commit comments

Comments
 (0)