Skip to content

fix: preserve file modes during template substitution - #1820

Closed
alloutflo wants to merge 1 commit into
danielmiessler:mainfrom
alloutflo:codex/issue-1803-preserve-file-modes
Closed

fix: preserve file modes during template substitution#1820
alloutflo wants to merge 1 commit into
danielmiessler:mainfrom
alloutflo:codex/issue-1803-preserve-file-modes

Conversation

@alloutflo

Copy link
Copy Markdown

Summary

  • preserve each template file's original mode on the temporary file before the atomic rename
  • keep the source InstallEngine.ts and shipped skill copy synchronized
  • add a Bun regression test proving an executable hook remains executable after substitution

Closes #1803

Root cause

substituteTree() wrote replacement content to a new temporary inode. That inode inherited the process umask (typically 0644), and the subsequent rename replaced the executable source file together with its mode.

Validation

  • bun test LifeOS/test/skills/LifeOS/Tools/InstallEngine.test.ts — 1 passed
  • bun build LifeOS/Tools/InstallEngine.ts --target=bun — successful
  • verified both distributed InstallEngine.ts copies are byte-identical
  • git diff --check

@danielmiessler

Copy link
Copy Markdown
Owner

Thanks for the clean fix and test. This one's already fixed in the current source (the substituted write passes the captured mode to writeFileSync — equivalent effect, landed via issue #1803). Closing since there's nothing left to port; the credit for the class stays with the fix site.

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.

substituteTree strips the exec bit, silently disabling 10 wired hooks on every install

2 participants