Repository navigation
get_runtime_dir: only ask platformdirs if needed (fixes Haiku CI) - #10646
Merged
ThomasWaldmann merged 1 commit intoNov 24, 2026
Merged
Conversation
platformdirs 4.14.8 raises PermissionError if it does not find a safe runtime directory. That is the case on Haiku: there is no /run/user and /tmp is writable by all users without having the sticky bit set. get_runtime_dir computed the platformdirs default even if BORG_RUNTIME_DIR was set, so it failed on Haiku no matter what. Now it only asks platformdirs if neither BORG_RUNTIME_DIR nor BORG_BASE_DIR is set. tests: do not check the platformdirs runtime directory on Haiku, add a test for BORG_RUNTIME_DIR / BORG_BASE_DIR working without platformdirs. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10646 +/- ##
==========================================
- Coverage 89.45% 89.44% -0.01%
==========================================
Files 105 105
Lines 20341 20343 +2
Branches 3199 3200 +1
==========================================
Hits 18196 18196
- Misses 1491 1492 +1
- Partials 654 655 +1 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes the 2 test failures of the Haiku CI job (
test_get_runtime_dir,test_get_dir_subdirsinhelpers/fs_test.py), which fails on master and on all PRs since platformdirs 4.14.8 got released:platformdirs 4.14.8 raises
PermissionErrorif it does not find a safe runtime directory (tox-dev/platformdirs#744). That is the case on Haiku: there is no/run/userand/tmpis writable by all users without having the sticky bit set.Changes:
get_runtime_dir: only ask platformdirs if neitherBORG_RUNTIME_DIRnorBORG_BASE_DIRis set. Before, the platformdirs default was computed (as the default argument ofos.environ.get) even ifBORG_RUNTIME_DIRwas set, so the function failed on Haiku no matter what.test_get_runtime_dir: do not check the platformdirs-derived runtime directory (default andXDG_RUNTIME_DIR) on Haiku, only theBORG_RUNTIME_DIRoverride.test_get_runtime_dir_without_platformdirs:BORG_RUNTIME_DIR/BORG_BASE_DIRwork even ifplatformdirs.user_runtime_dirraises (runs on all platforms, fails without thefs.pychange).Notes for the reviewer:
get_runtime_dirhas no callers outside of the test suite, so this did not affect borg users.get_runtime_dir()still raisesPermissionErrorif neither env var is set; this PR does not add a fallback for that.Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)🤖 Generated with Claude Code