Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Problems with paths containing space characters #1248
This is a bit of an essay, sorry. Writing this up in detail to get it straight in my head as much as anything :)
I've recently been having some problems running a JRuby webapp (ArchivesSpace) from within a directory whose path contains space characters. The sorts of errors I'm seeing are:
After a bit of a deep dive into the JRuby internals, I think I've tracked down the cause of the issue and a potential fix.
The crux of the issue seems to be the way spaces in the
(note that the default
But when I look at
So there seems to be a difference in the way the standard JRuby launcher sets the
So if $LOAD_PATH is escaped,
All of this finally brings me to
What I'm seeing is different
In this example:
But in this example (analogous to what jruby-rack is doing):
and that file exists on the filesystem. Unlike
So that's where the difference lies:
So after all of that, all of my problems went away when I modified
Here's the patch for my fix: https://gist.github.com/marktriggs/7575352, and please let me know if I can do any further testing.
referenced this issue
Nov 21, 2013
I've encountered this problem with war files. In attempting to isolate the problem, I have a one line command that fails, but unlike JRUBY-7159, this one liner still fails with jruby 1.7.8:
NameError: method 'to_yaml' not defined in Object
Note the spaces in the directory name. Without the spaces, this command works fine.
That's an interesting one. That seems to relate more to the inconsistency I mentioned in my original message--that a .jar file with spaces in its path is loaded by ClassLoaderSearcher, while others are loaded by NormalSearcher.
If I patch LoadService$NormalSearcher to cope with encoded characters, your problem goes away too:
So maybe both patches are needed after all: the first to stop NormalSearcher producing filenames with encoded characters in them, and the second to allow it to handle paths with encoded URLs in them.
I've run the 'mri19' test suite against both patches and everything passes, so hopefully I'm not too far off the mark :)
referenced this issue
Jan 11, 2014
Both are using jRuby version 1.7.3 and jruby-openssl version 0.9.4
WORKING VERSION PATH WITH SPACE
NOT WORKING VERSION PATH WITH SPACE
I'am hoping this will be fixed soon.
@klinden I've just tried building my patches against the 1.7 branch and they're still applying and building cleanly. Here are the commands I used:
Maven had a bit of a "download the Internet" moment, and after a while produced the files:
@klinden are you running it on Windows ? there is more to the error you get from maven (I hope so) - could make a gist out of it ?
@marktriggs there is an IT for jruby-complete.jar which produces following:
even the jruby-complete-1.7.8,jar gives the same result - so I am not sure what is different with you and me
@mkristian I don't think it's Windows specific, but for my project (ArchivesSpace) we've seen Windows users hit this issue the most often, because spaces in pathnames are more common.
The example you showed works for me too. I think the key thing is that spaces in your $LOAD_PATH have been encoded as '%20', so everything works. But when running a warbler-built .war file under jruby-rack, the $LOAD_PATH ends up with paths containing spaces, and the class loader searcher can't cope with that. This line reproduces what I see when that happens:
I'll convert to a PR and send that along. Is a PR against the 1_7 branch OK? Or should I rework to apply against master?