Skip to content

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

Merged
headius merged 1 commit intojruby:masterfrom
headius:fix-4145
Mar 24, 2017
Merged

When canonicalizing classpath URIs, use a bogus root path.#4543
headius merged 1 commit intojruby:masterfrom
headius:fix-4145

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

@presidentbeef presidentbeef May 25, 2017

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