New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
permissions of compiled templates #181
Comments
Michael Bayer (@zzzeek) wrote: OK I frequently get confused on these issues, what I'm seeing is that the usage of mkstemp is only for writing out the file. The actual file that's used by the running of the template is the shutil.move() part, which moves the generated file to the ultimate destination (this is all of course for atomicity). The move isn't taking advantage of the sticky bit you have there ? I can't exactly hardcode os.chmod in there since it isn't platform agnostic. I'd want to give you just a writer() hook that just goes into _compile_module_file and then you can do what you want. something like this:
|
Changes by Michael Bayer (@zzzeek):
|
Anonymous wrote: Since the temporary file is already created in the outputpath, the group is set correctly at creation time due to the sticky bit of the outputpath on our server. A (non portable) configuration option to optionally set the permissions after creation to a given value would be sufficient in our case. A module_writer as presented would allow us to fix it ourselves. Whatever works for you :). I would opt for giving the writer variable the same name everywhere, e.g. also call the last arg to _compile_module_file module_writer instead of writer. Thx! |
Michael Bayer (@zzzeek) wrote: I like that, you care about the names within the internals :). The |
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: Milestone 0.6 deleted |
Changes by Michael Bayer (@zzzeek):
|
Migrated issue, originally created by Anonymous
Mako creates the files for compiled templates using mkstemp, which restricts permissions to the current user. In our setup we need group permissions and now monkey patched mako.template._compile_module_file to run os.chmod(outputpath, 0664) after the call.
It could be nice to have a general fix of this problem similar to the solution for directories in Ticket #101.
Our use case: We have a setup where web tests are run under one user and apache runs under a different user. Both users are in a unix group, which is also the owner of the folder for compiled templates, which additionally has the sticky bit set (chmod g+s).
The text was updated successfully, but these errors were encountered: