rubygems icon indicating copy to clipboard operation
rubygems copied to clipboard

`bundle update` removing `ruby` platform

Open luizkowalski opened this issue 3 years ago • 8 comments

Describe the problem as clearly as you can

After updating to 2.3.20 I noticed that when I run bundle update, it removes the ruby platform and only keeps arm64-darwin-21, deleting gems that are needed in production.

Here is the output of the bundle update command:

❯ bundle update
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
....
Using web-console 4.2.0
Using rails 7.0.3.1
Bundle updated!

and this is the git diff:

image

Did you try upgrading rubygems & bundler?

Seeing it on the latest version

Post steps to reproduce the problem

Here is how I think it can be reproduced

On a M1 machine

  • make sure arm64-darwin-21 and ruby platform are present in the gemfile
  • bundle update on a gemfile without any version constraints
  • watch ruby platform disappear

Which command did you run?

bundle update

What were you expecting to happen?

Gems updated (if needed) without any platform changes

What actually happened?

ruby platform removed

If not included with the output of your command, run bundle env and paste the output below

## Environment

Bundler 2.3.20 Platforms ruby, arm64-darwin-21 Ruby 3.1.2p20 (2022-04-12 revision 4491bb740a9506d76391ac44bb2fe6e483fec952) [arm64-darwin-21] Full Path /Users/luiz/.rubies/ruby-3.1.2/bin/ruby Config Dir /Users/luiz/.rubies/ruby-3.1.2/etc RubyGems 3.3.20 Gem Home /Users/luiz/.gem/ruby/3.1.2 Gem Path /Users/luiz/.gem/ruby/3.1.2:/Users/luiz/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0 User Home /Users/luiz User Path /Users/luiz/.gem/ruby/3.1.0 Bin Dir /Users/luiz/.gem/ruby/3.1.2/bin Tools
Git 2.37.1 RVM not installed rbenv not installed chruby 0.3.9


## Bundler Build Metadata

Built At 2022-08-10 Git SHA 4fd2813f54 Released Version true


## Gemfile

### Gemfile

```ruby
# frozen_string_literal: true

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.2"

gem "rails", "~> 7.0.3"

gem "sprockets-rails"

gem "pg", "~> 1.4"

gem "puma"

gem "cssbundling-rails"
gem "jsbundling-rails"

gem "stimulus-rails"
gem "turbo-rails"

gem "ulid"

gem "dry-monads"
gem "dry-struct"
gem "dry-validation"

gem "bcrypt"

gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

gem "sidekiq"

gem "rack-attack"

gem "rack-cors"

group :production do
  gem "fly-ruby"
  gem "lograge"
  gem "newrelic_rpm"
end

group :development, :test do
  gem "byebug"
  gem "dotenv-rails"
  gem "rubocop"
  gem "rubocop-performance", require: false
  gem "rubocop-rails", require: false
  gem "rubocop-thread_safety", require: false
  gem "ruby-lsp"
end

group :development do
  gem "web-console"

  gem "rack-mini-profiler"
  gem "stackprof"
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.0.3.1)
      actionpack (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (7.0.3.1)
      actionpack (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      mail (>= 2.7.1)
      net-imap
      net-pop
      net-smtp
    actionmailer (7.0.3.1)
      actionpack (= 7.0.3.1)
      actionview (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      mail (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.0)
    actionpack (7.0.3.1)
      actionview (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      rack (~> 2.0, >= 2.2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (7.0.3.1)
      actionpack (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.0.3.1)
      activesupport (= 7.0.3.1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (7.0.3.1)
      activesupport (= 7.0.3.1)
      globalid (>= 0.3.6)
    activemodel (7.0.3.1)
      activesupport (= 7.0.3.1)
    activerecord (7.0.3.1)
      activemodel (= 7.0.3.1)
      activesupport (= 7.0.3.1)
    activestorage (7.0.3.1)
      actionpack (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      marcel (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (7.0.3.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    ast (2.4.2)
    bcrypt (3.1.18)
    bindex (0.8.1)
    builder (3.2.4)
    byebug (11.1.3)
    concurrent-ruby (1.1.10)
    connection_pool (2.2.5)
    crass (1.0.6)
    cssbundling-rails (1.1.1)
      railties (>= 6.0.0)
    digest (3.1.0)
    dotenv (2.8.1)
    dotenv-rails (2.8.1)
      dotenv (= 2.8.1)
      railties (>= 3.2)
    dry-configurable (0.15.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.6)
    dry-container (0.10.1)
      concurrent-ruby (~> 1.0)
    dry-core (0.8.1)
      concurrent-ruby (~> 1.0)
    dry-inflector (0.3.0)
    dry-initializer (3.1.1)
    dry-logic (1.2.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.5, >= 0.5)
    dry-monads (1.4.0)
      concurrent-ruby (~> 1.0)
      dry-core (~> 0.7)
    dry-schema (1.9.3)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.13, >= 0.13.0)
      dry-core (~> 0.5, >= 0.5)
      dry-initializer (~> 3.0)
      dry-logic (~> 1.0)
      dry-types (~> 1.5)
    dry-struct (1.4.0)
      dry-core (~> 0.5, >= 0.5)
      dry-types (~> 1.5)
      ice_nine (~> 0.11)
    dry-types (1.5.1)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.3)
      dry-core (~> 0.5, >= 0.5)
      dry-inflector (~> 0.1, >= 0.1.2)
      dry-logic (~> 1.0, >= 1.0.2)
    dry-validation (1.8.1)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.7, >= 0.7.1)
      dry-core (~> 0.5, >= 0.5)
      dry-initializer (~> 3.0)
      dry-schema (~> 1.8, >= 1.8.0)
    erubi (1.11.0)
    fly-ruby (0.3.0)
      rack (~> 2.0)
    globalid (1.0.0)
      activesupport (>= 5.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    ice_nine (0.11.2)
    jsbundling-rails (1.0.3)
      railties (>= 6.0.0)
    json (2.6.2)
    language_server-protocol (3.16.0.3)
    lograge (0.12.0)
      actionpack (>= 4)
      activesupport (>= 4)
      railties (>= 4)
      request_store (~> 1.0)
    loofah (2.18.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (1.0.2)
    method_source (1.0.0)
    mini_mime (1.1.2)
    minitest (5.16.2)
    net-imap (0.2.3)
      digest
      net-protocol
      strscan
    net-pop (0.1.1)
      digest
      net-protocol
      timeout
    net-protocol (0.1.3)
      timeout
    net-smtp (0.3.1)
      digest
      net-protocol
      timeout
    newrelic_rpm (8.9.0)
    nio4r (2.5.8)
    nokogiri (1.13.8-arm64-darwin)
      racc (~> 1.4)
    parallel (1.22.1)
    parser (3.1.2.1)
      ast (~> 2.4.1)
    pg (1.4.3)
    prettier_print (0.1.0)
    puma (5.6.4)
      nio4r (~> 2.0)
    racc (1.6.0)
    rack (2.2.4)
    rack-attack (6.6.1)
      rack (>= 1.0, < 3)
    rack-cors (1.1.1)
      rack (>= 2.0.0)
    rack-mini-profiler (3.0.0)
      rack (>= 1.2.0)
    rack-test (2.0.2)
      rack (>= 1.3)
    rails (7.0.3.1)
      actioncable (= 7.0.3.1)
      actionmailbox (= 7.0.3.1)
      actionmailer (= 7.0.3.1)
      actionpack (= 7.0.3.1)
      actiontext (= 7.0.3.1)
      actionview (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activemodel (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      bundler (>= 1.15.0)
      railties (= 7.0.3.1)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.3)
      loofah (~> 2.3)
    railties (7.0.3.1)
      actionpack (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
      zeitwerk (~> 2.5)
    rainbow (3.1.1)
    rake (13.0.6)
    redis (4.7.1)
    regexp_parser (2.5.0)
    request_store (1.5.1)
      rack (>= 1.4)
    rexml (3.2.5)
    rubocop (1.34.1)
      json (~> 2.3)
      parallel (~> 1.10)
      parser (>= 3.1.2.1)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.8, < 3.0)
      rexml (>= 3.2.5, < 4.0)
      rubocop-ast (>= 1.20.0, < 2.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 3.0)
    rubocop-ast (1.21.0)
      parser (>= 3.1.1.0)
    rubocop-performance (1.14.3)
      rubocop (>= 1.7.0, < 2.0)
      rubocop-ast (>= 0.4.0)
    rubocop-rails (2.15.2)
      activesupport (>= 4.2.0)
      rack (>= 1.1)
      rubocop (>= 1.7.0, < 2.0)
    rubocop-thread_safety (0.4.4)
      rubocop (>= 0.53.0)
    ruby-lsp (0.2.1)
      language_server-protocol
      sorbet-runtime
      syntax_tree (>= 2.4)
    ruby-progressbar (1.11.0)
    sidekiq (6.5.4)
      connection_pool (>= 2.2.2)
      rack (~> 2.0)
      redis (>= 4.5.0)
    sorbet-runtime (0.5.10297)
    sprockets (4.1.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.4.2)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
      sprockets (>= 3.0.0)
    stackprof (0.2.20)
    stimulus-rails (1.1.0)
      railties (>= 6.0.0)
    strscan (3.0.4)
    syntax_tree (3.3.0)
      prettier_print
    thor (1.2.1)
    timeout (0.3.0)
    turbo-rails (1.1.1)
      actionpack (>= 6.0.0)
      activejob (>= 6.0.0)
      railties (>= 6.0.0)
    tzinfo (2.0.5)
      concurrent-ruby (~> 1.0)
    ulid (1.3.0)
    unicode-display_width (2.2.0)
    web-console (4.2.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    zeitwerk (2.6.0)

PLATFORMS
  arm64-darwin-21

DEPENDENCIES
  bcrypt
  byebug
  cssbundling-rails
  dotenv-rails
  dry-monads
  dry-struct
  dry-validation
  fly-ruby
  jsbundling-rails
  lograge
  newrelic_rpm
  pg (~> 1.4)
  puma
  rack-attack
  rack-cors
  rack-mini-profiler
  rails (~> 7.0.3)
  rubocop
  rubocop-performance
  rubocop-rails
  rubocop-thread_safety
  ruby-lsp
  sidekiq
  sprockets-rails
  stackprof
  stimulus-rails
  turbo-rails
  tzinfo-data
  ulid
  web-console

RUBY VERSION
   ruby 3.1.2p20

BUNDLED WITH
   2.3.20

luizkowalski avatar Aug 10 '22 19:08 luizkowalski

Oh no, I don't think this should've applied to this case 😮. Sorry. I'll have a look tomorrow and possibly get a quick release out fixing this.

deivid-rodriguez avatar Aug 10 '22 19:08 deivid-rodriguez

no worries, thanks for the quick reply!

luizkowalski avatar Aug 10 '22 19:08 luizkowalski

I always have to miss an edge case! 😠

It's because of the gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] dependency. If you're not using Windows or JRuby, you can remove that line from the Gemfile and then bundle update should behave as expected. And if you are, your probably want to add those to the Gemfile.lock file.

Anyways, this should be an easy fix, I'll open a PR tomorrow.

deivid-rodriguez avatar Aug 10 '22 23:08 deivid-rodriguez

I have just run into this (at the end of a list of issues) on my Debian Sid system, when I tried to reinstall rubies because of probably unrelated OpenSSL issues that you likely only get when you're on Debian Sid, (*not relevant here). The error:

$ cat /home/kingdon/.rvm/log/1660220064_ruby-3.1.2/rubygems.install.log
[2022-08-11 12:16:03] /home/kingdon/.rvm/rubies/ruby-3.1.2/bin/ruby
current path: /home/kingdon/.rvm/src/rubygems-3.0.9
GEM_PATH=/home/kingdon/.rvm/gems/ruby-3.1.2:/home/kingdon/.rvm/gems/ruby-3.1.2@global
GEM_HOME=/home/kingdon/.rvm/gems/ruby-3.1.2
PATH=/home/kingdon/.rvm/usr/bin:/home/kingdon/.rvm/gems/ruby-3.1.2/bin:/home/kingdon/.rvm/gems/ruby-3.1.2@global/bin:/home/kingdon/.rvm/rubies/ruby-3.1.2/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/kingdon/.rvm/bin:/home/kingdon/.rvm/bin:/home/kingdon/.rvm/bin
command(7): env GEM_HOME=/home/kingdon/.rvm/gems/ruby-3.1.2@global GEM_PATH= /home/kingdon/.rvm/rubies/ruby-3.1.2/bin/ruby -d /home/kingdon/.rvm/src/rubygems-3.0.9/setup.rb --no-document
Exception `LoadError' at /home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems.rb:1325 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems.rb:1341 - cannot load such file -- rubygems/defaults/ruby
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/exceptions.rb:283: warning: already initialized constant Gem::UnsatisfiableDepedencyError
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/exceptions.rb:283: warning: previous definition of UnsatisfiableDepedencyError was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:342: warning: already initialized constant Gem::Security::DIGEST_ALGORITHM
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:342: warning: previous definition of DIGEST_ALGORITHM was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:355: warning: already initialized constant Gem::Security::DIGEST_NAME
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:355: warning: previous definition of DIGEST_NAME was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:365: warning: already initialized constant Gem::Security::KEY_ALGORITHM
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:365: warning: previous definition of KEY_ALGORITHM was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:373: warning: already initialized constant Gem::Security::KEY_LENGTH
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:373: warning: previous definition of KEY_LENGTH was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:379: warning: already initialized constant Gem::Security::KEY_CIPHER
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:379: warning: previous definition of KEY_CIPHER was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:384: warning: already initialized constant Gem::Security::ONE_DAY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:384: warning: previous definition of ONE_DAY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:389: warning: already initialized constant Gem::Security::ONE_YEAR
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:389: warning: previous definition of ONE_YEAR was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security.rb:399: warning: already initialized constant Gem::Security::EXTENSIONS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security.rb:399: warning: previous definition of EXTENSIONS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:12: warning: already initialized constant Gem::VERSION
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:12: warning: previous definition of VERSION was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/compatibility.rb:14: warning: already initialized constant Gem::RubyGemsVersion
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/compatibility.rb:14: warning: previous definition of RubyGemsVersion was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/compatibility.rb:18: warning: already initialized constant Gem::RbConfigPriorities
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/compatibility.rb:18: warning: previous definition of RbConfigPriorities was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/compatibility.rb:39: warning: already initialized constant Gem::RubyGemsPackageVersion
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/compatibility.rb:39: warning: previous definition of RubyGemsPackageVersion was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/defaults.rb:3: warning: already initialized constant Gem::DEFAULT_HOST
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/defaults.rb:3: warning: previous definition of DEFAULT_HOST was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:118: warning: already initialized constant Gem::RUBYGEMS_DIR
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:118: warning: previous definition of RUBYGEMS_DIR was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:123: warning: already initialized constant Gem::WIN_PATTERNS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:123: warning: previous definition of WIN_PATTERNS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:132: warning: already initialized constant Gem::GEM_DEP_FILES
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:132: warning: previous definition of GEM_DEP_FILES was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:142: warning: already initialized constant Gem::REPOSITORY_SUBDIRECTORIES
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:142: warning: previous definition of REPOSITORY_SUBDIRECTORIES was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:154: warning: already initialized constant Gem::REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:154: warning: previous definition of REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:163: warning: already initialized constant Gem::READ_BINARY_ERRORS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:163: warning: previous definition of READ_BINARY_ERRORS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:173: warning: already initialized constant Gem::WRITE_BINARY_ERRORS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:173: warning: previous definition of WRITE_BINARY_ERRORS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:179: warning: already initialized constant Gem::USE_BUNDLER_FOR_GEMDEPS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:179: warning: previous definition of USE_BUNDLER_FOR_GEMDEPS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:186: warning: already initialized constant Gem::LOADED_SPECS_MUTEX
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:186: warning: previous definition of LOADED_SPECS_MUTEX was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems.rb:1342: warning: already initialized constant Gem::MARSHAL_SPEC_DIR
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems.rb:1342: warning: previous definition of MARSHAL_SPEC_DIR was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/version.rb:157: warning: already initialized constant Gem::Version::VERSION_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/version.rb:157: warning: previous definition of VERSION_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/version.rb:158: warning: already initialized constant Gem::Version::ANCHORED_VERSION_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/version.rb:158: warning: previous definition of ANCHORED_VERSION_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:13: warning: already initialized constant Gem::Requirement::OPS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/requirement.rb:13: warning: previous definition of OPS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:23: warning: already initialized constant Gem::Requirement::SOURCE_SET_REQUIREMENT
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/requirement.rb:23: warning: previous definition of SOURCE_SET_REQUIREMENT was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:26: warning: already initialized constant Gem::Requirement::PATTERN_RAW
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/requirement.rb:26: warning: previous definition of PATTERN_RAW was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:31: warning: already initialized constant Gem::Requirement::PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/requirement.rb:31: warning: previous definition of PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:36: warning: already initialized constant Gem::Requirement::DefaultRequirement
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/requirement.rb:36: warning: previous definition of DefaultRequirement was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/requirement.rb:310: warning: already initialized constant Gem::Version::Requirement
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/platform.rb:198: warning: already initialized constant Gem::Platform::RUBY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/platform.rb:198: warning: previous definition of RUBY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/platform.rb:204: warning: already initialized constant Gem::Platform::CURRENT
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/platform.rb:204: warning: previous definition of CURRENT was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/stub_specification.rb:9: warning: already initialized constant Gem::StubSpecification::PREFIX
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/stub_specification.rb:9: warning: previous definition of PREFIX was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/stub_specification.rb:12: warning: already initialized constant Gem::StubSpecification::OPEN_MODE
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/stub_specification.rb:12: warning: previous definition of OPEN_MODE was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/stub_specification.rb:18: warning: already initialized constant Gem::StubSpecification::StubLine::NO_EXTENSIONS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/stub_specification.rb:18: warning: previous definition of NO_EXTENSIONS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/stub_specification.rb:21: warning: already initialized constant Gem::StubSpecification::StubLine::REQUIRE_PATHS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/stub_specification.rb:21: warning: previous definition of REQUIRE_PATHS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/stub_specification.rb:31: warning: already initialized constant Gem::StubSpecification::StubLine::REQUIRE_PATH_LIST
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/stub_specification.rb:31: warning: previous definition of REQUIRE_PATH_LIST was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:5: warning: already initialized constant Gem::SpecificationPolicy::VALID_NAME_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:5: warning: previous definition of VALID_NAME_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:7: warning: already initialized constant Gem::SpecificationPolicy::SPECIAL_CHARACTERS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:7: warning: previous definition of SPECIAL_CHARACTERS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:9: warning: already initialized constant Gem::SpecificationPolicy::VALID_URI_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:9: warning: previous definition of VALID_URI_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:11: warning: already initialized constant Gem::SpecificationPolicy::METADATA_LINK_KEYS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:11: warning: previous definition of METADATA_LINK_KEYS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:325: warning: already initialized constant Gem::SpecificationPolicy::LAZY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:325: warning: previous definition of LAZY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:326: warning: already initialized constant Gem::SpecificationPolicy::LAZY_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:326: warning: previous definition of LAZY_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification_policy.rb:327: warning: already initialized constant Gem::SpecificationPolicy::HOMEPAGE_URI_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification_policy.rb:327: warning: previous definition of HOMEPAGE_URI_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:53: warning: already initialized constant Gem::Specification::NONEXISTENT_SPECIFICATION_VERSION
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:53: warning: previous definition of NONEXISTENT_SPECIFICATION_VERSION was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:76: warning: already initialized constant Gem::Specification::CURRENT_SPECIFICATION_VERSION
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:76: warning: previous definition of CURRENT_SPECIFICATION_VERSION was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:82: warning: already initialized constant Gem::Specification::SPECIFICATION_VERSION_HISTORY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:82: warning: previous definition of SPECIFICATION_VERSION_HISTORY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:100: warning: already initialized constant Gem::Specification::MARSHAL_FIELDS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:100: warning: previous definition of MARSHAL_FIELDS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:109: warning: already initialized constant Gem::Specification::TODAY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:109: warning: previous definition of TODAY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:112: warning: already initialized constant Gem::Specification::LOAD_CACHE
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:112: warning: previous definition of LOAD_CACHE was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:117: warning: already initialized constant Gem::Specification::VALID_NAME_PATTERN
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:117: warning: previous definition of VALID_NAME_PATTERN was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:168: warning: already initialized constant Gem::Specification::INITIALIZE_CODE_FOR_DEFAULTS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:168: warning: previous definition of INITIALIZE_CODE_FOR_DEFAULTS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:193: warning: already initialized constant Gem::Specification::NOT_FOUND
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:193: warning: previous definition of NOT_FOUND was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:831: warning: already initialized constant Gem::Specification::EMPTY
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:831: warning: previous definition of EMPTY was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:1726: warning: already initialized constant Gem::Specification::DateLike
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:1726: warning: previous definition of DateLike was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/specification.rb:1731: warning: already initialized constant Gem::Specification::DateTimeFormat
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/specification.rb:1731: warning: previous definition of DateTimeFormat was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb:12: warning: already initialized constant Kernel::RUBYGEMS_ACTIVATION_MONITOR
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/core_ext/kernel_require.rb:12: warning: previous definition of RUBYGEMS_ACTIVATION_MONITOR was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/user_interaction.rb:562: warning: already initialized constant Gem::StreamUI::ThreadedDownloadReporter::MUTEX
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/user_interaction.rb:562: warning: previous definition of MUTEX was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:7: warning: already initialized constant Gem::Security::NoSecurity
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:7: warning: previous definition of NoSecurity was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:25: warning: already initialized constant Gem::Security::AlmostNoSecurity
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:25: warning: previous definition of AlmostNoSecurity was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:42: warning: already initialized constant Gem::Security::LowSecurity
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:42: warning: previous definition of LowSecurity was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:61: warning: already initialized constant Gem::Security::MediumSecurity
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:61: warning: previous definition of MediumSecurity was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:80: warning: already initialized constant Gem::Security::HighSecurity
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:80: warning: previous definition of HighSecurity was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:93: warning: already initialized constant Gem::Security::SigningPolicy
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:93: warning: previous definition of SigningPolicy was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/policies.rb:106: warning: already initialized constant Gem::Security::Policies
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/policies.rb:106: warning: previous definition of Policies was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/trust_dir.rb:11: warning: already initialized constant Gem::Security::TrustDir::DEFAULT_PERMISSIONS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/trust_dir.rb:11: warning: previous definition of DEFAULT_PERMISSIONS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/security/signer.rb:37: warning: already initialized constant Gem::Security::Signer::DEFAULT_OPTIONS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/security/signer.rb:37: warning: previous definition of DEFAULT_OPTIONS was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/safe_yaml.rb:10: warning: already initialized constant Gem::SafeYAML::PERMITTED_CLASSES
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/safe_yaml.rb:10: warning: previous definition of PERMITTED_CLASSES was here
/home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/site_ruby/3.1.0/rubygems/safe_yaml.rb:24: warning: already initialized constant Gem::SafeYAML::PERMITTED_SYMBOLS
/home/kingdon/.rvm/src/rubygems-3.0.9/lib/rubygems/safe_yaml.rb:24: warning: previous definition of PERMITTED_SYMBOLS was here
ERROR:  While executing gem ... (Gem::InstallError)
    invalid gem: package is corrupt, exception while verifying: wrong number of arguments (given 2, expected 1) (ArgumentError) in bundler-1.17.3.gem
  Successfully built RubyGem
  Name: bundler
  Version: 1.17.3
  File: bundler-1.17.3.gem

Solved with:

rvm reinstall 3.1.2 --force --rubygems 3.3.19

Just posting this for visibility since the default install of the latest version is broken right now in latest, and it took me a few cycles to think of looking out for a recent rubygems release or checking for an open issue here. climbs flagpole ringing bell

kingdonb avatar Aug 11 '22 12:08 kingdonb

Looks completely unrelated to me @kingdonb. Why do you think it's related?

deivid-rodriguez avatar Aug 11 '22 12:08 deivid-rodriguez

Because the subject of the bug report was about removing os packages, and this line:

Exception `LoadError' at /home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems.rb:1325 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /home/kingdon/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems.rb:1341 - cannot load such file -- rubygems/defaults/ruby

It's either the same issue, or a big coincidence that 3.3.19 works for me but 3.3.20 does not

kingdonb avatar Aug 11 '22 13:08 kingdonb

Oh, nono, it's about some stuff getting removed from the Gemfile.lock file (a Bundler specific file). In your case, it sounds that you're not even using Bundler!

deivid-rodriguez avatar Aug 11 '22 13:08 deivid-rodriguez

I just used rvm install 3.1.2 on my Linux machine four different times with different incantations of openssl, either adding or removing --with-openssl-dir=$HOME/.rvm/usr each time, since I can never tell if I need the latest openssl or if I already have it... I'm still not sure which it is that I landed on. I think it's working with the openssl that is in the base distro of Debian sid... at least for now.

There were about a zillion more different unrelated warnings and failures, I am using the unstable distro so I don't expect everything to work on the first try.

But it is definitely using bundler, or meant to be using bundler under the hood of rvm – at least I think so

kingdonb avatar Aug 11 '22 13:08 kingdonb

@deivid-rodriguez confirming that removing the tzinfo-data gem is a valid workaround

luizkowalski avatar Aug 11 '22 18:08 luizkowalski

#5832 should fix this!

deivid-rodriguez avatar Aug 11 '22 22:08 deivid-rodriguez

@deivid-rodriguez I know this is an old issue but I'm just commenting here to try and understand the behavior here and document it for others.

First up, Rails (still) ships with gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] which means this will happen to a lot of people.

The out-of-the-box Rails Gemfile.lock will contain the specific machine platform but not ruby. Is this expected?

$ cat Gemfile.lock | grep -C 1 darwin
    nio4r (2.5.9)
    nokogiri (1.14.3-arm64-darwin)
      racc (~> 1.4)
--
      sprockets (>= 3.0.0)
    sqlite3 (1.6.2-arm64-darwin)
    stimulus-rails (1.2.1)
--
PLATFORMS
  arm64-darwin-22

I'm not sure I understand the difference between having ruby, arm64-darwin-22, and/or x86_64-linux as a platform either added or removed in general here.

The current behavior (Bundler 2.4.12) results in upfront CI breakage on platforms that use Linux runners, so the follow output occurs when bundle install is invoked:

Your bundle only supports platforms ["arm64-darwin-22"] but your local platform
is x86_64-linux. Add the current platform to the lockfile with
`bundle lock --add-platform x86_64-linux` and try again.

Running bundle lock --add-platform x86_64-linux seems safe, and results in PLATFORMS looking listing both, but it also results in dupe entries for gems that have platform specific installs:

    tailwindcss-rails (2.0.21-arm64-darwin)
      railties (>= 6.0.0)
    tailwindcss-rails (2.0.21-x86_64-linux)
      railties (>= 6.0.0)
    nokogiri (1.14.3-arm64-darwin)
      racc (~> 1.4)
    nokogiri (1.14.3-x86_64-linux)
      racc (~> 1.4)

Is there a way to avoid this initial friction with Linux-based CI systems when using recent Bundler versions?

I noticed that if I remove -arm64-darwin from gem versions in Gemfile.lock and list ruby as the only entry in PLATFORMS those -arm64-darwin suffixes are listed in the output (Using tailwindcss-rails 2.0.29 (arm64-darwin)) whenever running bundle update <gem> anyway but the PLATFORMS section isn't updated to include arm64-darwin-22.

Is that normal? Or just a result of my manual tampering with the Gemfile.lock?

Replacing all platform-specific listings and suffixes also results in bundle install running fine on Linux-based CI runners, since the same correct platform-specific gem gets installed anyway despite not being listed in Gemfile.lock: image

olivierlacan avatar May 03 '23 19:05 olivierlacan

@olivierlacan Our plan (I will wrap up the work soon, it's my top priority right now), is to include both "ruby" and specific platforms by default, to not cause this kind of breakage out of the box.

deivid-rodriguez avatar May 04 '23 09:05 deivid-rodriguez

In case it helps someone else, I had the same issue where my colleague's bundle commands would add ruby to the PLATFORMS, and my bundle commands would remove it. (Odd because we have the same Mac model) I ran bundle lock --add-platform ruby and it seemed to fix the problem for now.

Thanks, David, for all your work on Bundler :heart:

jaredbeck avatar Nov 30 '23 17:11 jaredbeck