Skip to content

Workspaces with blanks in pathnames are not properly handled #2631

Open
@arent-groebner

Description

@arent-groebner

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

  1. Enter a working directory with a blank in the path name
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions