Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
File path canonicalization still broken inside jars on Windows #4692
Despite #4647 and earlier patches, this issue persists.
As previously, please see https://github.com/presidentbeef/jruby-realpath-error and the simple reproduction steps therein.
I hate to keep mentioning this, but due to this issue we are still stuck releasing on JRuby 1.7.
On Linux with JRuby 22.214.171.124:
On Windows with JRuby 126.96.36.199:
Ah I knew I had downloaded your test repo but now running it I can see require_relative is broken still although I think @kares patch did fix a good chunk of the issues around the fakepath part of it all. So here is a smaller repro:
relative_arg = "lib/test" dir = "classpath:/" p File.expand_path(relative_arg, dir)
This prints out
The C: should not be there...
Yay...so FILE is correct but File.realpath is swapping the / to \. So a second weird behavior.
@presidentbeef Is the reason for doing this to potentially elide stuff like '..' or '.'. I don't think classpath uris can actually have softlinks. With that said it no classpath: uri should ever get converted to back slashes. So it should just get fixed.
…indows This fixed two things in expandPathInternal which displayed differences in File.expand_path, and File.realpath. The fixes themselves are pretty gorey but since they are limited to classpath uris and only on windows I see no risk. We really really need to rewrite expandPathInternal...
@presidentbeef yeah I think you should not need to be concerned with whether you are calling with real filesystem paths or a classpath uri. I just wondered if you were using it for '..'. I am pushing a fix here. I would love it if you could try your product on jruby-9.1 branch and see if it is golden now?