Skip to content

Commit

Permalink
[fix] Use module uuid instead of tempfile
Browse files Browse the repository at this point in the history
The problem with tempfile.mkstem() is that it opens the created file,
and it must be closed through its file descriptor, otherwise some
dangling .nfs files remain when CodeChecker is used in an NFS drive.
For this reason we use uuid instead.
  • Loading branch information
bruntib committed Jun 3, 2024
1 parent e2037fa commit 7b24f12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/client/codechecker_client/cmd/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import signal
import sys
import tempfile
import uuid
import zipfile
import zlib
import shutil
Expand Down Expand Up @@ -502,8 +503,8 @@ def assemble_zip(inputs,
for analyzer_name, reports in analyzer_reports.items():
if not analyzer_name:
analyzer_name = 'unknown'
_, tmpfile = tempfile.mkstemp(
f'-{analyzer_name}.plist', dir=temp_dir)
tmpfile = os.path.join(
temp_dir, f'{uuid.uuid4()}-{analyzer_name}.plist')

report_file.create(tmpfile, reports, checker_labels,
AnalyzerInfo(analyzer_name))
Expand Down

0 comments on commit 7b24f12

Please sign in to comment.