warbler icon indicating copy to clipboard operation
warbler copied to clipboard

The path `uri:classloader:\gemtest\.` is not a directory

Open boskowski opened this issue 9 years ago • 9 comments

With

jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) Client VM 25.112-b15 on 1.8.0_112-b15 +jit [mswin32-x86]

I create a new gem with bundle gem gemtest,

gemtest.gemspec now contains:

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'gemtest/version'

Gem::Specification.new do |spec|
  spec.name          = "gemtest"
  spec.version       = Gemtest::VERSION
  spec.authors       = [""]
  spec.summary       = ""

  spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
  spec.bindir        = "exe"
  spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
  spec.require_paths = ["lib"]

  spec.add_development_dependency "bundler", "~> 1.12"
  spec.add_development_dependency "rake", "~> 10.0"
  spec.add_development_dependency "minitest", "~> 5.0"
end

Gemfile.lock after "bundle install":

PATH
  remote: .
  specs:
    gemtest (0.1.0)

GEM
  remote: https://rubygems.org/
  specs:
    minitest (5.9.1)
    rake (10.5.0)

PLATFORMS
  java

DEPENDENCIES
  bundler (~> 1.12)
  gemtest!
  minitest (~> 5.0)
  rake (~> 10.0)

BUNDLED WITH
   1.12.5

warbler installed with:

>gem install warbler
Fetching: jruby-jars-9.1.6.0.gem (100%)
Successfully installed jruby-jars-9.1.6.0
Fetching: jruby-rack-1.1.20.gem (100%)
Successfully installed jruby-rack-1.1.20
Fetching: warbler-2.0.4.gem (100%)
Successfully installed warbler-2.0.4
3 gems installed

warble jar generates a jar with:

no executables found in gemtest.gemspec, using bin/console
rm -f gemtest.jar
Creating gemtest.jar

Now. executing the jar yields:

java -jar gemtest.jar
The path `uri:classloader:\gemtest\.` is not a directory.

This happens systematically when require "bundle/setup" is executed.

Any clues on how to fix this?

Thanks!

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39422955-the-path-uri-classloader-gemtest-is-not-a-directory?utm_campaign=plugin&utm_content=tracker%2F136961&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F136961&utm_medium=issues&utm_source=github).

boskowski avatar Nov 21 '16 11:11 boskowski

windows platform ? it looks very much like it but to be sure.

mkristian avatar Nov 21 '16 16:11 mkristian

@mkristian yeah he posted version string 'mswin32-x86'

enebo avatar Nov 21 '16 16:11 enebo

@mkristian @enebo Correct, the OS for the test above is Windows 10 x64.

I've tested the same procedure on a Ubuntu 16.04 x86_64 with jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +jit [linux-x86_64], where I get:

java -jar gemtest.jar
sh: line 0: cd: uri:classloader:/gemtest: No such file or directory
irb(main):001:0>

except that the error isn't fatal as in the case of Windows (console prompt in the last line).

boskowski avatar Nov 21 '16 18:11 boskowski

so it is not a windows only problem. how does unzip -l gemtest.jar look like ? I am not so familiar with warbler. can it be that warbler does not honor the bindir from the gemspec ?

mkristian avatar Nov 22 '16 09:11 mkristian

@boskowski thanx. I understand now. somehow you start irb or the console and spawns a new process, under linux it is just warning with this funny 'uri:classloader:/` path and in windows it fails here.

better would be to pass the 'current working directory' into the -C flag into the spawned ruby. but that is jruby problem. not sure if that would be practical all situation solution or just for those uri:classloader cases.

I am surprised that warbler does not unpack the jar an execute the whole thing from temp location @kares ?

mkristian avatar Nov 22 '16 14:11 mkristian

@boskowski thanx. I understand now. somehow you start irb or the console and spawns a new process, under linux it is just warning with this funny 'uri:classloader:/` path and in windows it fails here.

better would be to pass the 'current working directory' into the -C flag into the spawned ruby. but that is jruby problem. not sure if that would be practical all situation solution or just for those uri:classloader cases.

I am surprised that warbler does not unpack the jar an execute the whole thing from temp location @kares ?

mkristian avatar Nov 22 '16 14:11 mkristian

@mkristian the issue occurs when require "bundler/setup" is executed. Here's a super-simple gem that exhibits the problem. The main program just prints the version number.

boskowski avatar Nov 22 '16 17:11 boskowski

I wonder if this is related to https://github.com/jruby/jruby/issues/4350

the-michael-toy avatar Dec 16 '16 19:12 the-michael-toy