🐛 fix(unix): use correct runtime dir path for OpenBSD#440
Merged
gaborbernat merged 1 commit intotox-dev:mainfrom Feb 14, 2026
Merged
🐛 fix(unix): use correct runtime dir path for OpenBSD#440gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat merged 1 commit intotox-dev:mainfrom
Conversation
OpenBSD now has native XDG_RUNTIME_DIR support in libc via setxdgenv(),
which creates directories at /tmp/run/user/{uid}. The previous fallback
path of /var/run/user/{uid} is not writable by regular users on OpenBSD,
causing applications to unnecessarily fall back to temporary directories.
Split the BSD platform detection to handle OpenBSD separately from
FreeBSD and NetBSD, which both use /var/run/user/{uid}. This aligns
with OpenBSD's official implementation in lib/libc/gen/login_cap.c.
Fixes tox-dev#436
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.
OpenBSD applications using platformdirs were unnecessarily falling back to temporary directories because the default runtime path
/var/run/user/{uid}is not writable by regular users on OpenBSD. 🔒 This issue was reported by OpenBSD package maintainers who noticed the mismatch with the platform's native XDG implementation.OpenBSD now has native
XDG_RUNTIME_DIRsupport in libc via thesetxdgenv()function inlib/libc/gen/login_cap.c, which creates directories at/tmp/run/user/{uid}with proper ownership and permissions. The fix splits the BSD platform detection to handle OpenBSD separately from FreeBSD and NetBSD, which both continue using/var/run/user/{uid}. ✨This change aligns platformdirs with OpenBSD's official implementation while preserving existing behavior for FreeBSD and NetBSD. Applications on OpenBSD will now correctly use the runtime directory created by the system during login instead of falling back to temporary directories.
Documentation References
During investigation, the following official platform documentation was reviewed:
setxdgenv()in login_cap.c - uses/tmp/run/user/{uid}pam_xdgmodule - uses/var/run/xdg/{username}(platformdirs fallback of/var/run/user/{uid}is reasonable)Fixes #436