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

Update xdg.RuntimeFile logic #99

Merged
merged 5 commits into from
Oct 29, 2024
Merged

Update xdg.RuntimeFile logic #99

merged 5 commits into from
Oct 29, 2024

Conversation

adrg
Copy link
Owner

@adrg adrg commented Oct 29, 2024

Update logic of xdg.RuntimeFile: due to the special nature of the runtime directory, the function no longer attempts to create the base directory if it does not exist. If that's the case, the function uses the operating system's temporary directory as a fallback.
The function still creates sub-directories relative to the base runtime directory or its fallback.

Justification: the creation of the runtime directory is not in the scope of this package as it has special requirements defined by the XDG Base Directory Specification. Relevant excerpt:

The lifetime of the directory MUST be bound to the user being logged in. It MUST be created 
when the user first logs in and if the user fully logs out the directory MUST be removed. If 
the user logs in more than once they should get pointed to the same directory, and it is 
mandatory that the directory continues to exist from their first login to their last logout on 
the system, and not removed in between. Files in the directory MUST not survive reboot or a 
full logout/login cycle.

Furthermore, on Linux, the parent directories of the default user runtime directory are owned by the root user so they cannot be created by a regular user. pam_systemd is usually responsible for creating the runtime directory (/run/user/$UID).

Addresses #46.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (3b346cd) to head (221e506).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #99   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          428       475   +47     
=========================================
+ Hits           428       475   +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adrg adrg merged commit 2335a68 into master Oct 29, 2024
16 checks passed
@adrg adrg deleted the improve-runtime-file branch October 29, 2024 13:23
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.

1 participant