Checksum mismatch for registries served with `Content-Encoding: gzip` (e.g. GitHub Pages)
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- rust
- Área
- build-system
Línea de trabajo
Empieza reproduciendo el fallo en el repositorio autocontenido enlazado con cargo run y bazel run :main, y compara después las sumas de comprobación con y sin Accept-Encoding: gzip. Sigue la ruta de descarga del crate rules_rust y determina si el arreglo debe hacerse en el downloader o en las cabeceras de la solicitud; la tarea estará terminada cuando el crate del registro se descargue con la suma de comprobación de Cargo.lock y la reproducción compile correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
We use a custom registry at Proton and found that we get a checksum mismatch when crate_universe fetches .crate files from it. The registry is hosted on GitHub Pages, which applies Content-Encoding: gzip based on the client's Accept-Encoding header.
I was able to reproduce this in a self-contained repository, please see https://github.com/mgeisler/gh-pages-registry-demo.
Environment
| Bazel | 9.1.0 |
| rules_rust | 0.70.0 |
| OS | macOS 26 (arm64) |
Repository structure
| Path | Purpose |
|---|---|
greet/ |
Library crate published to the registry |
hello/ |
Binary crate that depends on greet via the registry |
The registry is live at https://mgeisler.github.io/gh-pages-registry-demo/.
Reproducing the bug
Building with Cargo works:
cd hello && cargo run
Building with Bazel fails (Cargo.lock is already committed, no repinning needed):
cd hello && bazel run :main
Bazel output:
WARNING: Download from https://mgeisler.github.io/gh-pages-registry-demo/crates/greet-0.1.0.crate failed:
class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException
Checksum was dd22f693a0dc4bcd8d59c30b12ffe47ee355586964f211ba0878892ba46dfd3a
but wanted 93afd84f9dc5cd2b9dacc42f1dec536595ed068214a844c4e0a8a7032a7397f0
ERROR: An error occurred during the fetch of repository 'rules_rust++crate+crates__greet-0.1.0':
Error in download_and_extract: java.io.IOException: Error downloading
[https://mgeisler.github.io/gh-pages-registry-demo/crates/greet-0.1.0.crate]:
Checksum was dd22f693a0dc4bcd8d59c30b12ffe47ee355586964f211ba0878892ba46dfd3a
but wanted 93afd84f9dc5cd2b9dacc42f1dec536595ed068214a844c4e0a8a7032a7397f0
ERROR: Build did NOT complete successfully
Verifying the root cause with Curl
Without Accept-Encoding — what Cargo does; digest matches Cargo.lock:
curl -L "https://mgeisler.github.io/gh-pages-registry-demo/crates/greet-0.1.0.crate" \
| sha256sum
# → 93afd84f9dc5cd2b9dacc42f1dec536595ed068214a844c4e0a8a7032a7397f0 ✓
With Accept-Encoding: gzip — what Bazel's HTTP client sends:
curl -L -H "Accept-Encoding: gzip" \
"https://mgeisler.github.io/gh-pages-registry-demo/crates/greet-0.1.0.crate" \
| sha256sum
# → dd22f693a0dc4bcd8d59c30b12ffe47ee355586964f211ba0878892ba46dfd3a ✗
The response headers confirm that Fastly re-compresses the already-gzipped .crate:
content-type: application/octet-stream
content-encoding: gzip
vary: Accept-Encoding
We can verify this by hand:
curl -L -H "Accept-Encoding: gzip" \
"https://mgeisler.github.io/gh-pages-registry-demo/crates/greet-0.1.0.crate" \
| gunzip | sha256sum
# → 93afd84f9dc5cd2b9dacc42f1dec536595ed068214a844c4e0a8a7032a7397f0 ✓
Bazel hashes the gzip-encoded wire bytes: the .crate (already a .tar.gz) is gzipped a second time by Fastly, and Bazel checksums that doubly-compressed payload without decompressing it first.
Root cause
Bazel's downloader does not strip Content-Encoding: gzip before computing the SHA-256 checksum, contrary to how every other HTTP client behaves. The issue affects any Cargo registry whose CDN honours Accept-Encoding: gzip on binary responses — GitHub Pages (fronted by Fastly) is a reliable example.
Possible fixes
Suggested by my AI, I would of course love to hear other ideas:
- Bazel-side (preferred): compute SHA-256 after decompressing
Content-Encoding: gzip, consistent with other HTTP client libraries. - rules_rust: do not emit
Accept-Encoding: gzipwhen issuing crate download requests (e.g. via a--headerdownloader flag). - rules_rust: expose a per-URL or per-registry option to suppress specific request headers in the generated
http_archivecalls.
- Lenguaje dominante
- Starlark
- Estrellas
- 857
- Forks
- 701
- Merge medio
- 4 d 7 h
- PR fusionados (30 d)
- 46
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 bazelbuild/rules_rust
-
`rust_test(crate = ...)` does not stage the crate's transitive dynamic libraries into runfilesPosiblemente ocupada @Wito-1 la tomó hace 66 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
bazelbuild/rules_rust#4309 ·
Los mantenedores suelen responder en 3 días
-
Windows (no-symlink path): drain_runfiles_dir_windows deletes retained runfiles — inverted filename_suffixes_to_retain conditionPosiblemente ocupada @Mattbusel la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
bazelbuild/rules_rust#4266 ·
Los mantenedores suelen responder en 3 días
-
rust.toolchain(strip_level = ...) is silently ignoredPosiblemente ocupada @Mattbusel la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
bazelbuild/rules_rust#4223 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
bazelbuild/rules_rust#4152 · 1 reacción ·
Los mantenedores suelen responder en 3 días
-
awaiting-response
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
bazelbuild/rules_rust#3599 · 1 comentario ·
Los mantenedores suelen responder en 3 días
Todos los issues de bazelbuild/rules_rust
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
bazelbuild/apple_support#707 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
blocky: new version 0.38.0Abiertoout-of-date
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
CachyOS/CachyOS-PKGBUILDS#2232 ·
Los mantenedores suelen responder en 1 día
-
blast/large refactor risk/low spend-dem
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
chriskelly/MusicWall#87 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
neilotoole/sq#1503 ·
Los mantenedores suelen responder en 1 día