Skip to content

Honor BUN_INSTALL and BUN_INSTALL_GLOBAL_DIR for Bun global packages - #5532

Open
HawkForge wants to merge 1 commit into
Devolutions:mainfrom
HawkForge:fix/bun-install-global-dir
Open

HawkForge wants to merge 1 commit into
Devolutions:mainfrom
HawkForge:fix/bun-install-global-dir

Conversation

@HawkForge

Copy link
Copy Markdown
  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • Have you confirmed that this issue is caused by UniGetUI itself, and not by the package manager or the package involved?
    If the same issue can be reproduced outside UniGetUI with the relevant package manager or with the package itself, please report it there first. UniGetUI should only be used to track issues that are specific to UniGetUI's behavior or integration.

Thanks to piknockyou for the report.

Bun.GetGlobalPackagesDirectory always returned ~/.bun/install/global. Bun itself picks the global directory from BUN_INSTALL_GLOBAL_DIR first, then $BUN_INSTALL/install/global, then ~/.bun/install/global (open_global_dir in oven-sh/bun, src/install/PackageManager/PackageManagerOptions.rs). With Bun installed through Scoop (BUN_INSTALL set to a persist folder), UniGetUI looked in a directory that does not exist, so installed packages and updates were never listed.

The existing method now delegates to a new overload that takes an environment lookup and applies the same precedence; empty values are ignored. With no variables set the result is unchanged. The overload keeps the lookup injectable for tests, and BunPkgDetailsHelper picks up the fix through the existing call.

Added BunManagerTests.GetGlobalPackagesDirectoryHonorsBunEnvironmentVariables, covering BUN_INSTALL_GLOBAL_DIR, BUN_INSTALL, neither set, and empty values. It fails when the environment variables are ignored.

Testing:

  • dotnet test src/UniGetUI.PackageEngine.Tests/UniGetUI.PackageEngine.Tests.csproj --filter FullyQualifiedName~BunManagerTests (net10.0, Linux): 37 passed, 0 failed. Only this filter was run, not the full suite.
  • dotnet format whitespace on both changed files left them unchanged. dotnet format style was not run.

Not covered here: Bun's install.globalDir bunfig key, XDG_CACHE_HOME for the final fallback, and ~/ expansion in BUN_INSTALL_GLOBAL_DIR.

Closes #4918

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Bun updates not detected when installed via Scoop — GetGlobalPackagesDirectory ignores BUN_INSTALL

1 participant