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
Sorting in spec_set.rb works on Ruby 3.2.2 and fails on Ruby 3.3.0 due to nil member #7381
Comments
While trying to trace the exact source of the problem, I reinstalled Ruby 3.3.0 and the problem vanished. |
I've ran into same issue |
Same issue with 3.3.1 and a trivial Gemfile
Downgrading to Ruby 3.2.4 works. |
Please provide a way to reproduce the problem. That Gemfile works just fine for me. |
Hmm, not sure what to suggest. On a Mac it's:
with the above Gemfile in an otherwise empty directory. Fetching gem metadata from https://rubygems.org/.
Environment
Bundler Build Metadata
GemfileGemfilesource "https://rubygems.org"
gem 'ipaddress' Gemfile.lock
--- TEMPLATE END ---------------------------------------------------------------- Unfortunately, an unexpected error occurred, and Bundler cannot continue. First, try this link to see if there are any existing issue reports for this error: If there aren't any reports for this error yet, please fill in the new issue form located at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md, and copy and paste the report template above in there.
|
Good to know you're using Ruby installed through Homebrew, that may be it. If you reinstall Ruby and/or Homebrew from scratch, does it consistently crash? |
(As a side note: I rely on ruby-install to compile my Rubies and this happened to me as well.) |
Was going to say similar, though I use rbenv's ruby-build plugin rather than ruby-install or homebrew Environment
Bundler Build Metadata
|
Alright, then can someone please provide instructions to reproduce, using any version manager? Ideally setup a Dockerfile that can be run anywhere and shows the error. |
@deivid-rodriguez I would really love to do so, but I was never able to reproduce the problem – which is why I closed the issue. Maybe someone else has more "luck". |
I'll give it a go, but I'm not that great with Docker. Might be easier to try and debug bundler itself It's curious that all the errors seem to have occurred on Mac OS. I'll see if I can reproduce it on Linux with the same versions and config as if that doesn't error then it'll be tricky to make an image I think |
Works on macOS if I install Ruby using rbenv (with rbenv installed by Homebrew), so seems like it's a Homebrew issue, probably something to do with the binary build it installs. I wonder if it's reproducible using Homebrew on Linux? |
It's not Homebrew. As I mentioned above, I build ruby from source using ruby-build and I'm getting this issue I have managed to reproduce it on Linux though by doing the following (using the Gemfile from this comment):
Running without the env var to enable YJIT completes successfully I can't get it to complete successfully on Mac with YJIT disabled though so I don't know if that's the root cause |
Oh, that's super interesting. Then it may be a subtle change in behavior that YJIT is causing? So, just to confirm, if you install Ruby with YJIT, it reproduces every time. Otherwise, it never reproduces, correct? |
It certainly worked once before enabling YJIT, and failed after, though now it's failing every time on my linux machine even after disabling YJIT again |
Terminal output for the above |
Ok, so it seems like it's not enough to just enable YJIT. I tried deleting the entire ruby install and reinstalling it again, and it worked fine. The exact steps that seem to reliably reproduce this are:
I don't understand why but it seems to be the reinstalling ruby having already updated rubygems that might be the key to causing this error and YJIT may or may not be a red herring |
That's very helpful @Tabby, thanks. I will try to get this to reproduce for me using that information 👍. |
I've created tarballs of the ruby install while it still works and after I've broken it, if that's helpful (for Linux x86_64) |
I tried to reproduce using my ruby manager (asdf) but it won't let me "reinstall" Ruby. I'll try tomorrow using rbenv. |
It reproduced with the steps you pointed out @Tabby 🎉. I'll look into this! |
Alright, so the problem was indeed reinstalling Ruby on top of a Ruby installation where RubyGems has been upgraded. When upgrading RubyGems, the default version of Bundler is upgraded and the new copy is installed at The mismatch between the gemspec version (2.5.9 in this case), and the upgraded version installed in site_dir (2.5.10 in this case) is causing the Bundler specification to be added to the Array of specifications used for resolution as I changed things in #7642 to detect the situation and try give a better error message. |
Wow, @deivid-rodriguez, this sounds like the very edge of an edge case! Thanks for debugging this, your PR with a warning hinting on this problem (and the likely fix by fully zapping and reinstalling Ruby) will certainly prevent some hair from going grey. |
Indeed! Yeah, I got grey hair already so happy to go greyer myself in favor of people keeping their hair intact 😆. I think we could probably fix this in ruby-core too by removing any pre-existing Bundler default installation if any. I'll give that a try! |
Thanks @deivid-rodriguez for getting to the bottom of this! For anyone facing this and running homebrew ruby, I found that |
Indeed! Good hint for a workaround that does not involve reinstalling Ruby 👍. |
Describe the problem as clearly as you can
I've just updated my NOTAM gem for Ruby 3.3.0 and hit a problem with Bundler.
Using Rubygems 3.5.4 and Bundler 2.5.4 on Ruby 3.3.0 both
bundle install
andbundle update
raise:The error happens on spec_set.rb line 269 where
@spec
contains anil
membersort_by
doesn't like.Reverting back to Ruby 3.2.2 while using the same versions of Rubygems and Bundler works fine.
Did you try upgrading rubygems & bundler?
Yes, all is up to date.
Error template
Environment
Bundler Build Metadata
Bundler settings
Gemfile
gems.rb
gems.locked
Gemspecs
notam.gemspec
The text was updated successfully, but these errors were encountered: