A failed rollback leaves a mix of old and new files

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, python
領域
desktop-dev

調査の方向性

Start in Rollback in clean/installer/src/wg_core/launcher.cpp, around lines 615-654, where files are copied into .swap, overwritten one at a time by CopyChecked, and the record is saved last. Check how RunOp turns the exception into an error result, and how the retry path clears .swap with RemoveTree near line 629. The new test is the one in tests/run_launcher_tests.py, which needs a file held open with FILE_SHARE_READ only. Done means a failed rollback restores the first live file's current bytes and leaves .swap in place when the undo itself fails.

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

説明

area: launcher bug

This was found by reading the code. It has not been reproduced.

What happens

Rollback (clean/installer/src/wg_core/launcher.cpp:615) copies the current files into .swap. It then overwrites the live files one at a time with CopyChecked (launcher.cpp:636-643). There is no catch and no undo. The record is saved only at the end (launcher.cpp:654). RunOp turns an exception into an error result. A retry runs RemoveTree(swap) first (launcher.cpp:629) and rebuilds .swap from the now-mixed live files.

If the loop fails halfway, the live files are a mix of two versions. The folder the player would use to roll back again (the new previous\, built from .swap) is mixed too.

No player file is lost. previous\ is untouched and verified, so a retry finishes the rollback. The record's hashes no longer match the live files, so the verify step suggests a repair (launcher.cpp:930). Repair or Update recovers.

When it can happen

Unusual but innocent. The game running is already blocked (launcher.cpp:618). What remains is another program holding a payload DLL without write sharing, a full disk, or a crash during the copy loop. Until the player retries or repairs, the game may fail to start or crash with mixed DLLs. Low severity.

To do

  • Wrap the copy loop in try/catch. On failure, copy back the files already replaced from .swap (the hashes are in its previous.txt) before rethrowing.
  • Do not delete .swap on a later run while the record's version still differs from what .swap\previous.txt names.
  • Caution: the undo can fail on the same lock. It should then leave .swap in place and say so.

Test

CPU-only. Fake install with previous\ holding two payload files whose bytes differ. Hold the second live file open with FILE_SHARE_READ only. Run Rollback. Assert it fails and the first live file has its current bytes again. The existing test (tests/run_launcher_tests.py:371-401) uses identical payloads, so it cannot catch this.

主要言語
C++
スター
12
フォーク
2
平均マージ
3時間 10分
マージ済み PR(30日)
171

環境構築

はじめの一歩

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

phantoslayer21/wronggpu のほかの issue

phantoslayer21/wronggpu の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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