Skip to content

path-unix: Only accept absolute paths - #12258

Merged
Dudemanguy merged 1 commit into
mpv-player:masterfrom
linkmauve:absolute-paths
Jul 2, 2026
Merged

path-unix: Only accept absolute paths#12258
Dudemanguy merged 1 commit into
mpv-player:masterfrom
linkmauve:absolute-paths

Conversation

@linkmauve

Copy link
Copy Markdown
Contributor

The XDG Base Directory specification says “All paths set in these environment variables must be absolute. If an implementation encounters a relative path in any of these variables it should consider the path invalid and ignore it.”

@philipl philipl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log something so there's feedback?

@N-R-K

N-R-K commented Aug 26, 2023

Copy link
Copy Markdown
Contributor

Should we log something so there's feedback?

You can't (not without doing hacky shit) since pthread_once doesn't accept a context pointer. There was a discussion about the same issue here: #12135 (comment)

Comment thread osdep/path-unix.c Outdated

// Maintain compatibility with old ~/.mpv
if (home && home[0])
if (home && home[0] == '/')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. $HOME is not part of XDG base dirs.

Same with all the other home[0] == '/' cases.

@linkmauve linkmauve Oct 1, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean programs should happily accept a relative HOME?

(Sorry for having dropped the ball on this PR for two years, I’ll get back to it shortly.)

Edit: This is now fixed, we accept relative HOME again with this PR.

@linkmauve
linkmauve force-pushed the absolute-paths branch 2 times, most recently from 1a6bbbe to dc904b7 Compare October 1, 2025 10:04

@Dudemanguy Dudemanguy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one more xdg_config[0] that popped up in here and now needs a check since the last time I looked at this. The rest looks good.

The XDG Base Directory specification says “All paths set in these
environment variables must be absolute. If an implementation encounters
a relative path in any of these variables it should consider the path
invalid and ignore it.”
@linkmauve

Copy link
Copy Markdown
Contributor Author

There, I changed that in path-darwin.c as well.

@Dudemanguy Dudemanguy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM

@Dudemanguy
Dudemanguy merged commit 0279c0f into mpv-player:master Jul 2, 2026
33 of 34 checks passed
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.

5 participants