-
Notifications
You must be signed in to change notification settings - Fork 17.1k
Fix logical bug in checksums environment variable handling in npm/install.js #48594
Copy link
Copy link
Closed
Copy link
Labels
36-x-y39-x-ybug 🪲component/buildhas-repro-commentIssue has repro in commentsIssue has repro in commentsplatform/linux
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
36.0.0 and above
What operating system(s) are you using?
Ubuntu
Operating System Version
Ubuntu 25.04
What arch are you using?
x86_64
Expected Behavior
This makes the intent clearer:
if either environment variable is truthy, skip local checksums
checksums: (process.env.electron_use_remote_checksums || process.env.npm_config_electron_use_remote_checksums) ? undefined : require('./checksums.json'),
Actual Behavior
There is a logical bug in install.js line 47 where the environment variable check for electron_use_remotechecksums doesn't work correctly due to operator precedence
The ternary operator (?:) has lower precedence than the nullish coalescing operator (??), so the code is evaluated as:
checksums: (process.env.electron_use_remote_checksums ?? process.env.npm_config_electron_use_remote_checksums) ? undefined : require('./checksums.json')
- If either variable is set to a truthy value, it uses remote checksums
- But the logic is confusing and not what was likely intended
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
36-x-y39-x-ybug 🪲component/buildhas-repro-commentIssue has repro in commentsIssue has repro in commentsplatform/linux