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

bundle install error with JRuby 9.4.7.0 #7651

Closed
n-rodriguez opened this issue May 11, 2024 · 13 comments
Closed

bundle install error with JRuby 9.4.7.0 #7651

n-rodriguez opened this issue May 11, 2024 · 13 comments

Comments

@n-rodriguez
Copy link

Hi there! I got this error when running bundle install with JRuby 9.4.7.0 :

nicolas@MBP-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ bundle install
Fetching https://github.com/discourse/prometheus_exporter.git
git version 2.45.0
git version 2.45.0
--- ERROR REPORT TEMPLATE -------------------------------------------------------
NoMethodError: undefined method `[]' for nil:NilClass
  /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:95:in `version'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:446:in `supports_fetching_unreachable_refs?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:207:in `depth'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:434:in `full_clone?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:422:in `depth_args'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:406:in `extra_clone_args'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:175:in `clone_needs_extra_fetch?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:107:in `checkout'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git.rb:352:in `fetch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git.rb:179:in `specs'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source.rb:60:in `spec_names'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source_map.rb:21:in `block in all_requirements'
          org/jruby/RubyArray.java:2803:in `map'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source_map.rb:20:in `all_requirements'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:964:in `source_requirements'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:572:in `resolution_packages'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:554:in `resolver'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:631:in `start_resolution'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:314:in `resolve'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:584:in `materialize'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:207:in `specs'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:231:in `ensure_specs_are_compatible!'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:83:in `block in run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/process_lock.rb:12:in `block in lock'
          org/jruby/RubyIO.java:1197:in `open'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/process_lock.rb:9:in `lock'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:71:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:23:in `install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli/install.rb:63:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:247:in `block in install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/settings.rb:157:in `temporary'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:246:in `install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:35:in `dispatch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:29:in `start'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/exe/bundle:28:in `block in <main>'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/exe/bundle:20:in `<main>'
          org/jruby/RubyKernel.java:1220:in `load'
          /Users/nicolas/.asdf/installs/ruby/jruby-9.4.7.0/bin/bundle:25:in `<main>'

Environment

Bundler       2.5.10
  Platforms   ruby, universal-java-21
Ruby          3.1.4p0 (2024-04-29 revision 597ff08ac1e0d7f05f8f6cc836648725756dd7db) [universal-java-21]
  Full Path   /Users/nicolas/.asdf/installs/ruby/jruby-9.4.7.0/bin/jruby
  Config Dir  /Users/nicolas/.asdf/installs/ruby/jruby-9.4.7.0/etc
RubyGems      3.3.26
  Gem Home    /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0
  Gem Path    /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0
  User Home   /Users/nicolas
  User Path   /Users/nicolas/.local/share/gem/jruby/3.1.0
  Bin Dir     /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/bin
OpenSSL
  Compiled    JRuby-OpenSSL 0.14.5
  Loaded      JRuby-OpenSSL 0.14.5
  Cert File   /opt/homebrew/Cellar/openjdk/21.0.3/libexec/openjdk.jdk/Contents/Home/lib/security/cacerts
  Cert Dir    /etc/ssl/certs
Tools
  Git
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Thank you!

@deivid-rodriguez
Copy link
Member

Hei @n-rodriguez! It seems for some reason your git is printing git --version output to stderr, not stdout. It'd be nice to be able to reproduce this, did you install git with homebrew?

@n-rodriguez
Copy link
Author

It seems for some reason your git is printing git --version output to stderr, not stdout.

That's what I thought.

did you install git with homebrew?

Yes

@deivid-rodriguez
Copy link
Member

If you install git in some other way, does the error go away?

@n-rodriguez
Copy link
Author

If you install git in some other way, does the error go away?

nope

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ which git
/Users/nicolas/git-2.45.0/git
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ git --version
git version 2.45.0
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ bundle install
Fetching https://github.com/jbox-web/release_manager.git
git version 2.45.0
git version 2.45.0
--- ERROR REPORT TEMPLATE -------------------------------------------------------
NoMethodError: undefined method `[]' for nil:NilClass
  /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:95:in `version'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:446:in `supports_fetching_unreachable_refs?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:207:in `depth'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:434:in `full_clone?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:422:in `depth_args'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:406:in `extra_clone_args'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:175:in `clone_needs_extra_fetch?'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git/git_proxy.rb:107:in `checkout'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git.rb:352:in `fetch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source/git.rb:179:in `specs'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source.rb:60:in `spec_names'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source_map.rb:21:in `block in all_requirements'
          org/jruby/RubyArray.java:2803:in `map'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/source_map.rb:20:in `all_requirements'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:964:in `source_requirements'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:572:in `resolution_packages'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:554:in `resolver'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:631:in `start_resolution'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:314:in `resolve'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:584:in `materialize'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/definition.rb:207:in `specs'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:231:in `ensure_specs_are_compatible!'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:83:in `block in run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/process_lock.rb:12:in `block in lock'
          org/jruby/RubyIO.java:1197:in `open'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/process_lock.rb:9:in `lock'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:71:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/installer.rb:23:in `install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli/install.rb:63:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:247:in `block in install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/settings.rb:157:in `temporary'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:246:in `install'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:35:in `dispatch'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/cli.rb:29:in `start'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/exe/bundle:28:in `block in <main>'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
          /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/jruby/3.1.0/gems/bundler-2.5.10/exe/bundle:20:in `<main>'
          org/jruby/RubyKernel.java:1220:in `load'
          /Users/nicolas/.asdf/installs/ruby/jruby-9.4.7.0/bin/bundle:25:in `<main>'

@deivid-rodriguez
Copy link
Member

Interesting, I'm not able to reproduce myself 😞

@n-rodriguez
Copy link
Author

I can't reproduce it on Linux neither :/

@deivid-rodriguez
Copy link
Member

Oh, you're on MacOS! Let me try reproduce this on MacOS then. Will get back in a few days 👍.

@deivid-rodriguez
Copy link
Member

An approach that will probably work to fix this would be to change GitProxy to use stderr as the result if stdout is empty and the process status was "success". But I'd like to get to the bottom of this and reproduce this before we implement such a solution.

@n-rodriguez
Copy link
Author

It seems for some reason your git is printing git --version output to stderr, not stdout.

yes, but this is weird :

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/toto$ git version 2> error.txt 1> output.txt
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/toto$ cat error.txt
nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/toto$ cat output.txt
git version 2.45.0

@n-rodriguez
Copy link
Author

n-rodriguez commented May 14, 2024

I think it's a bug with JRuby :

#!/usr/bin/env ruby

require "open3"

def capture3_args_for(cmd, dir)
  ["git", *cmd]
end

cmd = 'version'
dir = nil

puts *capture3_args_for(cmd, dir).inspect
out, err, status = Open3.capture3(*capture3_args_for(cmd, dir))

puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
puts "out.inspect: #{out.inspect}"
puts "err.inspect: #{err.inspect}"
puts "status.inspect: #{status.inspect}"
puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"

With Ruby 3.3.1 :

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./toto.rb
["git", "version"]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: "git version 2.45.0\n"
err.inspect: ""
status.inspect: #<Process::Status: pid 13555 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

With JRuby 9.4.7.0 :

nicolas@MacBook-Pro-de-Nicolas:~/PROJECTS/CONCERTO/concerto$ ./toto.rb
["git", "version"]
git version 2.45.0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
out.inspect: ""
err.inspect: ""
status.inspect: #<Process::Status: pid 13749 exit 0>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@n-rodriguez
Copy link
Author

I've opened an issue : jruby/jruby#8237

@deivid-rodriguez
Copy link
Member

Thanks for investigating. Weirdly my JRuby works just fine... 🤔

@deivid-rodriguez
Copy link
Member

I'm closing this issue in favor of the JRuby ticket that you opened. It doesn't seem like a JRuby bug, but a Java one, but at least it's closer to the culprit!

@deivid-rodriguez deivid-rodriguez closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants