[2.9.x] Avoid error at shutdown if tmpdir is not writeable but was not used in the first place (backport #13039) by @gaeljw #13116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Helpful things
Fixes
Fixes #13013
Purpose
Do not try to delete the temporary folder during shutdown if it was never created in the 1st place. Because when trying to delete, it actually tries to create the folder if it was not already created. This is useless and can cause errors with read-only filesystems.
Background Context
I used a simple mutable
varas I believe this is enough in this context: thevaris private, in a singleton, only set during alazy valinitialization.However, if you believe we should use an
AtomicBoolean, just say it :)Note that I didn't add test, not sure if this is worth it and I'm not sure how to approach writing such a test.
References
N/A
This is an automatic backport of pull request #13039 done by [Mergify](https://mergify.com).