spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

fix: ensure installed files are owner-writable regardless of source permissions

Open rayhem opened this issue 5 months ago • 1 comments

Description

shutil.copy2 and shutil.copytree (which uses copy2 by default) propagate permission bits from source to destination. When the source lives on a read-only filesystem — the Nix store, any read-only mount, or a permission-restricted directory — installed files land at 0o444 and directories at 0o555. Any subsequent write to .specify/ (re-running specify init, upgrading, editing installed config) then fails with PermissionError.

An install operation should produce owner-writable destinations. The installed file's mtime should also reflect when it was installed, not when the bundled asset was built — so the copy2 → copyfile change is correct on both counts.

I encountered this problem attempting to package spec-kit on NixOS. The repository gets added read-only to the Nix store. specify assumes it can write to the files it creates, but the copy utilities preserve the read-only permissions resulting in an error.

Testing

  • [x] Tested locally with uv run specify --help
  • [ ] Ran existing tests with uv sync && uv run pytest
  • [x] Tested with a sample project (if applicable)

AI Disclosure

  • [ ] I did not use AI assistance for this contribution
  • [x] I did use AI assistance (describe below)

Fix devised and generated by Claude Opus 4.6

rayhem avatar Jun 06 '26 16:06 rayhem

Please address Copilot feedback and rebase on upstream/main

mnriem avatar Jun 16 '26 22:06 mnriem

Please address Copilot feedback and rebase on upstream/main

mnriem avatar Jun 17 '26 13:06 mnriem