Initialize cache directory in isolation#12168
Initialize cache directory in isolation#12168bluetech merged 1 commit intopytest-dev:mainfrom tamird:fix-gitignore-missing
Conversation
There was a problem hiding this comment.
Thanks a lot @tamird, appreciate the PR!
Left a few comments, please take a look.
Also, please include a changelog entry in changelog/12167.trivial.rst:
cache: ensure supporting files (``CACHEDIR.TAG``, ``.gitignore``, etc) are always created in the cache directory, even in the event of test session being interrupted.
|
TBH I'm starting to see this change as -0: we are changing how the supporting files are being created for little reason (as the original reason for the issue is no longer valid). I fear we will be introducing subtle bugs for little gain. |
The original reason is as valid as it ever was - I saw this symptom on my local machine. It wasn't communicated properly to start, but validity hasn't changed. |
An interruption between But if @bluetech prefers, then definitely move forward with this. |
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
at first glance the proposed mechanism is broken in most linux deployments simply by degrading to copytree on anything that has TMP on tmpfs
Creating and initializing the cache directory is interruptible; this avoids a pathological case where interrupting a cache write can cause the cache directory to never be properly initialized with its supporting files. Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also properly initializes the cache directory. Closes #12167.
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
given how temporarydirectory actually is used in our case,
a followup at a later point might want to replace it with a simpler mechanism
good work
|
@nicoddemus could you have a look? I believe this is blocked on your approval. |
|
It is not blocked, I will defer merging to @bluetech or @RonnyPfannschmidt. 👍 |
nicoddemus
left a comment
There was a problem hiding this comment.
Ahh my bad, did not realize that.
Relutanctly approving, as I mentioned I'm -0 on this -- need to mark as "Approve" to pass the merge requirements.
|
Now I just need someone to click merge 😄 |
|
Turns out the behavior I was seeing which prompted me to send this PR was in fact caused by |

Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.
Unify
Cache.mkdirwithCache.setwhile I'm here so the former alsoproperly initializes the cache directory.
Closes #12167.