Skip to content

bvh_slot_check: publish output with the bits of a plain open(), not the staging file's 0600 - #7625

Open
best2135 wants to merge 1 commit into
ItsNotRexed:mainfrom
best2135:hunt/bvh-slot-check-mode
Open

best2135 wants to merge 1 commit into
ItsNotRexed:mainfrom
best2135:hunt/bvh-slot-check-mode

Conversation

@best2135

Copy link
Copy Markdown

Claimed in the coordination issue (claim).

save_evidence in tools/bvh_slot_check.py stages its output in a private temporary file (tempfile creates it 0600) and os.replace()s it into place without restoring the mode. So:

  • a new output comes out 0600 instead of what a plain open() gives under the umask (0644 under umask 022);
  • a re-run resets a file the user made 0640 (or 0644) to 0600.

tools/file_mode.py exists for exactly this and is used by the other staged writers (#1082). This calls os.chmod(tmp, published_mode(dest)) before the replace, as they do.

Test: two new tests in tests/test_bvh_slot_check.py, both built by hand (no game data): a new output gets file_mode.new_file_mode(dir), and a replaced 0640 output stays 0640. Both fail on main (384 != 420 / 384 != 416) and pass with this change.

Ran (Linux, Python 3.14.8, CPU only):

Skipped on Windows (os.name == "nt"), where the POSIX bits don't apply. Same bug class as the timecycle_pairs (#7572) and shader_disasm (#7573) PRs, but in different files, so the PRs don't overlap.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

… not 0600

save_evidence stages the JSON through tempfile.NamedTemporaryFile, which creates
the file 0600, and os.replace()s it into place without restoring the mode. New
evidence came out 0600 instead of the umask's bits, and an incremental run reset a
0640 file to 0600. Give the staged file file_mode.published_mode(path) first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant