devbox
devbox copied to clipboard
Workspaces with blanks in pathnames are not properly handled
What happened?
Given an iCloud working directory like this:
/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule
...and a file devbox.json like this:
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null",
". $VENV_DIR/bin/activate"
],
... then devbox shell --recompute will generate a file .hooks.sh like this:
/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.devbox/virtenv/python/bin/venvShellHook.sh
echo 'Welcome to devbox!' > /dev/null
. "$VENV_DIR/bin/activate"
This will not work because the path of the working directory contains a blank that isn't quoted: .../Mobile Documents/....
The environment variables were setup OK:
(devbox) bob@MacBook-Pro molecule % env | grep -i venv
UV_PYTHON=/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.venv/bin/python
VENV_DIR=/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.venv
This leads to the error message:
bob@MacBook-Pro molecule % devbox shell --recompute
Info: Ensuring packages are installed.
✓ Computed the Devbox environment.
Starting a devbox shell...
/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.devbox/gen/scripts/.hooks.sh:1: no such file or directory: /Users/bob/Library/Mobile
/Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.devbox/gen/scripts/.hooks.sh:.:3: no such file or directory: /Users/bob/Library/Mobile Documents/com~apple~CloudDocs/Projekte/ag/molecule/.venv/bin/activate
Steps to reproduce
- Enter a working directory with a blank in the path name
- Run
devbox shell --recompute
Command
No response
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
"packages": [
"ansible@latest",
"docker@latest",
"molecule@latest",
"python@latest"
],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null",
". \"$VENV_DIR/bin/activate\""
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
Devbox version
0.14.2
Nix version
nix (Nix) 2.29.0
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs
No response
The bug will be fixed if you change the generation of .hooks.sh to this:
"$DEVBOX_PROJECT_ROOT/.devbox/virtenv/python/bin/venvShellHook.sh"