Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Undefined \ in pullBundleChunkInternal causes 500 error

Abierto
#18 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
50/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
php
Área
api, backend

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:

  1. A pullBundleChunk request is made
  2. The async Mercurial bundle creation fails with errors
  3. 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:

  1. 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)
  1. Back up the repository before making changes:
cp -a /path/to/repo /path/to/repo-backup
  1. 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.)

  1. 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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sillsdev/hgresume

Todos los issues de sillsdev/hgresume

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.