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

When canonicalizing classpath URIs, use a bogus root path. #4543

Merged
merged 1 commit into from Mar 24, 2017

Conversation

headius
Copy link
Member

@headius headius commented Mar 23, 2017

This prevents in-classloader paths from expanding using real
filesystem paths that may resolve symlinks.

Fixes #4145.

This prevents in-classloader paths from expanding using real
filesystem paths that may resolve symlinks.

Fixes jruby#4145.
@headius headius added this to the JRuby 9.1.9.0 milestone Mar 23, 2017
@headius headius merged commit 949da51 into jruby:master Mar 24, 2017
@headius headius deleted the fix-4145 branch March 24, 2017 15:34
@presidentbeef
Copy link

Thanks @headius! Now just need #4274 and Brakeman Pro can finally use an up-to-date version of JRuby 😀


if (classloaderURI) {
String fakePrefix = "/THIS_IS_A_FAKE_PATH_FOR_JRUBY";
relativePath = canonicalizePath(fakePrefix + "/" + relativePath).substring(fakePrefix.length());
Copy link

Choose a reason for hiding this comment

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

@headius this ends up being off by two characters on Windows because the canonicalized path will begin with C:. So you end up with classpath:BY\yourpathhere.rb. Sorry I couldn't test ahead of time.

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.

Can't use require_relative with a path beginning with lib in a jar...on Linux
2 participants