Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Undefined \ in pullBundleChunkInternal causes 500 error

オープン
#18 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
50/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
php
領域
api, backend

調査の方向性

src/lib/HgResumeApi.php を開き、261 行目付近の pullBundleChunkInternal を調べてから、そのエラーハンドリングを pushBundleChunk と比較してください。失敗した bundle 操作が async runner のエラー出力を返し、未定義の変数や空のパスによる fatal error を発生させないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
C#
スター
0
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sillsdev/hgresume のほかの issue

sillsdev/hgresume の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。