`bundle lock --add-checksums` writes blank `CHECKSUMS` entries on the first run when a source's gems are only in optional or excluded groups
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- build-system
Línea de trabajo
Start with Definition#add_checksums, LockfileGenerator#add_checksums, and the specs.each materialization path described in the report. Trace how optional and excluded groups affect checksum fetching and fallback calculation, then compare that with the specs written from definition.resolve. Done means the first bundle lock --add-checksums run writes populated checksums for every locked gem, including the reported optional and excluded group cases.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the problem as clearly as you can
When migrating an existing Gemfile.lock without a CHECKSUMS section via bundle lock --add-checksums, Bundler writes blank checksum lines (for example rack (3.1.12)) for any gem source whose gems are all in an unrequested optional: true group or a BUNDLE_WITHOUT-excluded group (such as a scoped source inside an optional group, or a zero-runtime-dependency gemspec project with BUNDLE_WITHOUT=development). A subsequent BUNDLE_FROZEN=true install that includes the group fails with exit code 16 (Your lockfile has an empty CHECKSUMS entry). Running bundle lock --add-checksums a second time populates the sha256=... digest.
When no re-resolution is needed, Definition#add_checksums calls specs.each (materialize(requested_dependencies)), which skips unrequested optional: true and without groups (both for triggering Source::Rubygems compact-index fetches and for computing fallback checksums from installed .gem packages on disk), whereas LockfileGenerator#add_checksums emits CHECKSUMS entries for every spec in definition.resolve. On the second run, check_lockfile sees the blank entry in CHECKSUMS, sets @locked_spec_with_empty_checksums, and forces a remote re-resolution.
Did you try upgrading rubygems & bundler?
Yes. Reproduced on RubyGems / Bundler 4.1.0 (Ruby 4.0.9) and on ruby/rubygems master (5879ffe34b, 4.2.0.dev).
Post steps to reproduce the problem
mkdir /tmp/repro-opt-checksum && cd /tmp/repro-opt-checksum
cat > Gemfile << 'EOF'
source "https://rubygems.org"
group :opt, optional: true do
gem "rack", "3.1.12"
end
EOF
BUNDLE_LOCKFILE_CHECKSUMS=false bundle lock
bundle lock --add-checksums
cat Gemfile.lock
BUNDLE_FROZEN=true BUNDLE_WITH=opt BUNDLE_PATH=vendor/bundle bundle install
bundle lock --add-checksums
cat Gemfile.lock
Which command did you run?
bundle lock --add-checksums
What were you expecting to happen?
The first bundle lock --add-checksums run should populate sha256=... checksums for all locked gems in Gemfile.lock (https://bundler.io/man/bundle-lock.1.html), matching the second run, so BUNDLE_FROZEN=true BUNDLE_WITH=opt bundle install succeeds.
What happened instead?
$ BUNDLE_LOCKFILE_CHECKSUMS=false bundle lock
Writing lockfile to /tmp/repro-opt-checksum/Gemfile.lock
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
$ bundle lock --add-checksums
Writing lockfile to /tmp/repro-opt-checksum/Gemfile.lock
$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
rack (3.1.12)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
rack (= 3.1.12)
CHECKSUMS
rack (3.1.12)
BUNDLED WITH
4.1.0
$ BUNDLE_FROZEN=true BUNDLE_WITH=opt BUNDLE_PATH=vendor/bundle bundle install
Your lockfile has an empty CHECKSUMS entry for "rack", but can't be updated
because frozen mode is set
Run `bundle install` elsewhere and add the updated Gemfile.lock to version
control.
$ bundle lock --add-checksums
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Writing lockfile to /tmp/repro-opt-checksum/Gemfile.lock
$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
rack (3.1.12)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
rack (= 3.1.12)
CHECKSUMS
rack (3.1.12) sha256=00d83055c89273eb13679ab562767b8826955aa6c4371d7d161deb975c50c540
BUNDLED WITH
4.1.0
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 /tmp/repro-opt-home/.local/share/gem/ruby/4.0.0:/opt/ruby-4.0.9/lib/ruby/gems/4.0.0
User Home /tmp/repro-opt-home
User Path /tmp/repro-opt-home/.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 "https://rubygems.org"
group :opt, optional: true do
gem "rack", "3.1.12"
end
```
### Gemfile.lock
```
GEM
remote: https://rubygems.org/
specs:
rack (3.1.12)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
rack (= 3.1.12)
CHECKSUMS
rack (3.1.12)
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
-
needs verification
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 13 días
-
🐛 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 76/100
-
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 ·