-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition in "@zkochan/cmd-shim" produces corrupted bin scripts #7833
Labels
Comments
This race condition is also the cause of random install errors such as this:
|
And the corrupted file will produce error messages such as this (because of extraneous
Or like this (because of extraneous
|
I have created #8126 |
zkochan
pushed a commit
that referenced
this issue
May 31, 2024
Thank you @KSXGitHub ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Verify latest release
pnpm version
8.15.5
Which area(s) of pnpm are affected? (leave empty if unsure)
Package manager compatibility, Operating System (Windows, MacOS, Linux)
Link to the code that reproduces this issue or a replay of the bug
No response
Reproduction steps
package.json
The above package.json occasionally produces corrupted files such as
node_modules/.bin/eslint
,node_modules/.bin/eslint.CMD
, etc. The race condition is easiest to encounter on Windows OS.Describe the Bug
The problem occurs when multiple packages define a
"bin"
script with the same name. Usually this is a somewhat rare case of two different packages using the same name, but in our case the person was using an NPM alias"eslint-newest": "npm:eslint@~8.23.1"
to install two versions side-by-side, which is a fairly common practice.The data corruption occurs because PNPM attempts to write all files simultaneously:
cmd-shim/src/index.ts
Maybe the upstream NPM implementation does not have this problem, because it seems to only parallelize file extensions for one filename:
cmd-shim/lib/index.js
Expected Behavior
It's unclear which
.bin
script should win. NPM 10 seems to choose the unaliased package, but I didn't have time to study it closely.However it's certainly expected that PNPM's installation should be:
Which Node.js version are you using?
v18.19.1
Which operating systems have you used?
If your OS is a Linux based, which one it is? (Include the version if relevant)
No response
The text was updated successfully, but these errors were encountered: