Platform-specific gem ignored and Gemfile.lock unexpectedly changed by bundle install after upgrading to Ruby 3.3.0
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
Describe the problem as clearly as you can
When upgrading from Ruby 3.2.3 to 3.3.0, a bundle install on platform x86_64-linux seems to ignore the platform-specific versions, installs the gem with native extensions, and modifies the Gemfile.lock as follows:
--- Gemfile.lock-3.2.3 2024-03-05 17:16:44
+++ Gemfile.lock 2024-03-05 17:18:53
@@ -4,3 +4,3 @@
- sqlite3 (1.6.7-arm64-darwin)
- sqlite3 (1.6.7-x86_64-darwin)
- sqlite3 (1.6.7-x86_64-linux)
+ mini_portile2 (2.8.5)
+ sqlite3 (1.6.7)
+ mini_portile2 (~> 2.8.0)
Did you try upgrading rubygems & bundler?
Yes, issue reproduced with 3.5.6/2.5.6
Post steps to reproduce the problem
With this setup script in setup_lockfile.sh on the host machine:
set -eux
gem update --system 3.5.6
bundle init
bundle lock --add-platform arm64-darwin
bundle lock --add-platform x86_64-darwin
bundle lock --remove-platform ruby
echo "gem 'sqlite3', '= 1.6.7'" >> Gemfile
bundle install
Run the script inside a Ruby 3.2.3 container:
docker run --rm --volume $(pwd):/repro --workdir /repro ruby:3.2.3-slim bash setup_lockfile.sh
Which will generate this Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
sqlite3 (1.6.7-arm64-darwin)
sqlite3 (1.6.7-x86_64-darwin)
sqlite3 (1.6.7-x86_64-linux)
PLATFORMS
arm64-darwin
x86_64-darwin
x86_64-linux
DEPENDENCIES
sqlite3 (= 1.6.7)
BUNDLED WITH
2.5.6
With this script in demonstrate_issue.sh on the host machine (in the same directory as the Gemfile{,.lock} as generated by the 3.2.3 container in the previous step):
set -eux
apt-get update
apt-get install -y build-essential pkg-config
gem update --system 3.5.6
bundle install
Run the script inside a Ruby 3.3.0 container:
docker run --rm --volume $(pwd):/repro --workdir /repro ruby:3.3.0-slim bash demonstrate_issue.sh
...then (after a delay to install the extension) the following Gemfile.lock is generated:
GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.8.5)
sqlite3 (1.6.7)
mini_portile2 (~> 2.8.0)
PLATFORMS
arm64-darwin
x86_64-darwin
x86_64-linux
DEPENDENCIES
sqlite3 (= 1.6.7)
BUNDLED WITH
2.5.6
Which command did you run?
bundle install after upgrading Ruby to 3.3.0.
What were you expecting to happen?
That sqlite3 (1.6.7-x86_64-linux) would be installed (thus not requiring build-essential and pkg-config) and the Gemfile.lock to not be modified.
What actually happened?
The platform-specific gem in the lockfile was ignored (with no output to say why) and the lockfile was modified to remove the other platform-specific versions.
If not included with the output of your command, run bundle env and paste the output below
In the Ruby 3.2.3 container:
Bundler 2.5.6
Platforms ruby, x86_64-linux
Ruby 3.2.3p157 (2024-01-18 revision 52bb2ac0a6971d0391efa2275f7a66bff319087c) [x86_64-linux]
Full Path /usr/local/bin/ruby
Config Dir /usr/local/etc
RubyGems 3.5.6
Gem Home /usr/local/bundle
Gem Path /root/.local/share/gem/ruby/3.2.0:/usr/local/lib/ruby/gems/3.2.0:/usr/local/bundle
User Home /root
User Path /root/.local/share/gem/ruby/3.2.0
Bin Dir /usr/local/bundle/bin
Tools
Git not installed
RVM not installed
rbenv not installed
chruby not installed
In the Ruby 3.3.0 container:
Bundler 2.5.6
Platforms ruby, x86_64-linux
Ruby 3.3.0p0 (2023-12-25 revision 5124f9ac7513eb590c37717337c430cb93caa151) [x86_64-linux]
Full Path /usr/local/bin/ruby
Config Dir /usr/local/etc
RubyGems 3.5.6
Gem Home /usr/local/bundle
Gem Path /root/.local/share/gem/ruby/3.3.0:/usr/local/lib/ruby/gems/3.3.0:/usr/local/bundle
User Home /root
User Path /root/.local/share/gem/ruby/3.3.0
Bin Dir /usr/local/bundle/bin
Tools
Git not installed
RVM not installed
rbenv not installed
chruby not installed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with setup_lockfile.sh and demonstrate_issue.sh, then reproduce the difference by running them in the Ruby 3.2.3 and Ruby 3.3.0 containers. Compare the resulting Gemfile.lock files and Bundler output; done means bundle install selects sqlite3 (1.6.7-x86_64-linux) and leaves the lockfile unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100