Undefined \ in pullBundleChunkInternal causes 500 error
まだ誰も着手していません。
評価
調査の方向性
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:
- 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.
- 主要言語
- C#
- スター
- 0
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sillsdev/hgresume のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 3/5 半日 初心者へのやさしさ 45/100
-
難易度 3/5 半日 初心者へのやさしさ 72/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
sillsdev/hgresume の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
sebastienros/jint#4282 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
pyrevitlabs/pyRevit#3792 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
fboucher/2d6-dungeon-app#256 ·
メンテナーはふだん 1 日以内に返信
-
area: design documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
eyalgolan/statecraft-israel#883 ·
メンテナーはふだん 1 日以内に返信