Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil TypError on bundle install, regression 1.7.14+ #1975

Closed
dekellum opened this Issue Sep 15, 2014 · 15 comments

Comments

Projects
None yet
3 participants
@dekellum
Copy link
Contributor

dekellum commented Sep 15, 2014

A simple 'bundle install' fails on these jruby versions, while it works fine on 1.7.13:

jruby 1.7.14 (1.9.3p392) 2014-08-27 d368971 on OpenJDK 64-Bit Server VM 1.8.0_20-b23 +jit [linux-amd64]
jruby 1.7.15 (1.9.3p392) 2014-09-03 82b5cc3 on OpenJDK 64-Bit Server VM 1.8.0_20-b23 +jit [linux-amd64]

jbundle install output:

Resolving dependencies...
...
TypeError: can't convert nil into String
An error occurred while installing foobar (0.1.0), and Bundler cannot
continue.

`jbundle install --verbose' shows a stack trace which goes through "jar_installer.rb" which is apparently part of the 'jar-dependences' default/imposed gem described in #1974. I have not referenced this gem or enabled it in any way I know of.

TypeError: can't convert nil into String
org/jruby/RubyFile.java:511:in `basename'
org/jruby/RubyKernel.java:1101:in `eval'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/shared/jar_installer.rb:130:in `setup'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/shared/jar_installer.rb:140:in `setup'
org/jruby/RubyDir.java:331:in `chdir'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/shared/jar_installer.rb:139:in `setup'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/shared/jar_installer.rb:120:in `initialize'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/shared/jar_install_post_install_hook.rb:27:in `(root)'
org/jruby/RubyProc.java:271:in `call'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/source/path.rb:214:in `run_hooks'
org/jruby/RubyArray.java:1613:in `each'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/source/path.rb:213:in `run_hooks'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/source/path.rb:191:in `generate_bin'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/source/path.rb:73:in `install'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:104:in `install_gem_from_spec'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/rubygems_integration.rb:162:in `with_build_args'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:103:in `install_gem_from_spec'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:261:in `install_sequentially'
org/jruby/RubyArray.java:1613:in `each'
/usr/local/lib/jruby/jruby-1.7.15/lib/ruby/1.9/forwardable.rb:201:in `each'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:260:in `install_sequentially'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:90:in `run'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/installer.rb:18:in `install'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/cli/install.rb:78:in `run'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/cli.rb:145:in `install'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/vendor/thor/command.rb:27:in `run'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/vendor/thor.rb:363:in `dispatch'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/vendor/thor/base.rb:440:in `start'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/cli.rb:9:in `start'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/bin/bundle:20:in `(root)'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
/home/david/.gem/jruby/1.9/gems/bundler-1.7.0/bin/bundle:18:in `(root)'
org/jruby/RubyKernel.java:1081:in `load'
/home/david/bin/jbundle:23:in `(root)'
@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

Above uses bundler 1.7.0. Same issue with bundler 1.7.3.

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

Also no luck in avoiding this by install the latest version of jar-dependencies (0.1.0). The stack trace remains the same (referencing ruby/shared/jar_installer), which suggests that it does not use the latest version in my rubygems. Thus any subsequent fix in the rubygem will not help?

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

Interestingly with jar-dependencies 0.1.0 installed in my local rubygems, it will now also fail with comparable stack trace on jruby 1.7.13 (Apparently the gem/bundler extension gets loaded in this case.) So this is a real gem of a virus, my environment is broken with it installed in any normal location.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 15, 2014

having only the stacktrace I might be able to address the issue or not. it would be really helpful to get some more info on how to reproduce the error - a minimal Gemfile + Jarfile, are you using rbenv, rvm or chruby or so ?

and there seems to be the issue that rubygems does not activate the installed gem and prefers the default gems - that is not really an issue with jar-dependencies default gem. does this hold true for other default gems with you ? like jruby-openssl ?

if jruby-1.7.13 does not work anymore with you - an uninstall of jar-dependencies helps ;)

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

I'm not using a "Jarfile" nor any shell environment fiddling systems (rvm, etc.)

Re: jruby-1.7.13: Yes, obviously.

I will look into provided you a simplified example.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 15, 2014

the Jarfile assumption came from you using jbundle instead of bundle ;)

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

jbundle is via 'jgem install --format-executable bundler'

OK, its looks like jar-dependencies fails on any projects I have that use rjack-tarpit for build automation. Please clone and try to bundle install these with jruby 1.7.14+

http://github.com/dekellum/iyyov
http://github.com/dekellum/fishwife

I'm sure jar-dependencies is doing great things for you and other people, and I have it on my list to take a look, but it should be opt-in, not imposed in a JRuby patch/bug-fix release! See #1974.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 15, 2014

I could reproduce the issue with the above repo. and a fixed jar-dependencies-0.1.1.gem installed as gem does work. so I am not sure what to do with your observation that the installed jar-dependencies-0.1.0.gem did not get activated.

any ways I push jar-dependencies-0.1.1.dev.gem - please let me know if this gem works for you.

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

Yes, this manages to rescue * and avoid the subcase on jruby 1.7.13 when any version of the jar-dependencies gem is installed. Just to be clear, this doesn't yet address the main issue described, since alt versions can't be loaded/used, and in any case a jruby 1.7.14+ patch release update should not require me to install new dependencies, that I don't opt-in to use.

@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 15, 2014

well, the above gem does solve your problem for all jruby-1.7.1x versions on my side. not sure why the installed gem does not get used on your side.

when I execute jruby -r jar_installer -e 'p Gem.loaded_specs' or jruby -e 'require "jar_installer";p Gem.loaded_specs' I see

{"jar-dependencies"=>#<Gem::Specification:0x7d0 jar-dependencies-0.1.1.dev>}

which match exactly the behaviour I see with bundle install in those repos.

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

I just tried that again in my environment and the jar-dependencies 0.1.1.dev is not used. I will try some environment alternatives to see if I can find the difference, possibly reporting that finding as a new issue. Still this is a workaround at best, since a jruby 1.7.14+ patch release update should not require me to install new dependencies, that I don't even want, or opt-in to use. This causes lots of problems, for example with travis-ci, etc.

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 15, 2014

And to use your short example, my output indeed looks different:

jruby -r jar_installer -e 'p Gem.loaded_specs'
{}
@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 16, 2014

since I was NOT able to produce a failing integration test in jar-dependencies I just released the gem and added it to jruby-1.7.16

https://oss.sonatype.org/content/repositories/snapshots/org/jruby/jruby-dist/1.7.16-SNAPSHOT/

could you PLEASE confirm that this jruby version does work for your projects now ?!

about the activation of the default gem which is actually independent from jar-dependencies itself, it would be nice to dig into it any ways, but currently it depends on you to find something - thanx for the effort !

@dekellum

This comment has been minimized.

Copy link
Contributor Author

dekellum commented Sep 16, 2014

Confirmed that your 1.7.16-SNAPSHOT avoids this particular issue. The warning output as below demonstrates that jar_dependencies is still apparently running (without me wanting it to run). Thanks.

% jruby -w -S bundle install
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/rubygems/defaults/jruby.rb:92 warning: Ambiguous first argument; make sure.
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/rubygems/defaults/jruby.rb:96 warning: shadowing outer local variable - dir
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_dependencies.rb:118 warning: instance variable @_jars_home_ not initialized
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_dependencies.rb:87 warning: instance variable @_jars_maven_user_settings_ not initialized
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_dependencies.rb:105 warning: instance variable @_jars_maven_global_settings_ not initialized
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/krypt/codec/hex.rb:65 warning: shadowing outer local variable - data
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/krypt/codec/hex.rb:112 warning: shadowing outer local variable - data
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/krypt/codec/base64.rb:78 warning: shadowing outer local variable - data
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/krypt/codec/base64.rb:130 warning: shadowing outer local variable - data
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/krypt/hmac.rb:53 warning: shadowing outer local variable - new_key
Resolving dependencies...
Using rake 10.1.1
Using rjack-slf4j 1.7.5.0
Using rjack-logback 1.6.1
Using hashdot-test-daemon 1.2.4
Using logrotate 1.2.1
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_installer.rb:10 warning: Ambiguous first argument; make sure.
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_installer.rb:16 warning: Ambiguous first argument; make sure.
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_installer.rb:18 warning: Ambiguous first argument; make sure.
/usr/local/lib/jruby/jruby-1.7.16-SNAPSHOT/lib/ruby/shared/jar_installer.rb:47 warning: Ambiguous first argument; make sure.
Using iyyov 1.3.0 from source at .
Using json 1.8.1
Using minitest 4.7.5
Using rdoc 4.0.1
Using rjack-maven 3.0.5.0
Using rjack-tarpit 2.1.0
Using bundler 1.7.3
Your bundle is complete!
It was installed into /home/david/.gem
@mkristian

This comment has been minimized.

Copy link
Member

mkristian commented Sep 16, 2014

thanx for testing it.

there are a couple of gems you did not want to run like krypt, krypt-provider, jruby-openssl, jar-dependencies - these a defaults gems and a such part of jruby. the moment jruby requires any file of those default gems, rubygems either finds an installed gem or activates the default gem. this is also true for MRI for their default gems (not sure if they have any) and this logic is part of rubygems.

please open an new issue regarding not being able to use an installed gems for those default gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.