`bundle lock` skips `required_ruby_version` and `required_rubygems_version` validation on non-compact-index sources and `--full-index`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Start by tracing CLI::Lock#run through Definition#write_lock, LockfileGenerator.generate, and definition.resolve, then compare that path with Definition#specs and its materialization retry. Reproduce with the supplied file repository and bundle lock; verify the lockfile selects aa 1.0.0 when metadata requires Ruby >= 3.0 and excludes aa 2.0.0 requiring Ruby >= 99.0. Check that RubyGems version requirements are validated along the same path.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the problem as clearly as you can
When locking dependencies from a source that does not use the compact index (bundle lock --full-index against any server, or plain bundle lock against a file:// repository, a static gem generate_index / specs.4.8.gz HTTP server, or a private /api/v1/dependencies server that omits Ruby/RubyGems metadata), bundle lock resolves and writes gem versions whose required_ruby_version or required_rubygems_version is incompatible with the current Ruby / RubyGems and with an explicit ruby declaration in Gemfile.
For RemoteSpecification and metadata-less EndpointSpecification, @required_ruby_version and @required_rubygems_version are nil during initial resolution and are checked lazily via FetchMetadata (downloading quick/Marshal.4.8/<gem>.gemspec.rz) when Definition#specs calls Definition#materialize, which retries resolution via reresolve_without(incomplete_specs) (introduced in #5826). bundle install runs Definition#specs and resolves the compatible version (aa 1.0.0), whereas bundle lock (CLI::Lock#run -> Definition#write_lock -> LockfileGenerator.generate -> definition.resolve) serializes definition.resolve directly without materializing specs (unless --add-checksums is passed), leaving incompatible versions in Gemfile.lock.
Did you try upgrading rubygems & bundler?
Yes. Reproduced on RubyGems / Bundler 4.1.0 (Ruby 4.0.9) and on ruby/rubygems master (5879ffe, 4.2.0.dev).
Post steps to reproduce the problem
mkdir repro-lock-metadata && cd repro-lock-metadata
mkdir -p repo/gems repo/quick/Marshal.4.8 app
ruby - << 'RUBY'
require "rubygems/package"
require "zlib"
specs = [["1.0.0", ">= 3.0"], ["2.0.0", ">= 99.0"]].map do |v, ruby_req|
Gem::Specification.new do |s|
s.name = "aa"
s.version = v
s.summary = "aa #{v}"
s.authors = ["test"]
s.required_ruby_version = ruby_req
end
end
specs.each do |s|
gem_file = Gem::Package.build(s, true)
File.rename(gem_file, "repo/gems/" + gem_file)
File.binwrite("repo/quick/Marshal.4.8/" + s.original_name + ".gemspec.rz",
Zlib::Deflate.deflate(Marshal.dump(s)))
end
File.binwrite("repo/specs.4.8.gz",
Zlib.gzip(Marshal.dump(specs.map { |s| [s.name, s.version, "ruby"] })))
File.binwrite("repo/prerelease_specs.4.8.gz", Zlib.gzip(Marshal.dump([])))
RUBY
cat > app/Gemfile <<GEMFILE
source "file://$PWD/repo"
ruby "$(ruby -e 'print RUBY_VERSION')"
gem "aa"
GEMFILE
cd app
bundle lock
cat Gemfile.lock
# Unfrozen install against the same source immediately downgrades to 1.0.0:
BUNDLE_PATH=vendor/bundle bundle install
# On a lockfile without CHECKSUMS (or pre-existing lockfile), frozen install fails on the Ruby mismatch:
rm -rf Gemfile.lock vendor .bundle
BUNDLE_LOCKFILE_CHECKSUMS=false bundle lock
BUNDLE_FROZEN=true BUNDLE_PATH=vendor/bundle bundle install
(The same happens over HTTP with bundle lock --full-index even when compact index /versions and /info/aa are present.)
Which command did you run?
bundle lock (and bundle lock --full-index)
What were you expecting to happen?
bundle lock should validate required_ruby_version and required_rubygems_version for the resolved specs and lock aa (1.0.0), matching bundle install and compact-index bundle lock (https://bundler.io/man/bundle-lock.1.html).
What happened instead?
bundle lock writes aa (2.0.0) into Gemfile.lock despite aa-2.0.0 requiring ruby >= 99.0 and Gemfile declaring ruby "4.0.9":
$ bundle lock
Writing lockfile to /tmp/repro-lock-metadata/app/Gemfile.lock
Fetching source index from file:///tmp/repro-lock-metadata/repo/
Resolving dependencies...
$ cat Gemfile.lock
GEM
remote: file:///tmp/repro-lock-metadata/repo/
specs:
aa (2.0.0)
PLATFORMS
x86_64-linux
DEPENDENCIES
aa
CHECKSUMS
aa (2.0.0)
RUBY VERSION
ruby 4.0.9
BUNDLED WITH
4.1.0
$ BUNDLE_PATH=vendor/bundle bundle install
Fetching source index from file:///tmp/repro-lock-metadata/repo/
Resolving dependencies...
Fetching aa 1.0.0 (was 2.0.0)
Installing aa 1.0.0 (was 2.0.0)
Bundle complete! 1 Gemfile dependency, 1 gem now installed.
Bundled gems are installed into `./vendor/bundle`
$ rm -rf Gemfile.lock vendor .bundle
$ BUNDLE_LOCKFILE_CHECKSUMS=false bundle lock
Writing lockfile to /tmp/repro-lock-metadata/app/Gemfile.lock
Fetching source index from file:///tmp/repro-lock-metadata/repo/
Resolving dependencies...
$ BUNDLE_FROZEN=true BUNDLE_PATH=vendor/bundle bundle install
Fetching source index from file:///tmp/repro-lock-metadata/repo/
aa-2.0.0 requires ruby version >= 99.0, which is incompatible with the current
version, 4.0.9
If not included with the output of your command, run bundle env and paste the output below
## Environment
```
Bundler 4.1.0
Platforms ruby, x86_64-linux
Ruby 4.0.9p0 (2026-10-23 revision 3e93b23afcec3433f6aecc34b5d832799d754238) [x86_64-linux]
Full Path /opt/ruby-4.0.9/bin/ruby
Config Dir /opt/ruby-4.0.9/etc
RubyGems 4.1.0
Gem Home /opt/ruby-4.0.9/lib/ruby/gems/4.0.0
Gem Path /opt/ruby-4.0.9/lib/ruby/gems/4.0.0
User Home /home/user
User Path /home/user/.local/share/gem/ruby/4.0.0
Bin Dir /opt/ruby-4.0.9/bin
Git 2.39.5
```
## Bundler Build Metadata
```
Timestamp 2026-11-16
Git SHA 9af9267
```
## Gemfile
### Gemfile
```ruby
source "file:///tmp/repro-lock-metadata/repo"
ruby "4.0.9"
gem "aa"
```
### Gemfile.lock
```
GEM
remote: file:///tmp/repro-lock-metadata/repo/
specs:
aa (2.0.0)
PLATFORMS
x86_64-linux
DEPENDENCIES
aa
RUBY VERSION
ruby 4.0.9
BUNDLED WITH
4.1.0
```
Credit: https://ucsbplse.github.io/
- Lenguaje dominante
- Ruby
- Estrellas
- 4k
- Forks
- 2k
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 75
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ruby/rubygems
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
Los mantenedores suelen responder en 1 día
Todos los issues de ruby/rubygems
Issues similares
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
betagouv/conseillers-entreprises#4808 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
yosiat/panko_serializer#250 ·
-
[Server Submission]: Aspera CLIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
cline/mcp-marketplace#3886 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100