App: user files must survive a failed read (usage.json, tags.json, studio.json, wrong-typed sections, locked files)

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
json, python

調査の方向性

Start with the load() paths in zorbit/usage.py, zorbit/tags.py, and zorbit/config.py, then review zorbit/studio.py, zorbit/fsutil.py, and zorbit/paths.py alongside the audit IDs. Run the existing tests for these modules and add focused coverage for failed, malformed, and locked-file cases. Done means valid state is preserved or defaults are reported when reads fail, unsafe asset names are rejected, failed writes are retried, and configuration errors produce a readable application message.

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

説明

bug

From the audit of ZOrbit 0.11.0 (31 October 2026).

What is wrong

  • zorbit/usage.py load() sets self.mtime and empties brushes, menus and picks before it opens the file. If the read fails (a scanner or sync client holding the file, or a hand-edit typo) the except clause passes, the object believes it has loaded that mtime, and the next pick saves the empty state over the file. One bad entry inside the brushes loop also drops every later brush, all auto-slot state and the whole Recent list, because they are read after it in one try block.
  • zorbit/tags.py load() keeps "the previous state" when the file cannot be parsed. On the first load of a process there is no previous state, so a stray comma in tags.json leaves no tags at all, Favourites included. Every tag and browser slot is then reported as "tag X does not exist", which points the user away from the real cause.
  • zorbit/config.py: bridge = raw.get("bridge") or {} and ring = raw.get("ring") or {} assume dicts. "bridge": "F9" or "ring": "big" raises AttributeError, the whole file is dropped, the app logs 'str' object has no attribute 'items' and Studio shows one problem with no location. A menu's fan is not validated, so "fan": "false" is true. Misspelt names inside ring.colors, bridge, browser and item fields are ignored without the "did you mean" that the 0.11.0 ring and menu keys got.
  • zorbit/config.py: brush, alpha, material and texture names and icon values are not checked as names. assets._resolve, brushes.thumbnail and radiald.icon_for call is_file() on them, so a menus file with \\host\share\a.png makes Windows connect to that server and send an NTLM hash (while Studio previews the ring, or on the first pick). The COPYDATA path in radiald.py already rejects such names.
  • zorbit/studio.py _read_studio_file returns {} for a missing and for an unreadable file. set_pref (on every screen change), add_zbrush_folder and the window-placement writer then write that empty dict back, dropping the other keys.
  • zorbit/fsutil.py write_atomic: os.replace fails at once with PermissionError when another process holds the destination open (antivirus, OneDrive, the app reading the file it watches). Studio shows "radial.json could not be written: Access is denied".
  • zorbit/paths.py ensure_config runs outside the fatal handler in radiald.main; an unwritable %APPDATA% ends the app with a traceback in app_stderr.log and nothing else.

Fix

  • usage.load: build the new state in locals and assign on success; on OSError keep the previous state and mtime so the next load retries; on a parse error copy the file to usage.json.bad before any save; per-entry try.
  • tags.load: on a parse error with empty _tags, install the starter tags in memory and keep .error so writes stay refused; config.py and the problems list say "tags.json could not be read" when tags.error is set.
  • config.load: isinstance(dict) checks for the top level, bridge, ring, browser and menus with a plain problem text and defaults; fan must be a bool; suggestions for the other key levels; reject names and icons containing \, /, : or .. or starting with \\ or //, listed as problems.
  • studio.py: distinguish missing from unreadable and skip the write when the read failed.
  • write_atomic: retry os.replace four or five times with a short pause on PermissionError or winerror 5 and 32.
  • ensure_config inside the fatal handler, with a readable message.

Audit ids: F122, F042, F047, F048, F231, F232, F028, F032, F013, F307, F373, F371, F372, F123, F366.

主要言語
Python
スター
2
フォーク
1
平均マージ
3分
マージ済み PR(30日)
2

環境構築

はじめの一歩

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

combwizard/ZOrbit のほかの issue

combwizard/ZOrbit の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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