oven-sh/bun

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

Open

#7504 aperta il 7 dic 2023

Vedi su GitHub
 (2 commenti) (2 reazioni) (1 assegnatario)Rust (4486 fork)batch import
buggood first issue

Metriche repository

Star
 (90.348 star)
Metriche merge PR
 (Merge medio 1g 17h) (357 PR mergiate in 30 g)

Descrizione

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

Guida contributor