NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.32k forks source link

bundlerEnv app triggers an infinite stack trace in bundler. #83222

Open jdelStrother opened 4 years ago

jdelStrother commented 4 years ago

Describe the bug

When using bundlerEnv to package certain combinations of gems, I get an infinite stack trace when running, eg, bundle list, or bundle exec ...

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/jdelStrother/nix-bundler.git
  2. cd nix-bundler
  3. nix-shell --pure --run "bundle list"

Expected behavior

bundler prints a list of installed gems

Actual behavior

bundler dies with StackLevelTooDeep, with the following stack:

Stack ``` /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/4nkqcd429ml1d474imx8rfrj35vg4pgb-ruby-2.6.5/lib/ruby/2.6.0/rubygems/stub_specification.rb:151:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/stub_specification.rb:38:in `missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:76:in `spec_missing_extensions?' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb:353:in `block (2 levels) in installed_specs' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb:350:in `reverse_each' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb:350:in `block in installed_specs' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/index.rb:11:in `build' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb:349:in `installed_specs' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/source/rubygems.rb:91:in `specs' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/lazy_specification.rb:76:in `__materialize__' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/spec_set.rb:88:in `block in materialize' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `map!' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `materialize' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/definition.rb:170:in `specs' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:108:in `block in definition_method' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/show.rb:39:in `run' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:309:in `show' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start' /nix/store/gpnzbxlwnc39zdn3vmzh4m53bgwss1zy-gems-for-nix-bundler/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in ' /nix/store/02ay9b2qds7ji0z3253424mcz0nc7hqf-bundler-1.17.3/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors' /nix/store/gpnzbxlwnc39zdn3vmzh4m53bgwss1zy-gems-for-nix-bundler/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `' /nix/store/gpnzbxlwnc39zdn3vmzh4m53bgwss1zy-gems-for-nix-bundler/bin/bundle:18:in `load' /nix/store/gpnzbxlwnc39zdn3vmzh4m53bgwss1zy-gems-for-nix-bundler/bin/bundle:18:in `
' ```

Additional context

I'm confused by the exact triggering conditions, though something to do with the ruby-audio gem seems to cause it. The demo project has the ruby-audio gem installed from github, and the akismet gem. The akismet gem is randomly chosen, but it seems to need at least 2 gems in the gemfile to trigger this bug. If I install ruby-audio from rubygems, the problem goes away.

Metadata Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.7.0, macOS 10.14.6`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.3`
 - channels(jon): `"nixpkgs-20.09pre217526.9b3515eb95d"`
 - nixpkgs: `/Users/jon/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

jdelStrother commented 4 years ago

I found a hacky workaround, but would be interested in the proper fix.

Here I delete the bundle & bundler executables from the bundlerEnv output. It seems like they conflict in weird ways with the ones that the wrappedRuby derivation supplies. https://github.com/jdelStrother/nix-bundler/commit/edd53369dd87bfec043638ddc081e34e76a6686b

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

jdelStrother commented 3 years ago

Still using the hacky workaround, still interested in the proper fix.