Bundler 4.0.x fails on Ruby 4.1 when .bundle/config is "---"
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
失敗箇所は Bundler::Settings#load_config の bundler-4.0.23/lib/bundler/settings.rb:485 です。このメソッドを読み、コミット 368fc29ce1 で追加された処理と比較してください。提供された .bundle/config の内容と bundle _4.0.23_ config list を使い、Ruby 4.1 で再現してください。コマンドが空の YAML 設定を例外を発生させずに読み込み、そのケースがテストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the problem as clearly as you can
On Ruby 4.1.0dev (RubyGems 4.1.0.beta3), every Bundler 4.0.x command fails when .bundle/config contains only ---:
bundler-4.0.23/lib/bundler/settings.rb:485:in 'block in Bundler::Settings#load_config': undefined method 'inject' for nil (NoMethodError)
Bundler writes this file itself. bundle config unset on the last local key leaves ---\n behind, and the global config does the same. On Ruby 4.1 an app with BUNDLED WITH 4.0.x runs that Bundler, so the app stops working until someone deletes the file.
#9379 made Gem::YAMLSerializer.load("---\n") return nil (c091444047). The same PR made Bundler treat nil as {} (368fc29ce1). Bundler 4.0.x uses Gem::YAMLSerializer when RubyGems provides it, but 368fc29ce1 is not on the 4.0 branch. #9379 has no labels, so I think prepare_release would not pick it up.
Could 368fc29ce1 go into the next 4.0.x release? It cherry-picks cleanly onto 4.0 (642a23eb5), and with it Bundler reads the file on Ruby 4.0.7 and 4.1.0dev.
Did you try upgrading rubygems & bundler?
Yes. It reproduces with Bundler 4.0.20 and 4.0.23, the latest 4.0.x. Bundler 4.1.0.beta3 works.
Post steps to reproduce the problem
ruby -e 'require "rubygems/yaml_serializer"; p Gem::YAMLSerializer.load("---\n")' # 4.0.7: {} 4.1.0dev: nil
mkdir .bundle && printf -- '---\n' > .bundle/config && bundle _4.0.23_ config list
Ruby 4.1.0dev (2026-11-02T20:50:33Z HEAD b51db981f6) on Linux x86_64.
Which command did you run?
bundle _4.0.23_ config list. bundle install fails the same way.
What were you expecting to happen?
The settings list, as on Ruby 4.0.7.
What happened instead?
undefined method 'inject' for nil (NoMethodError)
- 主要言語
- Ruby
- スター
- 4k
- フォーク
- 2k
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 50
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby/rubygems のほかの issue
-
Cooldown drops the locked version of a gem named in bundle lock --update or bundle update対応中かも @senid231 が 5 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Profiling `require "bundler/setup"` in a 450-gem app: 13 findings, a series of small PRs対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
-
Gem::Package::TarReader silently ignores pax/GNU extension headers対応中かも @akasakariko が 9 日前に担当しました。 オープンRubyGems
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
ruby/rubygems#9988 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`Gem::Version.new`, `#bump`, and `#release` do not work in ractor対応中かも @mmporong が 12 日前に担当しました。 オープンRubyGems
難易度 3/5 半日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
Gem.load_plugins loads same plugin multiple times from different Gem.path entries対応中かも @sourya2704 が 14 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ruby/rubygems#9945 · コメント 4 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rubys/roundhouse#1950 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信