|
init_config rewrote the TEMPLATE_DIR line via awk as a bare, unquoted literal
when running --init from a source checkout. A source-root path containing a
space (or any shell metacharacter) produced a config that aborts on source
under "set -euo pipefail": the value was word-split, truncating the path and
running its tail as a command (exit 127), leaving TEMPLATE_DIR empty and
breaking every subsequent action.
Emit the rewritten value as a single-quoted assignment, escaping any embedded
single quote as '\'', so the generated shuriken.conf round-trips through
sourcing regardless of spaces or single quotes. The non-rewrite path (installed
/etc/default/shuriken) is unchanged. Regenerated bin/shuriken via just build.
Tests: test_init and test_init_with_hash_in_source_path now assert the SOURCED
TEMPLATE_DIR (the real contract) instead of the literal line, and a new
test_init_with_space_in_source_path covers the spaced-path regression.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Separate the mixed concerns in bootstrap.source.sh per [SRP]:
- logging.source.sh: output_is_quiet, output_is_verbose, log_info,
log_verbose, log_warning (the output/logging concern).
- paths.source.sh: resolve_default_rc_file, resolve_source_root,
resolve_default_template_dir, resolve_default_asset_dir,
template_dir_uses_default, apply_template_dir_default, init_config
(install/source-root/default-dir + rc-file/template-dir resolution).
- bootstrap.source.sh keeps the CLI usage text and the shared
resolve_config_array parser used by the config modules.
Pure code move, verified byte-identical function bodies. LIB_SOURCES now
lists logging.source.sh first, then bootstrap, then paths; matching
source directives added to src/shuriken.sh so --check-sourced sees the
new modules. just test/shellcheck/check-generated and git diff --check
all pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|