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

Bundler v2.3.36 incorrectly resolves to an incompatible pre-built gem instead of ruby platform one #6482

Closed
jackorp opened this issue Mar 14, 2023 · 7 comments
Labels

Comments

@jackorp
Copy link
Contributor

jackorp commented Mar 14, 2023

Describe the problem as clearly as you can

We are using this app: https://github.com/sclorg/rails-ex
To test Ruby containers and the expected functionality.

Part of that is having a Gemfile that is compatible from Ruby 2.5 to Ruby 3.1 and onwards.
However, since Ruby 3.1.3, bundler fails to accept nokogiri 1.12.5 without pre-built native extensions as valid and attempts to use the nokogiri-1.12.5-x86_64-linux version, which has a restriction on the Ruby version to be < 3.1.dev, therefore this one cannot be used. This wouldn't be a problem but it refuses to resolve the nokogiri to nokogiri-1.12.5 which would work for us.

Bundler seems to be confused from the conflict, it locks up in a loop in resolving deps:

$ bundle install --path ./bundle --verbose
<..snip...>
Resolving dependencies...
The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies
Resolving dependencies...
<..snip...>

Build with --frozen finally reveals what the actual problem is:

$ bundle install --path ./bundle --frozen
<..snip..>
Fetching gem metadata from https://rubygems.org/..........
nokogiri-1.12.5-x86_64-linux requires ruby version < 3.1.dev, >= 2.5, which is
incompatible with the current version, 3.1.3

I'd consider this a regression of behavior in Bundler shipped with Ruby 3.1.3. It works on bundler shipped with Ruby 3.2.1 as well as with bundler shipped with Ruby 3.1.2.

Did you try upgrading rubygems & bundler?

Yes, not a problem with Bundler version 2.4.6 bundled with Ruby 3.2.

Post steps to reproduce the problem

Simple:
0. Run Ruby 3.1.3

  1. Get the Gemfile and Gemfile.lock from below
  2. bundle install --path bundle

As we run it:

  1. git clone https://github.com/sclorg/rails-ex.git app-src
  2. $ cat Dockerfile
FROM quay.io/fedora/ruby-31:latest

ADD app-src ./

RUN bundle install --path ./bundle

CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080"
  1. $ docker build --no-cache .

Which command did you run?

bundle install --path bundle

What were you expecting to happen?

Bundler resolves to nokogiri without pre-built extensions as it did for bundler bundled with Ruby 3.1.2 and as it does for bundler bundled with Ruby 3.2.

What actually happened?

Bundler locked up in an infinite loop similar to #6054

If not included with the output of your command, run bundle env and paste the output below

$ bundle env

Environment

Bundler       2.3.26
  Platforms   ruby, x86_64-linux
Ruby          3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498) [x86_64-linux]
  Full Path   /usr/bin/ruby
  Config Dir  /etc
RubyGems      3.3.26
  Gem Home    /usr/share/gems
  Gem Path    /opt/app-root/src/.local/share/gem/ruby:/usr/share/gems:/usr/local/share/gems
  User Home   /opt/app-root/src
  User Path   /opt/app-root/src/.local/share/gem/ruby
  Bin Dir     /usr/bin
Tools
  Git         2.38.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2023-03-14
Git SHA           unknown
Released Version  false

Gemfile

Gemfile

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6'
# Support postgresql as a database for Active Record
gem 'pg', '~> 1.2.0'
# Support sqlite3 as a database for Active Record
gem 'sqlite3'
# Support redis as a key-value store for Action Cable
gem 'redis'
# Use Puma as the app server
gem 'puma'
# Use SCSS for stylesheets
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'listen'

gem 'ffi', '>= 1.15.1'

# ActiveRecord makes use of these bundled gems, as of Ruby 3.1, these requirements
# have to be explicitly marked in a Gemfile.
gem 'matrix'
gem 'net-smtp'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara'
  gem 'selenium-webdriver'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.1.6.1)
      actionpack (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.1.6.1)
      actionpack (= 6.1.6.1)
      activejob (= 6.1.6.1)
      activerecord (= 6.1.6.1)
      activestorage (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      mail (>= 2.7.1)
    actionmailer (6.1.6.1)
      actionpack (= 6.1.6.1)
      actionview (= 6.1.6.1)
      activejob (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.1.6.1)
      actionview (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      rack (~> 2.0, >= 2.0.9)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.1.6.1)
      actionpack (= 6.1.6.1)
      activerecord (= 6.1.6.1)
      activestorage (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      nokogiri (>= 1.8.5)
    actionview (6.1.6.1)
      activesupport (= 6.1.6.1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.1.6.1)
      activesupport (= 6.1.6.1)
      globalid (>= 0.3.6)
    activemodel (6.1.6.1)
      activesupport (= 6.1.6.1)
    activerecord (6.1.6.1)
      activemodel (= 6.1.6.1)
      activesupport (= 6.1.6.1)
    activestorage (6.1.6.1)
      actionpack (= 6.1.6.1)
      activejob (= 6.1.6.1)
      activerecord (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      marcel (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (6.1.6.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
      zeitwerk (~> 2.3)
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    bindex (0.8.1)
    builder (3.2.4)
    byebug (11.1.3)
    capybara (3.35.3)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (>= 1.5, < 3.0)
      xpath (~> 3.2)
    childprocess (3.0.0)
    coffee-rails (5.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 5.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.1.10)
    crass (1.0.6)
    digest (3.1.0)
    erubi (1.11.0)
    execjs (2.8.1)
    ffi (1.15.5)
    globalid (1.0.0)
      activesupport (>= 5.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    io-wait (0.2.3)
    jbuilder (2.11.5)
      actionview (>= 5.0.0)
      activesupport (>= 5.0.0)
    listen (3.7.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.18.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (1.0.2)
    matrix (0.4.2)
    method_source (1.0.0)
    mini_mime (1.1.2)
    mini_portile2 (2.6.1)
    minitest (5.15.0)
    net-protocol (0.1.2)
      io-wait
      timeout
    net-smtp (0.3.0)
      digest
      net-protocol
      timeout
    nio4r (2.5.8)
    nokogiri (1.12.5)
      mini_portile2 (~> 2.6.1)
      racc (~> 1.4)
    pg (1.2.3)
    public_suffix (4.0.7)
    puma (5.6.4)
      nio4r (~> 2.0)
    racc (1.6.0)
    rack (2.2.4)
    rack-test (2.0.2)
      rack (>= 1.3)
    rails (6.1.6.1)
      actioncable (= 6.1.6.1)
      actionmailbox (= 6.1.6.1)
      actionmailer (= 6.1.6.1)
      actionpack (= 6.1.6.1)
      actiontext (= 6.1.6.1)
      actionview (= 6.1.6.1)
      activejob (= 6.1.6.1)
      activemodel (= 6.1.6.1)
      activerecord (= 6.1.6.1)
      activestorage (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      bundler (>= 1.15.0)
      railties (= 6.1.6.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.3)
      loofah (~> 2.3)
    railties (6.1.6.1)
      actionpack (= 6.1.6.1)
      activesupport (= 6.1.6.1)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
    rake (13.0.6)
    rb-fsevent (0.11.1)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redis (4.7.1)
    regexp_parser (2.5.0)
    rubyzip (2.3.2)
    sass-rails (6.0.0)
      sassc-rails (~> 2.1, >= 2.1.1)
    sassc (2.4.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    spring (2.1.1)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (4.1.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.4.2)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
      sprockets (>= 3.0.0)
    sqlite3 (1.4.4)
    thor (1.2.1)
    tilt (2.0.11)
    timeout (0.3.0)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (2.0.5)
      concurrent-ruby (~> 1.0)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    web-console (4.2.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.6.0)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  capybara
  coffee-rails
  ffi (>= 1.15.1)
  jbuilder
  listen
  matrix
  net-smtp
  pg (~> 1.2.0)
  puma
  rails (~> 6)
  redis
  sass-rails
  selenium-webdriver
  spring
  spring-watcher-listen
  sqlite3
  turbolinks
  tzinfo-data
  uglifier
  web-console
@indirect
Copy link
Member

The latest version of Bundler is 2.4.8. Does this problem still happen using that version?

@jackorp
Copy link
Contributor Author

jackorp commented Mar 14, 2023

Yes it does. Sorry, forgot to specify that version as well.

@deivid-rodriguez
Copy link
Member

I'm confused. So this does work in Bundler 2.4.6, but does not work in Bundler 2.4.8? I was not expecting this kind of regression from the changes in the previous two versions.

This issue seems similar to #6221, which was fixed by Bundler 2.4.3.

@jackorp
Copy link
Contributor Author

jackorp commented Mar 14, 2023

Omg, sorry, I heavily misread. Let me clarify better.

The bundle install finishes successfully with bundler 2.4.6, 2.4.8, 2.2.33 (shipped with Ruby 3.0), 2.3.7, -- those I tested

The bundle install fails with 2.3.26.

I hope this is better.

@indirect
Copy link
Member

Okay. I think that means you are reporting a bug we not only know about, but already fixed? If you ever run into this again in the future, please install the latest version of Bundler so that you are able to bundle install successfully. We cannot make changes to the already-released Bundler 2.3.26.

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Mar 14, 2023

Yeah, we can't change the past and "erase bugs" from existing versions @jackorp

@jackorp
Copy link
Contributor Author

jackorp commented Mar 14, 2023

Right, that is true. Thanks for the relevant pointers and sorry for the noise.

@jackorp jackorp closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants