Skip to content

🐛 fix(unix): use correct runtime dir path for OpenBSD#440

Merged
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:436
Feb 14, 2026
Merged

🐛 fix(unix): use correct runtime dir path for OpenBSD#440
gaborbernat merged 1 commit intotox-dev:mainfrom
gaborbernat:436

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

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_DIR support in libc via the setxdgenv() function in lib/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:

Fixes #436

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
@gaborbernat gaborbernat requested a review from ofek as a code owner February 14, 2026 16:36
@gaborbernat gaborbernat enabled auto-merge (squash) February 14, 2026 16:39
@gaborbernat gaborbernat merged commit c69a552 into tox-dev:main Feb 14, 2026
29 checks passed
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.

OpenBSD should use /tmp/run/user for user dir

1 participant