Skip to content

fix: add COMPILE_PERMS option for compiled template permissions (GH #118) - #458

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-compile-perms
Draft

fix: add COMPILE_PERMS option for compiled template permissions (GH #118)#458
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-compile-perms

Conversation

@toddr-bot

Copy link
Copy Markdown
Contributor

What

Add a COMPILE_PERMS configuration option to control file permissions on compiled template files.

Why

File::Temp creates files with 0600 permissions. When multiple processes running as different users share a compiled template directory (via COMPILE_DIR), the second process fails to read templates compiled by the first. There was no way to override this without monkey-patching Template::Document. Reported in GH #118 (rt.cpan.org #84840).

How

  • Template::Document::write_perl_file accepts an optional 4th $perms argument and calls chmod on the temp file before renaming it into place.
  • Template::Provider stores the new COMPILE_PERMS config key and passes it through to write_perl_file.
  • When COMPILE_PERMS is not set, behavior is unchanged (File::Temp default 0600).

Testing

  • Unit tests in t/document_methods.t: verify permissions are set correctly at the write_perl_file level and flow through the full Template pipeline.
  • Full test suite passes (3400+ tests).
  • Windows-skipped (chmod is not reliable on Win32).

Closes #118


Quality Report

Changes: 4 files changed, 106 insertions(+), 6 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

…(GH #118)

File::Temp creates compiled templates with 0600 permissions, which
breaks multi-user setups where different processes need to read
compiled templates.  Add a COMPILE_PERMS option that sets file
permissions on compiled template files via chmod before rename.

Closes #118
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.

Default file permissions [rt.cpan.org #84840]

1 participant