Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*bsd get_runtime_dir() #7638

Closed
ThomasWaldmann opened this issue Jun 10, 2023 · 13 comments
Closed

*bsd get_runtime_dir() #7638

ThomasWaldmann opened this issue Jun 10, 2023 · 13 comments
Labels
bug help wanted os: bsd FreeBSD, NetBSD, OpenBSD, ...
Milestone

Comments

@ThomasWaldmann
Copy link
Member

from platformdirs we get /run/user/1001/pytest, then we call os.makedirs(d, mode=511, exist_ok=True) and that fails on os.mkdir("/run", mode=511) due to permission denied.

@ThomasWaldmann ThomasWaldmann added bug os: bsd FreeBSD, NetBSD, OpenBSD, ... labels Jun 10, 2023
@ThomasWaldmann ThomasWaldmann added this to the 2.0.0rc1 milestone Jun 10, 2023
@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Jun 10, 2023

Root cause: there is no /run dir on freebsd (same on openbsd, netbsd), so platformdirs is giving us a invalid directory.

Can someone manage filing a bug there? Thanks!

@ThomasWaldmann
Copy link
Member Author

export BORG_RUNTIME_DIR=/whatever can be used as a workaround until this is fixed.

@ThomasWaldmann ThomasWaldmann changed the title freebsd get_runtime_dir() freebsd openbsd get_runtime_dir() Jun 10, 2023
@ThomasWaldmann ThomasWaldmann changed the title freebsd openbsd get_runtime_dir() *bsd get_runtime_dir() Jun 10, 2023
@RayyanAnsari
Copy link
Contributor

does installing pam_xdg help?

@ThomasWaldmann
Copy link
Member Author

didn't try that. is that something usually found on bsd systems?

@RayyanAnsari
Copy link
Contributor

it's a package in freebsd, not sure about the other ones.
freshports says it has no dependent packages, so I'm guessing it's not installed by default?

@RayyanAnsari
Copy link
Contributor

i was busy for a bit, but it looks like someone contributed a fix in the meantime tox-dev/platformdirs#194

does that fix this?

@ThomasWaldmann
Copy link
Member Author

Left a comment there. Guess it at least does not return a completely invalid path any more.

OTOH, not sure if it always works as expected, see there.

@ThomasWaldmann
Copy link
Member Author

TODO: retry with current platformdirs release.

@RayyanAnsari
Copy link
Contributor

note: platformdirs can also create the directory itself, using the ensure_exists arg.

@RayyanAnsari
Copy link
Contributor

is this now fixed?

@ThomasWaldmann
Copy link
Member Author

Not sure. They merged a change that I guess should work for non-root logged-in users, but not sure about root or when running stuff as a system service.

@ThomasWaldmann
Copy link
Member Author

Current code / packages on freebsd:

>>> from borg.helpers.fs import get_runtime_dir
>>> get_runtime_dir()
'/tmp/runtime-1001/borg'
>>> from platformdirs import *
>>> user_runtime_dir()
'/tmp/runtime-1001'

So guess this is fixed now.

@ThomasWaldmann
Copy link
Member Author

tox-dev/platformdirs#201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted os: bsd FreeBSD, NetBSD, OpenBSD, ...
Projects
None yet
Development

No branches or pull requests

2 participants