fix: add COMPILE_PERMS option for compiled template permissions (GH #118) - #458
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: add COMPILE_PERMS option for compiled template permissions (GH #118)#458toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a
COMPILE_PERMSconfiguration option to control file permissions on compiled template files.Why
File::Tempcreates files with0600permissions. When multiple processes running as different users share a compiled template directory (viaCOMPILE_DIR), the second process fails to read templates compiled by the first. There was no way to override this without monkey-patchingTemplate::Document. Reported in GH #118 (rt.cpan.org #84840).How
Template::Document::write_perl_fileaccepts an optional 4th$permsargument and callschmodon the temp file before renaming it into place.Template::Providerstores the newCOMPILE_PERMSconfig key and passes it through towrite_perl_file.COMPILE_PERMSis not set, behavior is unchanged (File::Temp default0600).Testing
t/document_methods.t: verify permissions are set correctly at thewrite_perl_filelevel and flow through the fullTemplatepipeline.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