You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug fix] Ensure bin-wrappers use latest devbox binary to prevent false update notifications (#1324)
## Summary
**Motivation**
In #1260, the bin-wrappers were changed to invoke the devbox-binary,
instead of the devbox-launcher. However, when devbox has been updated,
these bin-wrappers have the older devbox-binary's path hardcoded. So,
they call the older devbox-binary leading to two issues:
1. runs older functionality of the older devbox binary
2. re-prints the notice about "New devbox available. Run .... to
update", despite the user already having updated their devbox.
**Implementation**
1. Create a symlink that always points to the "current" devbox binary.
- I use "current" instead of "latest" to be consistent with the
Launcher's usage of these terms.
2. In the bin-wrappers, we prepend the directory containing this
devbox-symlink to PATH. The bin-wrappers revert back to directly
invoking devbox, as in `devbox shellenv`.
- This is done for robustness: if the symlink is missing, then the
bin-wrappers do still invoke `devbox` via the launcher. This is
problematic for users who have installed `coreutils` via devbox, but for
most users this fallback would work.
3. We ensure the bin-wrappers are created in
`ensurePackagesAreInstalled` that runs in `devbox.PrintEnv` during
`devbox shellenv`.
- This is needed because we need existing users that have the
bin-wrappers with the hardcoded DevboxExecutablePath to refresh their
bin-wrappers. When they open a new terminal, `devbox global shellenv`
would run, refreshing these bin-wrappers.
4. Finally, we create the Devbox symlink during `devbox version update`,
so that it points to the _new_ Devbox binary.
**Drawbacks**
Switching between devbox versions (for testing and development) may lead
to subtle unexpected behavior: The devbox-symlink will point to the
version that created the bin-wrappers, rather than respecting the devbox
of the PATH. We need to ensure we run `devbox install` or similar to
re-create the bin-wrappers.
## How was it tested?
1. Sanity check to do `devbox shell` in
`examples/development/go/hello-world`.
2. Sanity check to do `devbox run build` using the devbox binary from
this PR.
3. Deleted devbox-symlink, and ran `devbox version -v` to ensure that it
was re-created.
0 commit comments