fix(plugins): quote path env vars in service commands so spaces in project dir work - #2960
Conversation
…oject dir work
Several builtin plugins reference an absolute project path in their
process-compose service command without wrapping it in double quotes:
| Plugin | command (before) |
| --- | --- |
| apache | apachectl start -f $HTTPD_CONFDIR/httpd.conf ...; tail -f $HTTPD_ERROR_LOG_FILE |
| caddy | caddy run --config=$CADDY_CONFIG |
| php | php-fpm -y {{ .DevboxDir }}/php-fpm.conf --nodaemonize |
| redis | redis-server $REDIS_CONF --port $REDIS_PORT |
| valkey | valkey-server $VALKEY_CONF --port $VALKEY_PORT |
These variables/templates expand to the project's absolute path (for
example $CADDY_CONFIG -> "{{ .DevboxDir }}/Caddyfile"), so an unquoted
reference is word-split by the shell whenever the project directory
contains a space and the service fails to start. This is the same class
of bug as the init_hook fix in #2876, now applied to service commands.
Wrap each path reference in double quotes, matching the pattern the
postgresql plugin already uses (`-k "$PGHOST"`). Ports and other
non-path values are left unquoted. The affected plugins' version fields
are bumped, consistent with how prior plugin behavior changes are
versioned.
Adds plugins/service_command_quoting_test.go, which scans every builtin
plugin's process-compose.yaml and asserts that templated paths and known
path-bearing env vars in service commands are quoted. It fails on the old
(unquoted) content and passes on the fix.
Fixes #2631
|
@claude please review this PR for correctness, and flag anything that would block merging. |
|
Claude finished @mikeland73's task in 2m 57s —— View job Review complete ✅
Nothing here blocks merging. This is a solid, well-scoped fix. Details below. Correctness of the quoting fixesDiffed each affected
Version bumpsVerified each bump against the pre-PR value (patch bumps, as claimed): One clarification worth noting in the PR description (not a blocker): Test coverage
Both are well-targeted and match the actual fix. Note the env-var test is opt-in per plugin (a new plugin with an unquoted path env var wouldn't be caught automatically) — the template-based test doesn't have this gap since it scans all plugins generically. Minor, not a blocker. I confirmed via I wasn't able to execute mariadb / mysql / nginx exclusionConfirmed by grepping all builtin Minor, pre-existing, out of scope
|
|
Focusing on merge-readiness here (a detailed line-by-line correctness review is already running separately in this thread): CI: green. On the head commit The one thing blocking merge is the draft state. This PR was converted to a draft (by @savil on Sep 2), so GitHub won't allow merging until it's marked Ready for review. There are no merge conflicts. Per my instructions I've left it as a draft and won't flip it to ready without your go-ahead — say the word and I will. Minor, non-blocking: the branch is ~10 commits behind Correctness (short version): the diff only wraps absolute-path env vars / templates in double quotes within each plugin's Generated by Claude Code |
Summary
Fixes #2631.
Several builtin plugins reference an absolute project path in their process-compose service command without wrapping it in double quotes:
apacheapachectl start -f $HTTPD_CONFDIR/httpd.conf ...,tail -f $HTTPD_ERROR_LOG_FILE,tail -f $HTTPD_ACCESS_LOG_FILEcaddycaddy run --config=$CADDY_CONFIGphpphp-fpm -y {{ .DevboxDir }}/php-fpm.conf --nodaemonizeredisredis-server $REDIS_CONF --port $REDIS_PORTvalkeyvalkey-server $VALKEY_CONF --port $VALKEY_PORTEach of these variables/templates expands to the project's absolute path (for example
$CADDY_CONFIG→{{ .DevboxDir }}/Caddyfile,$REDIS_CONF→{{ .DevboxDir }}/redis.conf). An unquoted reference is word-split by the shell whenever the project directory contains a space, so the service fails to start. This is the same class of bug as theinit_hookfix in #2876 — now applied to the plugin service commands that run underdevbox services.Fix
Wrap each path reference in double quotes, matching the pattern the
postgresqlplugin already uses (pg_isready -p "${PGPORT:-5432}"and-k "$PGHOST"). Ports and other non-path values are left unquoted. After the fix, e.g.:The affected plugins'
versionfields are bumped, consistent with how prior plugin behavior changes are versioned.The
mariadb,mysql, andnginxplugins have the same unquoted-path pattern in their service commands, but they currently have other in-flight PRs touching those exact files (#2906, #2911, #2909). They were intentionally left out of this PR to avoid conflicts and can be quoted in those PRs or a small follow-up.How was it tested?
plugins/service_command_quoting_test.go, which scans every builtin plugin'sprocess-compose.yamland asserts that templated paths ({{ ... }}) and known path-bearing env vars in service commands are quoted. It reuses the shell-quoting model from the existinginit_hook_quoting_test.go. Verified it fails on the old (unquoted) content and passes on the fix.go test ./plugins/ ./internal/plugin/,go vet ./plugins/, andgofmtare clean.cc @arent-groebner — thanks for the report.
Community Contribution License
All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.
By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.
Generated by Claude Code