Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Infer owner of all unpacked files
Fix: #2 Infer the uid/gid setttings for unpacked files and mkdir'ed directories from the ownership of the parent directory into which files are being unpacked. This prevents user-owned files from ending up in a root-owned location (as happens when someone runs `sudo npm i -g ...`) and root-owned files in a user-owned location (as happens when someone runs `sudo npm i ...`). The argument can be made that when running a program as root, the user *shouldn't* be surprised to find root-owned files were created in a "non-hidden" folder like `node_modules`, even if putting root-owned files in the `~/.npm` cache is inappropriate. However: - In practice, this is indeed unexpected to a huge number of users. Since they often don't realize at first that npm installs local deps locally in the project, they may think that they need to use `sudo` simply because other package managers require it. - `node_modules` is, for most npm users, just as "hidden" as `~/.npm`.
- Loading branch information