Undefined \ in pullBundleChunkInternal causes 500 error
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 50/100
Línea de trabajo
Abre src/lib/HgResumeApi.php e inspecciona pullBundleChunkInternal alrededor de la línea 261; después, compara su manejo de errores con pushBundleChunk. Confirma que una operación de bundle fallida devuelve la salida de error del runner asíncrono sin provocar un error fatal por una variable no definida o una ruta vacía.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug
In src/lib/HgResumeApi.php (line 261 on dockerize branch), $bundleTimeFile is undefined:
if (BundleHelper::bundleOutputHasErrors($asyncRunner->getOutput())) {
$response = new HgResumeResponse(HgResumeResponse::FAIL);
$response->Values = array('Error' => substr(file_get_contents($bundleTimeFile), 0, 1000));
return $response;
}
This causes a PHP fatal error when Mercurial bundle creation fails:
PHP Warning: Undefined variable $bundleTimeFile
PHP Fatal error: Uncaught ValueError: Path cannot be empty in file_get_contents()
Why this is rarely seen
This code path only executes when:
- A
pullBundleChunkrequest is made - The async Mercurial bundle creation fails with errors
- The server attempts to report the error back to the client
Normal successful operations never hit this path—it only triggers when something is already wrong (e.g., repository corruption).
Root cause
The variable was defined in API v1 as $bundleTimeFile = $bundle->getBundleTimeFileName(), but was removed during refactoring without updating this error-handling code.
Fix
Replace file_get_contents($bundleTimeFile) with $asyncRunner->getOutput():
$response->Values = array('Error' => substr($asyncRunner->getOutput(), 0, 1000));
This matches the pattern used elsewhere in the codebase (e.g., pushBundleChunk).
Discovery context
Encountered while debugging a repository with corruption at changeset 257. The 500 error masked the underlying issue (missing revlog data), making troubleshooting harder.
Troubleshooting the underlying repository corruption
When you see this error, the real problem is usually a corrupted repository. Here's how we fixed it:
- Diagnose with
hg verify:
hg -R /path/to/repo verify
Output showed:
257: empty or missing SomeFile.xml
SomeFile.xml@257: manifest refers to unknown revision 86f99f857d84
...
6 integrity errors encountered!
(first damaged changeset appears to be 257)
- Back up the repository before making changes:
cp -a /path/to/repo /path/to/repo-backup
- Strip the corrupted changesets:
hg -R /path/to/repo --config extensions.strip= strip -r 257 --no-backup
(We used --no-backup since we'd already made our own backup.)
- Have the client re-push their changes from their local (healthy) copy.
- Lenguaje dominante
- C#
- Estrellas
- 0
- Forks
- 1
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin 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 sillsdev/hgresume
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
-
Dificultad 3/5 Medio día Aptitud para principiantes 72/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de sillsdev/hgresume
Issues similares
-
امکان انتخاب متن پیام هرزنامهAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
MahdiyarGHD/GheychiApp#39 ·
Los mantenedores suelen responder en 1 día
-
bug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
nightscout/nocturne#3136 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Исправить опечатки в протоколеAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
GameShowLDA/AskMkiM#1075 ·
Los mantenedores suelen responder en 1 día