You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: process.umask() (no args) will be deprecated and removed.
I couldn't quite divine what lib/config/defaults.js uses process.umask() for but in most cases you don't need to deal with the umask directly - the operating system will apply it automatically.
The umask argument defaults to process.umask(). This is passed to pacote, bin-links, and node-tar, which use it to determine the appropriate modes for files and folders in unpacked packages.
For pacote and bin-links, we can default it to 0, since as you say, the process will enforce its own by default. But for node-tar, it's a bit more tricky, as being able to read the default umask allows us to skip a lot of unnecessary stat and chmod calls.
Once the dependencies are no longer using it, we can remove the process.umask() calls from the npm cli without any problem, and just set 0 as the default.
One extremely hacky solution we could use to make things work for older npm clients where we might not want to do all the work to unwind old deps depending on process.umask() is just shim it at the start of the CLI process if it's not present.
Would mean that debian users don't get group-writable files, but safer than accidentally creating world-writable bins, and better than crashing entirely.
Activity
isaacs commentedon Apr 3, 2020
The
umaskargument defaults toprocess.umask(). This is passed to pacote, bin-links, and node-tar, which use it to determine the appropriate modes for files and folders in unpacked packages.For pacote and bin-links, we can default it to 0, since as you say, the process will enforce its own by default. But for node-tar, it's a bit more tricky, as being able to read the default umask allows us to skip a lot of unnecessary stat and chmod calls.
Once the dependencies are no longer using it, we can remove the
process.umask()calls from the npm cli without any problem, and just set0as the default.isaacs commentedon Apr 3, 2020
One extremely hacky solution we could use to make things work for older npm clients where we might not want to do all the work to unwind old deps depending on
process.umask()is just shim it at the start of the CLI process if it's not present.Would mean that debian users don't get group-writable files, but safer than accidentally creating world-writable bins, and better than crashing entirely.
chore: bump tar@4.4.13 to tar@6.0.5
chore: bump tar@4.4.13 to tar@6.0.5
Add the noChmod option
Add the noChmod option
Add the noChmod option
Remove process.umask() call from config default
Add the noChmod option
Remove process.umask() call from config default
Remove process.umask() call from config default
Add the noChmod option
Remove process.umask() call from config default
Remove process.umask() call from config default
Remove process.umask() call from config default