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

Fix includes with relative paths #8147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LEdoian
Copy link

@LEdoian LEdoian commented May 4, 2024

The function load_include_configs already changes the directory to the one containing the parent config. Therefore, load_include_config trying to assemble the "full" path leads to repetition of path segments, making the realpath call fail with ENOENT.

Just calling realpath on the path itself from the directory with the parent configuration is sufficient, so there is no point in passing parent_dir to load_include_config.

What was broken

When running sway with a relative path to confiig, like sway -c tmp/sway-configs/root, if that config includes other file with include other, the file that gets included is in fact tmp/sway-configs/tmp/sway-configs/other relative to where sway was ran from. (Without such directory structure the include fails.)


(oops, I forgor to write this part in the original version)

Alternatives: It would be possible to not change the directory in load_include_configs, but even then the actual path resolution might require a different approach I think (I am thinking about openat, but I haven't thought it through enough).

The function `load_include_configs` already changes the directory to the
one containing the parent config. Therefore, `load_include_config`
trying to assemble the "full" path leads to repetition of path segments,
making the `realpath` call fail with ENOENT.

Just calling `realpath` on the path itself from the directory with the
parent configuration is sufficient, so there is no point in passing
`parent_dir` to `load_include_config`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant