devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Whitespace in project directory breaks `devbox shellenv ...`

Open andrew-monroe opened this issue 1 year ago • 0 comments

What happened?

TLDR

This line of code is not doing proper whitespace escaping on the value of d.projectDir(). The issue may also be fixable by updating shellgen.ScriptPath(), but you all will know better than I.

Description

devbox shellenv --init-hook --install --no-refresh-alias breaks when the project directory contains whitespace.

I specifically encounter this when I am running devbox generate direnv --print-envrc, which appears to be calling out to the above command on my system.

The reason this ultimately fails is because this script produces this line following all of the exports:

. /Users/andrewmonroe/Documents/10-19 Workspace/10 App/canarytech_dev/.devbox/gen/scripts/.hooks.sh;

Which naturally leads to this error when the output code is executed:

/bin/bash:195: /Users/andrewmonroe/Documents/10-19: No such file or directory

Steps to reproduce

  1. Make a project within a directory whose path includes whitespace.
  2. Run devbox shellenv --init-hook --install --no-refresh-alias.
  3. See that the attempt to invoke the .hooks.sh file will not include whitespace-escaping.

Command

shellenv

devbox.json

No response

Devbox version

0.13.5

Nix version

No response

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

No response

andrew-monroe avatar Oct 22 '24 18:10 andrew-monroe