Bug #15622


Default version of Bundler incorrectly invoked when using binstubs

Added by schneems (Richard Schneeman) over 5 years ago. Updated over 5 years ago.

Target version:
ruby -v:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]


When trying to run a binstub with Ruby 2.6.1 with Bundler 2.0.1 on the system, the wrong version of Bundler gets loaded which then fails when the Gemfile.lock points to a 2.x version (since the default version that ships with Ruby is Bundler 1.x. While this was discovered on Heroku and is discussed in this issue I was able to replicate the problem fairly easily with docker. I've provided instructions below.


Start a docker image with Ruby 2.6.1

docker run -it --rm ruby:2.6.1 bash

Install bundler, rails, make a new app, and remove the begin/rescue/end from the bin/rake binstub. To trigger the error run a rake command without bundle exec:

gem install bundler -v 2.0.1
gem install rails -v 6.0.0.beta1
rails new ruby-2-6-bundler-2-issue

cd ruby-2-6-bundler-2-issue

cat <<EOT > bin/rake
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'

rake -T


You must use Bundler 2 or greater with this lockfile.


Bundler 2 is available on the system, and is the latest version, so it should be invoked instead of the default bundler version.

Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #15582: default/bundler-1.17.2.gemspec has no file listClosedhsbt (Hiroshi SHIBATA)Actions

Updated by dzunk (Matt Duszynski) over 5 years ago

I was able to reproduce this with the steps provided, and it seems to work after a gem update --system. Possibly a bug in a particular version of Rubygems?

Updated by hsbt (Hiroshi SHIBATA) over 5 years ago

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

Updated by deivid (David Rodríguez) over 5 years ago

Forgot to comment here. I'm pretty sure this is the same as The fix for it should be released in the next patch level version

For the moment gem update --system indeed workarounds it, since it forces the reinstallation of the default bundler gem, which is the culprit here (its gemspec's file list is incomplete).

Updated by hsbt (Hiroshi SHIBATA) over 5 years ago

  • Status changed from Assigned to Rejected
  • Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONTNEED

@schneems (Richard Schneeman)

I couldn't reproduce the latest ruby_2_6 branch with fixed #15582. Please wait for releasing next stable version 2.6.2.

Actions #5

Updated by hsbt (Hiroshi SHIBATA) over 5 years ago

  • Is duplicate of Bug #15582: default/bundler-1.17.2.gemspec has no file list added

Also available in: Atom PDF