Skip to content

user_runtime_dir does not follow the XDG standard, potentially leading to crashes. #368

@lengau

Description

@lengau

The user_runtime_dir method on unix systems other than several BSDs defaults to /run/user/{uid} even if that directory doesn't exist or isn't writable.

This was first discovered by Mozilla and reported here: canonical/craft-application#869

What the XDG Base Directory Specification says to do when it's unset is:

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.

The issue here is that platformdirs is not necessarily checking that the fallback directory is valid.

I'm preparing a PR about it :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions