devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Devbox should handle spaces in paths

Open Lagoja opened this issue 1 year ago • 1 comments

What problem are you trying to solve?

I'm frustrated when I try to use Devbox with a path that has a space in it. For example: if my Devbox project is in the following path:

~/src/repros/spaced path

Devbox will fail with the following error:

Error: nix print-dev-env --json "path:/Users/johnlago/src/repros/spaced path/.devbox/gen/flake": exit status 1

With DEVBOX_DEBUG=1:

...
2024/03/20 16:54:06 Running print-dev-env cmd: /nix/var/nix/profiles/default/bin/nix print-dev-env path:/Users/johnlago/src/repros/spaced path/.devbox/gen/flake --extra-experimental-features ca-derivations --option experimental-features nix
✓ Computed the Devbox environment.
Error: nix print-dev-env --json "path:/Users/johnlago/src/repros/spaced path/.devbox/gen/flake": exit status 1

2024/03/20 16:54:07 Command stderr: path '/Users/johnlago/src/repros/spaced path/path:/Users/johnlago/src/repros/spaced path/.devbox/gen/flake' does not contain a 'flake.nix', searching up
error: getting status of '/Users/johnlago/src/repros/spaced path/path:/Users/johnlago/src/repros/spaced path/.devbox/gen/flake': No such file or directory
...

What solution would you like?

As of Nix 2.19, flakes + print-dev-env support paths that are URL or percent encoded. We should adapt our command to use percent encoding, so we can support spaced paths.

Alternatives you've considered

Not using paths with spaces

Lagoja avatar Mar 20 '24 23:03 Lagoja

Related issues #1876 #1429 #971

Lagoja avatar Mar 20 '24 23:03 Lagoja

Is this in the latest release (0.12)? Still having this issue currently.

ademlabs avatar Jul 14 '24 17:07 ademlabs

Spaces in Paths should be fixed as of Devbox 0.13.1

Lagoja avatar Oct 08 '24 22:10 Lagoja

EDIT: Nevermind, I see there's a change to 0.13.6 which should address it (https://github.com/jetify-com/devbox/pull/2393)

Unfortunately it's still broken in 0.13.4...

I think this change was supposed to resolve it (my system is running bash): https://github.com/jetify-com/devbox/commit/ac072048a1ccdd8bc3d87cada19690c68f8579f2#diff-38f085ff12c1d3451f41d90ca82ba777f763554116f422c12c8ca92d722f583fR59

devbox version
# 0.13.4
mkdir -p parent\ space/devbox-test
cd parent\ space/devbox-test/
devbox init
devbox gen direnv
# Info: Ensuring packages are installed.
# ✓ Computed the Devbox environment.
# Success: generated .envrc file
# Success: ran `direnv allow`
# direnv: loading ~/source/parent space/devbox-test/.envrc
# direnv: using devbox
# ./.envrc:179: /home/deftdawg/source/parent: No such file or directory
# direnv: export +AR +AS +CC +CONFIG_SHELL +CXX +DEVBOX_CONFIG_DIR +DEVBOX_INIT_PATH +DEVBOX_NIX_ENV_PATH_bc3de5263524d52266b11898d6cb33e3bc0d50777a2551a0bebd8d2ac9a45a20 +DEVBOX_PACKAGES_DIR +DEVBOX_PATH_STACK +DEVBOX_PROJECT_ROOT +DEVBOX_SYSTEM_BASH +DEVBOX_SYSTEM_SED +DEVBOX_WD +HOST_PATH +IN_NIX_SHELL +LD +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES +NIX_CC +NIX_CC_WRAP

deftdawg avatar Nov 01 '24 16:11 deftdawg