Skip to content

bug: space in directory name prevents hooks from executing in bash #2673

@xorinzor

Description

@xorinzor

What happened?

Having a space in a directory name that devbox shell is called in, will result in bash stating:

me@main-lt:~/Documents/rm scripts$ devbox shell
Starting a devbox shell...
bash: /home/me/Documents/rm: No such file or directory

Looking at one of the generated files we can find the cause: spaces are not escaped, nor is the path in quotes.

me@main-lt:~/Documents/rm scripts$ cat .devbox/gen/scripts/.hooks.sh 
/home/me/Documents/rm scripts/.devbox/virtenv/python/bin/venvShellHook.sh
echo 'Welcome to devbox!' > /dev/null

If I escape the space, the error no longer appears.
Tested on Ubuntu 25.04

Steps to reproduce

  1. create a directory with a space in it's name
  2. run devbox init
  3. run devbox shell

Command

shell

devbox.json

{
  "$schema":  "https://raw.githubusercontent.com/jetify-com/devbox/0.15.1/.schema/devbox.schema.json",
  "packages": ["[email protected]"],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.15.1

Nix version

2.30.2

What system does this bug occur on?

Linux (x86-64)

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