Skip to content

Core: grant user write permissions when copying user_path templates - #6386

Open
ZariTen wants to merge 1 commit into
ArchipelagoMW:mainfrom
ZariTen:fix/nix-readonly-permissions
Open

Core: grant user write permissions when copying user_path templates#6386
ZariTen wants to merge 1 commit into
ArchipelagoMW:mainfrom
ZariTen:fix/nix-readonly-permissions

Conversation

@ZariTen

@ZariTen ZariTen commented Aug 8, 2026

Copy link
Copy Markdown

What is this fixing or adding?

When Archipelago is run from a read-only install path (such as the Nix store /nix/store), Python's shutil.copytree() preserves the source folder's read-only (0555) mode via copystat().

As a result, bootstrapped user directories copied into XDG_DATA_HOME / home_path() (like ~/.local/share/Archipelago/Players, data/sprites, and data/lua) inherit read-only permissions (dr-xr-xr-x), causing PermissionError when users attempt to create, edit, or save player .yaml files.

This PR adds a helper function _make_writable() inside Utils.user_path() that applies stat.S_IWUSR (u+w) to newly copied directories and files, guaranteeing that the user retains write permissions regardless of source mount permissions.

How was this tested?

  • Tested on NixOS inside a nix-shell environment by creating a dummy read-only (0555) template directory and mocking os.access write permission checks.
  • Confirmed that Utils.user_path("Players") successfully copies the directory and applies user write permissions, resulting in standard drwxr-xr-x (0755) access.

If this makes graphical changes, please attach screenshots.

N/A

@github-actions github-actions Bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant