cmds.secrets.CompileTemplates: Fix conf line handling #138
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/fix/20261012-cmds-secrets-compiletemplates-fix-conf-line-handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
cmds.secrets.CompileTemplates: Fix conf line handling
File attributes of the compiled output of
jw-pkg secrets compile-templatescan be specified via the # conf line atop a.jw-tmplfile, the parsing of that line is buggy, however.Its mode is parsed as a decimal number unless it carries a leading zero, so
mode=640yields 640 decimal, 1200 octal, and the output file ends up without usable permissions. The same decimal parse applies to a conf line atop the.jw-secretof a target, whose attributes are honored the same way, and the--modeoption of compile-templates passes its string value through to Attrs, whose mode is typed int, so a target without a conf line of its own crashes in_format_metadata().Other than that, the # conf line itself should be removed from the compiled output, but isn't.
This commit makes the conf line handling correct:
_parse_attributes()parses the mode as octal, with or without a leading zero_compile_one_template_file()drops the conf line from the compiled content--modeoption is converted to an octal int byoctal_mode()at the argument boundaryThe integration test writes its conf line modes without leading zeros, expects the conf line gone from the compiled output, takes one target's mode from a conf line atop its
.jw-secret, and passes a--modethat the conf lines override.609b3dcf9d141dd0ac3c