Skip to content

feature: write CACHEDIR.TAG into program folder#2311

Merged
tbennun merged 2 commits intospcl:mainfrom
romanc:romanc/cachedir-tag
Feb 26, 2026
Merged

feature: write CACHEDIR.TAG into program folder#2311
tbennun merged 2 commits intospcl:mainfrom
romanc:romanc/cachedir-tag

Conversation

@romanc
Copy link
Contributor

@romanc romanc commented Feb 23, 2026

This PR suggest to write a CACHEDIR.TAG file into the program folder. The tag is an attempt to signal (e.g. to backup software) that the containing folder contains no archival value, see http://www.brynosaurus.com/cachedir/.

While the convention started with cache directories for things like thumbnails of a webbrowser, I'd argue the same argumentation (no archival value, frequent changes, un-suiteable to be located in /var/cache or /tmp) apply for build folders.

Instead of writing the file by hand, we could also a library like https://pypi.org/project/cachedir-tag/.

This PR suggest to write a `CACHEDIR.TAG` file into the program folder.
The tag is an attempt to signal (e.g. to backup software) that the
containing folder contains no archival value. While the convention started
with cache directories for things like thumbnails of a webbrowser, I'd
argue the same argumentation (no archival value, frequent changes,
un-suiteable to be located in `/var/cache` or `/tmp`) apply for build
folders.

We could also a library like https://pypi.org/project/cachedir-tag/. I
thoght writing a file is simple enough.
@romanc romanc changed the title feature: write cachedir.tag into program folder feature: write CACHEDIR.TAG into program folder Feb 23, 2026
hfile.write(contents)

# Write cachedir tag
with open(os.path.join(out_path, "CACHEDIR.TAG"), "w") as f:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add if not identical_file_exists or even os.path.exists (cheaper, better) so that we avoid extraneous I/O. This was also a pertinent discussion item in the original CACHEDIR.TAG pull requests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like this was discussed before? I've checked old PRs/issues and I couldn't find a reference. I also was at the DaCe meeting today and Yakup wouldn't remember so he deferred to your historic knowledge.

Let me know what you think about the current state of the PR. I've changed it to only write the CACHEDIR.TAG if not already present. In the end, I think this is minor and I am fine either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like this was discussed before? I've checked old PRs/issues and I couldn't find a reference. I also was at the DaCe meeting today and Yakup wouldn't remember so he deferred to your historic knowledge.

Let me know what you think about the current state of the PR. I've changed it to only write the CACHEDIR.TAG if not already present. In the end, I think this is minor and I am fine either way.

@romanc romanc requested a review from tbennun February 26, 2026 15:36
@tbennun
Copy link
Collaborator

tbennun commented Feb 26, 2026

cscs-ci run

@tbennun tbennun added this pull request to the merge queue Feb 26, 2026
Merged via the queue into spcl:main with commit 6c07cef Feb 26, 2026
12 checks passed
@tbennun tbennun deleted the romanc/cachedir-tag branch February 26, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants