-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug fix] Ensure bin-wrappers use latest devbox binary to prevent fal…
…se 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.
- Loading branch information
Showing
7 changed files
with
99 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters