Permalink
Browse files

Merge pull request #826 from ratnikov/fix-symlink-load

Support foo.jar that is linked to extensionless jar files
  • Loading branch information...
headius committed Jun 25, 2013
2 parents fb1bd76 + 84e2862 commit 148dc64c917a15aa869a7b26de7930d2aead63b3
Showing with 20 additions and 2 deletions.
  1. +3 −2 src/org/jruby/runtime/load/LoadService.java
  2. +17 −0 test/test_load.rb
@@ -1092,7 +1092,8 @@ protected Library createLibrary(SearchState state, LoadServiceResource resource)
if (resource == null) {
return null;
}
- String file = state.loadName;
+ String file = resource.getName();
+ String location = state.loadName;
if (file.endsWith(".so") || file.endsWith(".dll") || file.endsWith(".bundle")) {
if (runtime.getInstanceConfig().isCextEnabled()) {
return new CExtension(resource);
@@ -1104,7 +1105,7 @@ protected Library createLibrary(SearchState state, LoadServiceResource resource)
} else if (file.endsWith(".class")) {
return new JavaCompiledScript(resource);
} else {
- return new ExternalScript(resource, file);
+ return new ExternalScript(resource, location);
}
}
View
@@ -262,4 +262,21 @@ def test_cwd_plus_dotdot_jar_loading
$hello
})
end
+
+ def test_symlinked_jar
+ Dir.chdir('test') do
+ FileUtils.cp 'jar_with_ruby_files.jar', 'jarwithoutextension' unless File.exists?('jarwithoutextension')
+ File.symlink 'jarwithoutextension', 'symlink.jar' unless File.symlink?('symlink.jar')
+ end
+
+ assert_in_sub_runtime %{
+ require 'test/symlink.jar'
+ }
+ ensure
+ Dir.chdir('test') do
+ [ 'jarwithoutextension', 'symlink.jar' ].each do |file|
+ File.delete(file)
+ end
+ end
+ end
end

0 comments on commit 148dc64

Please sign in to comment.