oven-sh/bun

using `/tmp/bun-node` for overriding node.js is incorrect

Open

#7,504 opened on Dec 7, 2023

View on GitHub
 (2 comments) (2 reactions) (1 assignee)Rust (90,348 stars) (4,486 forks)batch import
buggood first issue

Description

What version of Bun is running?

No response

What platform is your computer?

No response

What steps can reproduce the bug?

If you at any point ever install bun in one place, run bun --bun, and then install it somewhere else, the second bun will use the old symlink and point to the first installation (which may be deleted)

This is rare but there are cases this can happen:

  • if you are on a machine where two people have bun installed to ~/.bun/bin/bun
  • you download any release manually and run it from your downloads folder
  • you use any other package manager to install bun that does not put it in ~/.bun/bin (if you use sudo yarn i -g, this can end up with /usr/local/bin/bun)
  • otherwise tampering with /tmp/bun-node (note: /tmp is usually mutable by any user)

a user reported this on nixos, where the binary is located at a unique path, it is pointing to a version as old as 0.6.2, though this issue isn't specific to nix.

image

What is the expected behavior?

i think a solution would be to move this into either XDG/Mac cache dir or into .bun somewhere, and/or use some hash of argv0, like bun-node-AJVZHD so that multiple installs point properly without having to fully validate them every time.

What do you see instead?

No response

Additional information

No response

Contributor guide