Skip to content

fix(builder): copies from a read-only install stay writable - #1104

Merged
hckrman101 merged 2 commits into
NotRexed:mainfrom
t0masz407:fix/builder-readonly-source
Nov 9, 2026
Merged

hckrman101 merged 2 commits into
NotRexed:mainfrom
t0masz407:fix/builder-readonly-source

Conversation

@t0masz407

Copy link
Copy Markdown
Contributor

Supersedes #680, which was closed for a conflict with main: rebased onto current main, plus the window icon (below).

What

make_game.py copied hot_funcs.txt, hot_order.txt, hookshot_pieces.prof, hookshot.res and work/image/chunks.txt from the tools folder with shutil.copy2, which takes the source's mode along. A new copy_writable() copies the bytes only (also used for the window icon hookshot.png, which copy2 copied into the game folder the same way), and first makes an existing read-only copy writable again (so a work folder broken by an earlier build recovers by itself).

Why

From a read-only install the copies in the work folder were read-only too, and lift.py then stopped with

PermissionError: [Errno 13] Permission denied: '/home/<user>/.cache/hookshot-builder/image/chunks.txt'

on that build and every later one. The second build of a game folder stopped the same way on its read-only hookshot.png:

PermissionError: [Errno 13] Permission denied: '/home/<user>/Games/Hookshot/hookshot.png'

This happens with the Linux AppImage unpacked into the Nix store on NixOS (everything there is r--r--r--), and would with any packaged read-only tools folder (a distro package, a Flatpak). The filecmp check before the copy compares contents, so copy2's timestamps were never needed.

Tested

NixOS, the v2.0.1 / honest-eta AppImage's tools in the Nix store: the build that stopped at lift.py before now completes, and the game runs. On v2.0.7 a rebuild of an existing game folder stopped at hookshot.png and completes with the change. tests/test_copy_writable.py copies a read-only source over a read-only leftover and appends to the result as lift.py does (fails on main, passes here); tests/run_all.py picks it up; it also checks that the icon is no longer copied with copy2. tests/test_make_game_cache.py still passes.

🤖 Generated with Claude Code

t0masz407 and others added 2 commits November 9, 2026 10:09
make_game copied hot_funcs.txt, hot_order.txt, the profile, hookshot.res and work/image/chunks.txt from the tools
folder with shutil.copy2, which takes the source's mode along. From a read-only install (the Linux AppImage
unpacked into a Nix store on NixOS, or any packaged read-only tools folder) the copies were read-only, and lift.py
then stopped with "PermissionError: ... image/chunks.txt"; every later build failed on the same file.

copy_writable copies the bytes only and makes an existing read-only copy writable first. Tested on NixOS with the
AppImage's tools in the Nix store: the build that failed before completes. tests/test_copy_writable.py checks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013mj4MgED5gai2jdByd6ztp
A second build of the same game folder stopped with PermissionError on hookshot.png:
copy2 had made it read-only from a read-only install, and copy2 cannot overwrite it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hckrman101
hckrman101 merged commit 7499c59 into NotRexed:main Nov 9, 2026
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