Problems with __FILE__ and file loaded from a jar
-------------------------------------------------
Key: JRUBY-3894
URL: http://jira.codehaus.org/browse/JRUBY-3894
Project: JRuby
Issue Type: Bug
Reporter: Rib Rdb
Assignee: Thomas E Enebo
Attachments: jar_with_relative_require1.jar, LoadService.diff
Requireing a jar path that includes .. doesn't work, for example:
'file:something.jar!/foo/../bar'. This causes problems when __FILE__ is of the
form 'file:something.jar!/foo/foo.rb', which happens when you load files from a
jar in your classpath. Several rails scripts seem to depend on this, so they
won't run out of a jar file.
I've attached a patch and testcase for this problem.
While looking through this I've found several other related problems:
- If you add a jar to your loadpath and load a file from it, __FILE__ gets
set to '/filename.rb'; then loading anything relatively based on __FILE__
fails, since it looks like an absolute path.
- It looks like in different places jar paths are accessed using URIs, URLs,
and plain strings. This is fine unless the path has spaces (probably a few
other characters too). URI requires these to be percent-escaped, but the code
doesn't seem to do any escaping or unescaping.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email