Skip to content

🐛 fix(unix): ignore inherited media vars for root - #661

Merged
gaborbernat merged 2 commits into
mainfrom
fix/root-media-inherited-xdg
Oct 28, 2026
Merged

gaborbernat merged 2 commits into
mainfrom
fix/root-media-inherited-xdg

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Fixes #659. With use_site_for_root=True, root ignores the invoking user's XDG variables for every directory that has a site equivalent. The media directories and user_fonts_dir have none, so they still followed the inherited XDG_*_DIR, $XDG_CONFIG_HOME/user-dirs.dirs and XDG_DATA_HOME, and under ensure_exists root created the media path it read. 🔒 As redirected root they now return their default under root's home, such as /root/Documents, and create nothing.

The redirect stays in the Unix class, next to the other use_site_for_root branches, so macOS and non-root callers keep their current behavior. A redirected root also stops reading its own /root/.config/user-dirs.dirs, and the parameter reference and the explanation page now say so.

Reported by Anthropic's OSS Scanner: ANT-2026-EKT01S9H.

With use_site_for_root, root skipped the inherited XDG user variables only
for directories with a site equivalent. The media directories still read
XDG_*_DIR and user-dirs.dirs, and created that path under ensure_exists,
and user_fonts_dir still read XDG_DATA_HOME. They now return their default
under root's home.

Fixes #659

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-EKT01S9H.
@gaborbernat gaborbernat added the bug Something isn't working label Oct 28, 2026
@gaborbernat
gaborbernat requested a review from ofek as a code owner October 28, 2026 07:03
@gaborbernat
gaborbernat merged commit 3ee973f into main Oct 28, 2026
68 of 70 checks passed
@gaborbernat
gaborbernat deleted the fix/root-media-inherited-xdg branch October 28, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use_site_for_root: media and fonts dirs read inherited XDG settings

1 participant