Open domdomegg opened 1 month ago
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.
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).
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 theensure_exists
argument) will result in a crash, withPermissionError: [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:
/run/user
doesn't exist.