Skip to content

calibrated_texture: publish the DDS with the bits of a plain open(), not the staging file's 0600 - #7628

Open
best2135 wants to merge 1 commit into
ItsNotRexed:mainfrom
best2135:hunt/calibrated-texture-mode
Open

best2135 wants to merge 1 commit into
ItsNotRexed:mainfrom
best2135:hunt/calibrated-texture-mode

Conversation

@best2135

Copy link
Copy Markdown

Claimed in the coordination issue (claim).

export_file in tools/calibrated_texture.py stages the DDS in tempfile.NamedTemporaryFile (created 0600), then os.link()s it into place (or os.replace()s it under --force) without restoring the mode. So:

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

tools/file_mode.py exists for exactly this, and the other staged writers use it (#1082). This calls os.chmod(tmp, published_mode(target)) before the link or replace, as they do.

Test: two new tests in tests/test_calibrated_texture_extra.py, built by hand (no game data). They fake LocalDecoder, so they run without NumPy. A new DDS gets file_mode.new_file_mode(dir), and a --force replace of a 0640 file keeps 0640. Both fail on main and pass with this change.

Ran (Linux, Python 3.14.8, CPU only, no NumPy):

  • python -I tests/test_calibrated_texture_extra.py: 27 tests, OK
  • python -m compileall -q make_game.py tools tests: pass
  • python -I scripts/check_no_game_data.py on the changed files: pass

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

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…not 0600

export_file stages the DDS through tempfile.NamedTemporaryFile, which creates the
file 0600, then os.link()s it (or os.replace()s it under --force) into place
without restoring the mode. A new DDS came out 0600 instead of the umask's bits,
and --force reset a 0640 file to 0600. Give the staged file
file_mode.published_mode(target) 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