rubygems 2.7.5 fails to execute "bundle"

Bug #1749226 reported by Rob U
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
rubygems-integration (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have replicated the problem on Ubuntu 16.04, Ubuntu 12.04 and in Docker environment and in few different ruby versions.

It appears rubygems-integration package monkeypatches rubygems and rubygems fails to load `bundle` executable because it's installed in wrong location.

Steps to reproduce and more details can be found here: https://github.com/rubygems/rubygems/issues/2180

Disabling the monkeypatch via "DEBIAN_DISABLE_RUBYGEMS_INTEGRATION" env variable fixes the issue.

Downgrade of rubygems to 2.7.4 fixes the issue too.

I'm attaching a Dockerfile, running the container will crash. Uncomment the "ENV DEBIAN_DISABLE_RUBYGEMS_INTEGRATION=true" line to fix the issue.

I'm not sure what's the best approach here as I don't understand what problems the rubygems-integration is solving, but perhaps it's worth adding another condition to not monkeypatch if rubygems version is 2.7.5 or higher?

Thanks for your time!
Rob

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: rubygems-integration 1.10
ProcVersionSignature: Ubuntu 4.13.0-32.35~16.04.1-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.15
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Feb 13 16:48:39 2018
InstallationDate: Installed on 2017-10-27 (109 days ago)
InstallationMedia: Ubuntu 16.04.3 LTS "Xenial Xerus" - Release amd64 (20170801)
PackageArchitecture: all
SourcePackage: rubygems-integration
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Rob U (robtru) wrote :
Revision history for this message
Jacob Chae (jbcden) wrote :

I just looked into this and it looks like the issue is being caused by a change from https://launchpadlibrarian.net/230675272/rubygems-integration_1.9_1.10.diff.gz. The issue is the change to `lib/rubygems/defaults/operating_system.rb` which aliases `default_specifications_dir` to `upstream_default_specifications_dir`. I'm not sure why the change was made but the `upstream_specifications_dir` is what is causing rubygems to look for the gem executables in `/usr/`. If you look at https://github.com/rubygems/rubygems/blob/2ed01b87152cb5ebec3ae934dca50a1609ea2ebd/lib/rubygems/specification.rb#L889, you can see that it uses `default_specifications_dir` to figure out where to load the gems from with `Gem::Specification.load` in `Gem::Specification.each_spec`.

As I said before I don't know the backstory for this change but changing that, or the default that's being set for `upstream_specifications_dir` seem to be the potential fixes.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in rubygems-integration (Ubuntu):
status: New → Confirmed
Revision history for this message
Jacob Chae (jbcden) wrote :

I just realized I misspoke slightly in the above. All places that I said `upstream_default_specifications_dir` should actually be `upstream_default_dir`.

Revision history for this message
Rob U (robtru) wrote :

Thanks very much Jacob,

I will try to look deeper into rubygems codebase and will let you know how it goes.

Revision history for this message
Rob U (robtru) wrote :

I think I just managed to narrow down the problem to a specific commit in rubygems that introduced the regression. I don't know how to exactly fix it, but I will keep you updated.

Revision history for this message
Jacob Chae (jbcden) wrote :

I just realized I misspoke slightly in the above. All places that I said `upstream_default_specifications_dir` should actually be `upstream_default_dir`.

Revision history for this message
Jacob Chae (jbcden) wrote :

Hi Rob,

Sorry for that duplicate comment. If you need any help with anything just let me know. I'd be happy to help put together something for a rubygems PR if need be.

Revision history for this message
Jacob Chae (jbcden) wrote :

I would also love to know what commit you think is causing the issue. I've been trying to dig through a bit and haven't had any luck tracking down the issue.

Revision history for this message
Rob U (robtru) wrote :
Revision history for this message
Rob U (robtru) wrote :

This has been resolved in rubygems & bundler.

Using Bundler 1.16.2 (that's the current release as of today, released in May'18) I don't see the error anymore. The original issue in rubygems has been closed too & I think it's safe to close this bug report.

Jacob thanks for your time looking into this!

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Are there still changes needed in Ubuntu to close this bug? Sorry for asking, I'm not at all familiar with rubygems and bundler, and the rubygems-integration package versions available in Ubuntu do not seem to match what was mentioned in this bug so far:

$ rmadison rubygems-integration
 rubygems-integration | 1.5 | trusty | source, all
 rubygems-integration | 1.10 | xenial | source, all
 rubygems-integration | 1.11 | artful | source, all
 rubygems-integration | 1.11 | bionic | source, all
 rubygems-integration | 1.11 | cosmic | source, all

Revision history for this message
Rob U (robtru) wrote :

This is good to close and no changes are needed in Ubuntu. It wasn't backported, but that's no reason to address this in Ubuntu. Current version works as expected and the fix is as simple as running "gem update --system".

Revision history for this message
Robie Basak (racb) wrote :

Thank you for the update. I'll mark this bug as Invalid for action in Ubuntu itself then.

Changed in rubygems-integration (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.