Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Store temp .plist files in report dir during store #4248

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions web/client/codechecker_client/cmd/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,21 +497,22 @@ def assemble_zip(inputs,
file_paths.update(report.original_files)
file_report_positions[report.file.original_path].add(report.line)

files_to_delete = []
temp_dir = tempfile.mkdtemp('-unique-plists', dir=inputs[0])
for dirname, analyzer_reports in unique_reports.items():
for analyzer_name, reports in analyzer_reports.items():
if not analyzer_name:
analyzer_name = 'unknown'
_, tmpfile = tempfile.mkstemp(f'-{analyzer_name}.plist')
_, tmpfile = tempfile.mkstemp(
f'-{analyzer_name}.plist', dir=temp_dir)

report_file.create(tmpfile, reports, checker_labels,
AnalyzerInfo(analyzer_name))
LOG.debug(f"Stored '{analyzer_name}' unique reports in {tmpfile}.")
files_to_compress[dirname].add(tmpfile)
files_to_delete.append(tmpfile)

if changed_files:
reports_helper.dump_changed_files(changed_files)
shutil.rmtree(temp_dir)
sys.exit(1)

if not file_paths:
Expand Down Expand Up @@ -632,6 +633,7 @@ def assemble_zip(inputs,

Configured report limit for this product: {p.reportLimit}
""")
shutil.rmtree(temp_dir)
sys.exit(1)

zip_size = os.stat(zip_file).st_size
Expand All @@ -649,8 +651,7 @@ def assemble_zip(inputs,
sizeof_fmt(zip_size), sizeof_fmt(compressed_zip_size))

# We are responsible for deleting these.
for file in files_to_delete:
os.remove(file)
shutil.rmtree(temp_dir)


def should_be_zipped(input_file: str, input_files: Iterable[str]) -> bool:
Expand Down
Loading