Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.devbox/bin/devbox symlink appears to be wrong? #1849

Closed
johnliu opened this issue Feb 27, 2024 · 4 comments
Closed

.devbox/bin/devbox symlink appears to be wrong? #1849

johnliu opened this issue Feb 27, 2024 · 4 comments
Assignees
Labels
bug Something isn't working triage Issue needs triage

Comments

@johnliu
Copy link

johnliu commented Feb 27, 2024

What happened?

I discovered this somewhat accidentally but I had a project that used the biome linter. I kept getting a warning about a broken symlink in .devbox/bin/devbox. It seemed that caused devbox to not be functional in a pure shell:

$ devbox shell --pure
Starting a devbox shell...
(devbox) bash-5.2$ devbox
bash: devbox: command not found
(devbox) bash-5.2$

Fixing this symlink to seemed to resolve the issue so I'm assuming the symlink isn't correctly created?

$ cd .devbox/bin
$ ln -s $(which devbox) devbox
$ cd ../..
$ devbox shell --pure
Starting a devbox shell...
(devbox) bash-5.2$ devbox
Instant, easy, predictable development environments

Usage:
  devbox [flags]
  devbox [command]

Available Commands:
  add         Add a new package to your devbox
  auth        Devbox auth commands
  completion  Generate the autocompletion script for the specified shell
  create      Initialize a directory as a devbox project using a template
  generate    Generate supporting files for your project
  global      Manage global devbox packages
  help        Help about any command
  info        Display package info
  init        Initialize a directory as a devbox project
  install     Install all packages mentioned in devbox.json
  rm          Remove a package from your devbox
  run         Run a script or command in a shell with access to your packages
  search      Search for nix packages
  services    Interact with devbox services.
  shell       Start a new shell with access to your packages
  shellenv    Print shell commands that add Devbox packages to your PATH
  update      Update packages in your devbox
  version     Print version information

Flags:
  -h, --help    help for devbox
  -q, --quiet   suppresses logs

Use "devbox [command] --help" for more information about a command.
(devbox) bash-5.2$

Steps to reproduce

  1. Create a fresh devbox (devbox init).
  2. Enter a pure shell (devbox shell --pure).
  3. Try using devbox within the pureshell.

Command

shell

devbox.json

{
  "packages": [],
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {
      "test": [
        "echo \"Error: no test specified\" && exit 1"
      ]
    }
  }
}

Devbox version

0.9.1

Nix version

nix (Nix) 2.18.1

What system does this bug occur on?

macOS (Apple Silicon)

Debug logs

No response

@johnliu johnliu added bug Something isn't working triage Issue needs triage labels Feb 27, 2024
@johnliu
Copy link
Author

johnliu commented Feb 27, 2024

My go isn't very proficient but looking at this: it seems like this should be replaced with os.Executable()?

https://github.com/jetpack-io/devbox/blob/main/internal/devbox/pure_shell.go#L49

@savil
Copy link
Collaborator

savil commented Feb 27, 2024

Thanks for the bug report!
@mohsenari would you mind having a look?

@mohsenari
Copy link
Collaborator

@johnliu thanks for reporting this. I can't seem to reproduce this on Bash or Zsh. But I tested with os.Executable() based on your suggestion and it seems to work fine too. So I'll make a PR changing that line to call os.Executable()

mohsenari added a commit that referenced this issue Feb 29, 2024
)

## Summary
Symlink in pure shell seemed to be broken in some systems. This fixes
the issue.

Addressed #1849 
## How was it tested?
devbox init
devbox shell --pure
devbox
@johnliu
Copy link
Author

johnliu commented Mar 1, 2024

Thanks for the fix!

@Lagoja Lagoja closed this as completed Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs triage
Development

No branches or pull requests

4 participants