Skip to content

Fix mixing relative friend paths and absolute classpaths with symlinks #5483

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

Closed
wants to merge 1 commit into from

Conversation

colincross
Copy link
Contributor

The fix for KT-60886 (a5b530d) converted calls to toAbsolutePath() to toRealPath() to fix the testDirectoryWithRelativePath test, which was failing due to comparing a normalized path to an unnormalized path (with ../../.. in it).

Calling toRealPath() instead of toAbsolutePath() to get a normalized path also resolves any symlinks in the path to their targets. Since toRealPath() is not called on the absolute path it is being compared to it results in different absolute paths and the match check always fails.

Use toAbsolutePath().normalize() to produce a normalize absolute path instead.

Fixes https://youtrack.jetbrains.com/issue/KT-80039

The fix for KT-60886 (a5b530d) converted calls to toAbsolutePath()
to toRealPath() to fix the testDirectoryWithRelativePath test, which
was failing due to comparing a normalized path to an unnormalized
path (with ../../.. in it).

Calling toRealPath() instead of toAbsolutePath() to get a normalized
path also resolves any symlinks in the path to their targets.  Since
toRealPath() is not called on the absolute path it is being compared
to it results in different absolute paths and the match check always
fails.

Use toAbsolutePath().normalize() to produce a normalize absolute path
instead.

Fixes https://youtrack.jetbrains.com/issue/KT-80039
@lunakoly
Copy link
Member

Thank you! Merged: 0b88934

@lunakoly lunakoly closed this Aug 11, 2025
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.

2 participants