Bug #19576


Backport request: Gemfile.lock resolving is broken with bundler shipped with Ruby 3.1.4

Added by jprokop (Jarek Prokop) over 1 year ago. Updated 8 months ago.

Target version:
ruby -v:
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]


This is a backport request for bundler, that regressed in 2.3.36 in a specific situation. Newer and older bundler versions that ship with Ruby are not problematic, only the version that ships with Ruby version >= 3.1.3.

A few weeks ago, we discovered a bug in resolving in bundler shipped with Ruby 3.1.3 and 3.1.4:
Bundler version:

$ bundler --version
Bundler version 2.3.26

Affected rubies ruby -v:

$ ruby -v
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]


$ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]

Initial bug report with reproducer and more in-depth description can be found here:

Using the following Gemfile for a rails app:
bundler locks up in trying to resolve Nokogiri for Ruby 3.1, but keeps failing because it keeps using incompatible built binary gem instead of falling back to installing and building the binary extension of Nokogiri locally.

We craft this Gemfile to be usable from Ruby 2.5 up to Ruby 3.1, as the app is used mainly for testing.

I have created a patch to fix the situation, see the attached files. There are 2 of them, one contains the fix and the other one contains the test from the rubygems repo PR#6225.
full commit available here:

The patches are created from the following upstream changes in bundler:
and adapted:
for the PR#6225.

With the fix applied I no longer have issues doing bundle install with our Gemfile.lock.


Updated by hsbt (Hiroshi SHIBATA) over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to hsbt (Hiroshi SHIBATA)

We need to release Bundler 2.3.27 at first.

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

I prepared to release new versions with your commits.

Updated by jprokop (Jarek Prokop) about 1 year ago

Thank you. I can confirm that PR fixes what I described in the initial report.

Unfortunately, I recently found second manifestation of this, even with the patch it will fail due to a similar reason of preferring archful gem when deployment option is set to true:

$ bundle config set path ./bundle
$ bundle config set deployment true
$ bundle install
Fetching gem metadata from
nokogiri-1.12.5-x86_64-linux requires ruby version <, >= 2.5, which is incompatible with the current version, 3.1.4

I will git bisect to pin down exactly where it was introduced and where it was fixed in bundler, as, similarly to the inital report, the bug does not appear in newer versions.

Updated by hsbt (Hiroshi SHIBATA) 8 months ago

  • Status changed from Assigned to Closed
  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONTNEED

I released RubyGems-3.3.27 and Bundler 2.3.27 for Ruby 3.1.

Updated by usa (Usaku NAKAMURA) 8 months ago

  • Backport changed from 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONTNEED to 3.0: DONTNEED, 3.1: DONE, 3.2: DONTNEED

mergerd via GitHub.


Also available in: Atom PDF