Uh oh!
There was an error while loading. Please reload this page.
fix(plugins): quote templated hook paths so spaces in project dir work - #2876
Conversation
The python, poetry, mariadb and mysql builtin plugins referenced a
templated absolute path (e.g. "{{ .Virtenv }}/bin/venvShellHook.sh") in
their init_hook without wrapping it in double quotes. Because .Virtenv
expands to the project's absolute path, an unquoted reference is word-split
by the shell whenever the project directory contains a space, so the hook
fails to run:
bash: /home/me/Documents/rm: No such file or directory
Wrap each templated path in double quotes (matching the existing nodejs
plugin), and bump the affected plugins' versions. Adds a regression test
that asserts no builtin plugin's init_hook contains an unquoted templated
path.
Fixes#2673There was a problem hiding this comment.
Pull request overview
This PR fixes devbox shell failures when the project directory contains spaces by ensuring builtin plugin shell.init_hook commands properly quote templated absolute paths (e.g. {{ .Virtenv }}), preventing shell word-splitting.
Changes:
- Quote templated
{{ .Virtenv }}paths ininit_hookfor thepython,poetry,mysql, andmariadbplugins. - Bump the affected plugin versions from
0.0.4to0.0.5. - Add a Go regression test to enforce quoting for templated values in builtin plugin
init_hooklines.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| plugins/python.json | Quotes the templated virtenv hook script path and bumps plugin version. |
| plugins/poetry.json | Quotes the templated init hook script path and bumps plugin version. |
| plugins/mysql.json | Quotes the templated setup_db.sh path in the bash invocation and bumps plugin version. |
| plugins/mariadb.json | Quotes the templated setup_db.sh path in the bash invocation and bumps plugin version. |
| plugins/init_hook_quoting_test.go | Adds a regression test to enforce quoting of templated init_hook content across builtin plugins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Address review feedback on the init_hook quoting regression test. The previous insideDoubleQuotes helper only toggled on " and could produce false negatives: a literal double quote inside a single-quoted segment would flip the state, and an unterminated quote was treated as quoted. Replace it with shellQuotedPositions, which models the parts of POSIX shell quoting relevant to word-splitting: single and double quotes are mutually exclusive, a backslash escapes a double quote inside double quotes, and a quote that is never closed leaves its bytes unquoted (so an unterminated segment is reported as unsafe).
golangci-lint's varnamelen flagged the single-letter byte variable used across the quote-scanning loop (distance exceeds max-distance: 10). Use a descriptive name instead.
The project-tests-only job failed only on the elixir example (mix deps.get / mix run), which is unrelated to this PR's plugin init_hook quoting change. Re-running to clear the flaky failure.
mikeland73
commented
Jun 20, 2026
Heads-up on CI: the substantive change is green across the board — The remaining red is a single flaky, unrelated test:
Two different network-flaky tests across re-runs, none related to the four plugins changed here (python/poetry/mysql/mariadb init_hook quoting), points to CI flakiness rather than a regression. I can't re-run the failed job from automation (the integration gets Generated by Claude Code |
Summary
Fixes#2673.
Several builtin plugins reference a templated absolute path in their
init_hookwithout wrapping it in double quotes:init_hookline (before)python{{ .Virtenv }}/bin/venvShellHook.shpoetry{{ .Virtenv }}/bin/initHook.shmariadbbash {{ .Virtenv }}/setup_db.shmysqlbash {{ .Virtenv }}/setup_db.shBecause
{{ .Virtenv }}expands to the project's absolute path, an unquoted reference is word-split by the shell whenever the project directory contains a space. The hook then fails to run and the shell startup breaks:Fix
Wrap each templated path in double quotes, matching the pattern the
nodejsplugin already uses (node "{{ .Virtenv }}/bin/setup-corepack.js"). After rendering, the generated hook becomes a single quoted token, e.g.:"/home/me/Documents/rm scripts/.devbox/virtenv/python/bin/venvShellHook.sh"The affected plugins'
versionfields are bumped (0.0.4→0.0.5), consistent with how prior plugin behavior changes are versioned.The hook scripts themselves (
venvShellHook.sh,initHook.sh,setup_db.sh) already quote their internal path variables, so the only gap was the invocation line.Testing
plugins/init_hook_quoting_test.go, which scans every builtin plugin and asserts that any{{ ... }}template used in aninit_hookline is enclosed in double quotes. It fails on the old (unquoted) content and passes on the fix.bash -nsyntax-checked each rendered line.go test ./plugins/ ./internal/plugin/,go vet, andgofmtare clean.cc @xorinzor (issue reporter) — thanks for the clear reproduction and root-cause.
Generated by Claude Code