Skip to content

Commit

Permalink
fix: limit filename length of temporary files generated by the persis…
Browse files Browse the repository at this point in the history
…tence backend (metadata, incomplete markers, etc.) (#1780)
  • Loading branch information
johanneskoester committed Jul 26, 2022
1 parent c07732e commit 59053e7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion snakemake/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ def _record(self, subject, json_value, id):
mode="w",
dir=recdir,
delete=False,
suffix=os.path.basename(recpath),
# Add short prefix to final filename for better debugging.
# This may not be the full one, because that may be too long
# for the filesystem in combination with the prefix from the temp
# file.
suffix=f".{os.path.basename(recpath)[:8]}",
) as tmpfile:
json.dump(json_value, tmpfile)
os.rename(tmpfile.name, recpath)
Expand Down

0 comments on commit 59053e7

Please sign in to comment.