#8180 is still reproducible without --prefer-local on Bundler 4.0.18
I maintainer di solito rispondono entro 1 giorno
@IslamElsayed ci sta già lavorando.
Dal 20/9/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Inizia con il Gemfile minimale contenente io-console 0.8.2, quindi confronta bundle install --verbose con bundle install --verbose --prefer-local sulle versioni di Ruby e Bundler indicate. Traccia il modo in cui Bundler sceglie un default gem installato durante l’installazione; il lavoro è completato quando l’installazione normale riutilizza esattamente il default gem senza scaricarlo, compilarlo o creare una copia ordinaria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the problem
Bundler installs a regular copy of a gem even when the exact same version is already available as a Ruby default gem.
This appears to be the same underlying behavior reported in #8180. That issue was closed by #8412, but #8412 specifically fixes the behavior when --prefer-local is used. With a normal bundle install, the behavior is still reproducible with Bundler 4.0.18.
In my case this was initially exposed by Ruby LSP, whose generated lockfile referenced io-console 0.8.2. Ruby 4.0.6 already ships io-console 0.8.2 as a default gem, but Bundler downloaded, built, and installed an additional regular copy of io-console 0.8.2.
The issue is reproducible without Ruby LSP.
Environment
> ruby -v
ruby 4.0.6 (2026-07-14 revision 03b6d3f889) +PRISM [x64-mingw-ucrt]
> gem -v
4.0.18
Before the test, io-console 0.8.2 is present only as a default gem:
io-console-0.8.2 | DEFAULT | c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/io-console-0.8.2.gemspec
Minimal reproduction
Create a new directory with this Gemfile:
source "https://rubygems.org"
gem "io-console", "0.8.2"
Generate the lockfile:
bundle lock
Then run:
bundle install --verbose
Observed output:
Running `bundle install --verbose` with bundler 4.0.18
Found no changes, using resolution from the lockfile
Using bundler 4.0.18
0: bundler (4.0.18) from c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/bundler-4.0.18.gemspec
HTTP GET https://index.rubygems.org/versions
HTTP 304 Not Modified https://index.rubygems.org/versions
Fetching gem metadata from https://rubygems.org/
Looking up gems ["io-console"]
Fetching io-console 0.8.2
Downloaded io-console in: 0.086s
Installing io-console 0.8.2 with native extensions
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Installed io-console in: 18.301s
0: io-console (0.8.2) from c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/io-console-0.8.2.gemspec
Bundle complete! 1 Gemfile dependency, 1 gem now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Afterwards, both specifications exist:
io-console-0.8.2 | NORMAL | c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/io-console-0.8.2.gemspec
io-console-0.8.2 | DEFAULT | c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/io-console-0.8.2.gemspec
So Bundler downloads, compiles, and installs a regular copy of the exact version that is already available as a default gem.
Interestingly, the verbose output then reports the default-gem specification as the one being used:
0: io-console (0.8.2) from c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/io-console-0.8.2.gemspec
--prefer-local behaves as expected
After removing the redundant regular copy and restoring the initial state, running:
bundle install --verbose --prefer-local
does not reinstall the gem:
Running `bundle install --prefer-local --verbose` with bundler 4.0.18
Found no changes, using resolution from the lockfile
Using bundler 4.0.18
0: bundler (4.0.18) from c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/bundler-4.0.18.gemspec
Using io-console 0.8.2
0: io-console (0.8.2) from c:/ruby-4.0.6-x64/lib/ruby/gems/4.0.0/specifications/default/io-console-0.8.2.gemspec
Bundle complete! 1 Gemfile dependency, 1 gem now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Expected behavior
For a normal bundle install, if the exact required name and version are already available as a default gem, I would expect Bundler to use that default gem rather than download and install an identical regular copy.
This matters in particular for default gems with native extensions: in this example the unnecessary installation recompiles io-console.
Related issues
- #8180 reported that
bundle installinstalls default gems again even when the required versions are already provided by Ruby. - #8412 closed #8180 by making default gems preferred when
--prefer-localis used.
Since the original #8180 reproducer did not use --prefer-local, is the current behavior of plain bundle install intentional? If not, #8180 appears to remain reproducible in Bundler 4.0.18.
- Lingua principale
- Ruby
- Stelle
- 4k
- Fork
- 2k
- Merge medio
- 1g 17h
- PR unite (30g)
- 50
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ruby/rubygems
-
Bundler 4.0.x fails on Ruby 4.1 when .bundle/config is "---"Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Cooldown drops the locked version of a gem named in bundle lock --update or bundle updateForse già presa @senid231 l’ha presa 4 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Profiling `require "bundler/setup"` in a 450-gem app: 13 findings, a series of small PRsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
Gem::Package::TarReader silently ignores pax/GNU extension headersForse già presa @akasakariko l’ha presa 8 giorni fa. ApertaRubyGems
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
ruby/rubygems#9988 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`Gem::Version.new`, `#bump`, and `#release` do not work in ractorForse già presa @mmporong l’ha presa 11 giorni fa. ApertaRubyGems
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ruby/rubygems
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openhab/openhab-jruby#571 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rubys/roundhouse#1917 ·
-
Store credit application selects a payment method from another storeForse già presa @beobungbu l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
area:data coverage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
reacher-z/Awesome-CUA#4948 ·
I maintainer di solito rispondono entro 19 giorni
-
test_rescues_connection_reset_on_issue_comments_lookup fails on master and blocks every pull requestAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
zerocracy/judges-action#3142 ·
I maintainer di solito rispondono entro 2 giorni