Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Lower required RubyGems to 2.5 or greater#6867

Merged
colby-swandale merged 2 commits into2-0-stablefrom
indirect/rubygems-requirement
Jan 4, 2019
Merged

Lower required RubyGems to 2.5 or greater#6867
colby-swandale merged 2 commits into2-0-stablefrom
indirect/rubygems-requirement

Conversation

@indirect
Copy link
Copy Markdown

@indirect indirect commented Jan 3, 2019

It turns out that every existing version of RubyGems will ignore the required RubyGems version and try to install the newest version of Bundler... until the middle of the install, when it will raise an exception and fail. This PR tries to fix that in the least-bad way possible.

What was the end-user problem that led to this PR?

The end user problem is that running gem install bundler now produces an exception on any Ruby and RubyGems older than 2.6 or 3.0 respectively.

What was your diagnosis of the problem?

Unfortunately, RubyGems does not use the required_rubygems_version to select an older version of Bundler to install. Instead, RubyGems tries to install the newest version even though that version is not compatible, and then raises an exception during installation because it is not compatible.

What is your fix for the problem, implemented in this PR?

Lower the required_rubygems_version in Bundler 2 back down to RubyGems 2.5 or greater.

Why did you choose this fix out of the possible options?

I chose this fix because it will stop RubyGems from raising an exception while installing Bundler 2, and instead allow the installation to complete successfully.

There are some bugfixes in RubyGems 3 that improve the quality of life for Bundler 2 users, but they are less bad than RubyGems simply exploding anytime you try to run gem install bundler.

It turns out that every existing version of RubyGems will ignore the
required RubyGems version and try to install the newest version of
Bundler... until the middle of the install, when it will raise an
exception and fail.

There are some bugfixes in RubyGems 3 that improve the quality of life
for Bundler 2 users, but they are less bad than RubyGems simply
exploding anytime you try to run `gem install bundler`.
@indirect
Copy link
Copy Markdown
Author

indirect commented Jan 3, 2019

Summarizing some relevant conversation with @segiddins and @colby-swandale:

  • It seems like required rubygems version was set to 3.0 with the idea that rubygems would install the newest version that stated it was compatible. Instead, every rubygems version including 3.0 tries to install the newest bundler regardless, and throws an exception if the newest version happens to say it is not compatible (@indirect)
  • Running gem install bundler or gem install rails now fails on macOS default Ruby, and on any Ruby older than 2.6 (@colby-swandale)
  • If we support Ruby 2.3, we should also support RubyGems 2.5.1 (which shipped with Ruby 2.3.0) and greater (@segiddins)
  • While RubyGems 3.0 contains some quality of life fixes and improvements for Bundler 2, those improvements are not worth the cost of gem install bundler failing on every older RubyGems version (@indirect)

@indirect
Copy link
Copy Markdown
Author

indirect commented Jan 3, 2019

@bundlerbot r=greysteil

@colby-swandale
Copy link
Copy Markdown
Member

For the record, The main motivator behind requiring 3.0.0 was ruby/rubygems#2426 that fixed an issue with the BundlerVersionFinder that was released in v3.

ghost pushed a commit that referenced this pull request Jan 3, 2019
6867: Lower required RubyGems to 2.5 or greater r=greysteil a=indirect

It turns out that every existing version of RubyGems will ignore the required RubyGems version and try to install the newest version of Bundler... until the middle of the install, when it will raise an exception and fail. This PR tries to fix that in the least-bad way possible.

### What was the end-user problem that led to this PR?

The end user problem is that running `gem install bundler` now produces an exception on any Ruby and RubyGems older than 2.6 or 3.0 respectively.

### What was your diagnosis of the problem?

Unfortunately, RubyGems does not use the `required_rubygems_version` to select an older version of Bundler to install. Instead, RubyGems tries to install the newest version even though that version is not compatible, and then raises an exception during installation because it is not compatible.

### What is your fix for the problem, implemented in this PR?

Lower the `required_rubygems_version` in Bundler 2 back down to RubyGems 2.5 or greater.

### Why did you choose this fix out of the possible options?

I chose this fix because it will stop RubyGems from raising an exception while installing Bundler 2, and instead allow the installation to complete successfully.

There are some bugfixes in RubyGems 3 that improve the quality of life for Bundler 2 users, but they are less bad than RubyGems simply exploding anytime you try to run `gem install bundler`.

Co-authored-by: Andre Arko <andre@arko.net>
@ghost
Copy link
Copy Markdown

ghost commented Jan 3, 2019

Canceled

@colby-swandale
Copy link
Copy Markdown
Member

@bundlerbot r+

ghost pushed a commit that referenced this pull request Jan 3, 2019
6867: Lower required RubyGems to 2.5 or greater r=colby-swandale a=indirect

It turns out that every existing version of RubyGems will ignore the required RubyGems version and try to install the newest version of Bundler... until the middle of the install, when it will raise an exception and fail. This PR tries to fix that in the least-bad way possible.

### What was the end-user problem that led to this PR?

The end user problem is that running `gem install bundler` now produces an exception on any Ruby and RubyGems older than 2.6 or 3.0 respectively.

### What was your diagnosis of the problem?

Unfortunately, RubyGems does not use the `required_rubygems_version` to select an older version of Bundler to install. Instead, RubyGems tries to install the newest version even though that version is not compatible, and then raises an exception during installation because it is not compatible.

### What is your fix for the problem, implemented in this PR?

Lower the `required_rubygems_version` in Bundler 2 back down to RubyGems 2.5 or greater.

### Why did you choose this fix out of the possible options?

I chose this fix because it will stop RubyGems from raising an exception while installing Bundler 2, and instead allow the installation to complete successfully.

There are some bugfixes in RubyGems 3 that improve the quality of life for Bundler 2 users, but they are less bad than RubyGems simply exploding anytime you try to run `gem install bundler`.

Co-authored-by: Andre Arko <andre@arko.net>
Co-authored-by: Colby Swandale <me@colby.fyi>
@colby-swandale
Copy link
Copy Markdown
Member

@bundlerbot r=greysteil

@ghost
Copy link
Copy Markdown

ghost commented Jan 4, 2019

Not awaiting review

@colby-swandale
Copy link
Copy Markdown
Member

@bundlerbot retry

@ghost
Copy link
Copy Markdown

ghost commented Jan 4, 2019

Not awaiting review

@colby-swandale
Copy link
Copy Markdown
Member

@bundlerbot r=greysteil

@ghost
Copy link
Copy Markdown

ghost commented Jan 4, 2019

Not awaiting review

@colby-swandale
Copy link
Copy Markdown
Member

I'm just going to merge this manually, i don't know why bundlerbot is not playing nice.

@colby-swandale colby-swandale merged commit 31678a3 into 2-0-stable Jan 4, 2019
colby-swandale pushed a commit that referenced this pull request Jan 4, 2019
It turns out that every existing version of RubyGems will ignore the required RubyGems version and try to install the newest version of Bundler... until the middle of the install, when it will raise an exception and fail. This PR tries to fix that in the least-bad way possible.

What was the end-user problem that led to this PR?

The end user problem is that running `gem install bundler` now produces an exception on any Ruby and RubyGems older than 2.6 or 3.0 respectively.

What was your diagnosis of the problem?

Unfortunately, RubyGems does not use the `required_rubygems_version` to select an older version of Bundler to install. Instead, RubyGems tries to install the newest version even though that version is not compatible, and then raises an exception during installation because it is not compatible.

What is your fix for the problem, implemented in this PR?

Lower the `required_rubygems_version` in Bundler 2 back down to RubyGems 2.5 or greater.

Why did you choose this fix out of the possible options?

I chose this fix because it will stop RubyGems from raising an exception while installing Bundler 2, and instead allow the installation to complete successfully.

There are some bugfixes in RubyGems 3 that improve the quality of life for Bundler 2 users, but they are less bad than RubyGems simply exploding anytime you try to run `gem install bundler`.
@ghost
Copy link
Copy Markdown

ghost commented Jan 4, 2019

Timed out

@mvz
Copy link
Copy Markdown
Contributor

mvz commented Aug 30, 2019

As predicted in #6867 (comment), this change 'broke' the BundlerVersionFinder on systems with older versions of RubyGems.

(Well, not 'broke', because it wasn't working to begin with, but the sudden silent updating of versions in Gemfile.lock was a tad surprising, given the changelog entry).

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

Hi @mvz, just making sure. You mean whatever change bumped the requirement to 3.0.0, not this specific changeset that lowered it back to 2.5. Right?

@mvz
Copy link
Copy Markdown
Contributor

mvz commented Sep 1, 2019

I do mean that I think this particular pull request introduced a problem: Given a system with pre-3.0 rubygems version, and a Gemfile.lock with bundler 1.17.3 specified inside,

  • Bundler 2.0.0 will complain about needing a newer rubygems.
  • Bundler 2.0.1 will overwrite the Gemfile.lock with its own version number.

With rubygems 3.0, both versions keep the existing bundler version in the Gemfile.lock as it is.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

Mmmm. But that sounds like some bug fixed in rubygems 3.0, right? Or would you expect us to change anything in bundler related to this?

@mvz
Copy link
Copy Markdown
Contributor

mvz commented Sep 1, 2019

Well, as I see it, Bundler 2.0.0 required rubygems 3.0, to make one important feature work (version switching). Then, in 2.0.1, it lowered the requirement, and this important feature broke, without much warning (https://github.com/bundler/bundler/blob/master/CHANGELOG.md#201-2019-01-04).

So yes, it's a bug fixed in rubygems 3.0, but isn't that why the dependency was changed in the first place?

Some things Bundler could do:

  • Document that keeping the version in Gemfile.lock intact is broken with pre-3.0 versions of rubygems.
  • Warn about use of older versions of rubygems.
  • Up the version requirements on rubygems. I'll readily admit that I have absolutely no idea how feasible that is.

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

So yes, it's a bug fixed in rubygems 3.0, but isn't that why the dependency was changed in the first place?

Yeah, but we realized that was too agressive, because it would make gem install bundler fail on older rubygems. That's why we reverted it.

I believe this is a problem only on ruby 2.3 and ruby 2.4, because the newer rubies we support provide rubygems 2.7 or higher by default, and I don't think this is an issue on rubygems >= 2.7.

I would be good with adding a documentation bnit about recommended rubygems & ruby support vs official rubygems & ruby support.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 18, 2019
## 2.0.2 (2019-05-13)

Changes:

  - Fixes for Bundler integration with ruby-src ([#6941](rubygems/bundler#6941), [#6973](rubygems/bundler#6973), [#6977](rubygems/bundler#6977), [#6315](rubygems/bundler#6315), [#7061](rubygems/bundler#7061))
  - Use `__dir__` instead of `__FILE__` when generating a gem with `bundle gem` ([#6503](rubygems/bundler#6503))
  - Use `https` on externals links in the Bundler gemspec ([#6721](rubygems/bundler#6721))
  - Removed duplicate gem names from the suggested `did you mean` list for gem typos ([#6739](rubygems/bundler#6739))
  - Removed Ruby 1.x compatibility code ([#6764](rubygems/bundler#6764), [#6806](rubygems/bundler#6806))
  - Fixed an issue where `bundle remove` would crash with certain Gemfiles ([#6768](rubygems/bundler#6769))
  - Fixed indentation in the Bundler executable template ([#6773](rubygems/bundler#6773))
  - Fixed an issue where plugins could register for the same Bundler hook multiple times ([#6775](rubygems/bundler#6775))
  - Changed the "multiple sources" message in `bundle install` to be a warning instead of an error ([#6790](rubygems/bundler#6790))
  - Fixed a bug where path gems would break when using `only_update_to_newer_versions` ([#6774](rubygems/bundler#6774))
  - Fixed a bug where installing plugins with the `--delpoyment` setting would fail ([#6805](rubygems/bundler#6805))
  - Fixed an issue where `bundle update` couldn't update & install a gem when `no_install` was set (a `bundle package` config) ([#7078](rubygems/bundler#7078))
  - Fixed an issue where users could not run `bundle exec` on default gems ([#6963](rubygems/bundler#6963))
  - Updated vendor libraries to their latest version ([#7076](rubygems/bundler#7067), [#7068](rubygems/bundler#7068))
  - Fixed an issue where the `github` source was not using `https` by default that we mentioned in the 2.0 release ([#7182](rubygems/bundler#7182))
  - Fixed an issue where `rake release` was not outputting the message to users asking for a 2fa token ([#7199](rubygems/bundler#7199))

Documentation:

  - Fix incorrect documented `BUNDLE_PATH_RELATIVE_TO_CWD` env var ([#6751](rubygems/bundler#6751))
  - Update URLs in Bundler's documentation to use `https` ([#6935](rubygems/bundler#6935))

## 2.0.1 (2019-01-04)

Changes:

  - Relaxed RubyGems requirement to `>= 2.5.0` ([#6867](rubygems/bundler#6867))

## 2.0.0 (2019-01-03)

No new changes

## 2.0.0.pre.3 (2018-12-30)

Breaking Changes:

  - Bundler 2 now requires RubyGems 3.0.0 at minimum

Changes:

  - Ruby 2.6 compatibility fixes (@segiddins)
  - Import changes from Bundler 1.17.3 release

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`

## 2.0.0.pre.2 (2018-11-27)

Breaking Changes:

  - `:github` source in the Gemfile now defaults to using HTTPS

Changes

  - Add compatibility for Bundler merge into ruby-src

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`

## 2.0.0.pre.1 (2018-11-09)

Breaking Changes:

  - Dropped support for versions of Ruby < 2.3
  - Dropped support for version of RubyGems < 2.5
  - Moved error messages from STDOUT to STDERR

Note: To upgrade your Gemfile to Bundler 2 you will need to run `bundle update --bundler`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants