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

Problem with /run/user folder in VS Code dev containers with user_runtime_path #315

Open
domdomegg opened this issue Oct 5, 2024 · 2 comments

Comments

@domdomegg
Copy link

In VS Code dev containers, there is no /run/user folder in the default Python container.

This means using user_runtime_path and trying to put anything there (or using the ensure_exists argument) will result in a crash, with PermissionError: [Errno 13] Permission denied: '/run/user'.

I'm not certain what the best route forwards is here, and this is not my area of expertise! Some tentative thoughts:

  • A good solution might be to fall back to a different user runtime directory location if /run/user doesn't exist.
  • An alternative would be to push this back to users of this package, warning them in the docs that the directory might not exist and they should check it beforehand (although this seems unideal).
  • Or maybe the default Python dev container should be updated so it does have a runtime dir.
@ofek
Copy link
Collaborator

ofek commented Oct 5, 2024

Based on https://specifications.freedesktop.org/basedir-spec/latest/index.html:

If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message. Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.

I think we should provide a different location if it doesn't exist.

@ncoghlan
Copy link

ncoghlan commented Oct 6, 2024

https://serverfault.com/questions/388840/good-default-for-xdg-runtime-dir has some decent suggested fallbacks - in particular, creating a folder named after the service/application and logged in user in the system tmp directory.

Since user_runtime_dir takes appname and appauthor parameters, a decent tmp dir fallback folder name would be f"{appauthor}-{appname}-{username}".

When ensure_exists is used, the fallback folder should be explicitly created with 700 permissions when it's outside the user's home directory (and hence won't get user-only permissions by default).

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

No branches or pull requests

3 participants