-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] /tmp/npm-${PID}-* directories should be cleaned when "npm pack" gets terminated #695
Comments
Typically it’s the OS’s job to clean up the temp dir, not the user’s nor applications’. That’s it’s purpose. |
@ljharb, even if we assume that we both agree with your general formulation the fact is that npm already cleans these temp directories if it successfully exits and in this case the remaining directories have size 1Mb which is fully aceptable for me, because can be cleaned afterwards by the OS as you said: About the "typically" I would argue about that. From my point of view the remaining intermediate data looks like a memory leak or like a file descriptor which remains open()ed after the program exiting. Many applications write files to /tmp and remove them without delegating it to the OS. But as I already said npm does clean, but sometimes terminates without doing this. I think fixing of this would be a good improvement. |
npm If your bug is preproducible on If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo Closing: This is an automated message. |
What / Why
"npm pack" call produces junk data in the system temp (smth like /tmp/npm-8452-4aa95566). This useless data quickly populates the /tmp and puts responsibility on npm users to clean it. I think the responsibility to remove this data should be on npm code, because npm code produces there intermediate directories. I think it is not a big deal to add a removal upon exiting of the npm process.
UPDATE: I am talking about the case "npm pack" failed and did not clean the folder. There should be some error handling added so that npm cleans the temp folder before gets abnormally terminated.
I assume that the place where this path is evaluated is probably ./lib/npm.js, thus probably the removal can be added to this script:
Object.defineProperty(npm, 'tmp',
{
get: function () {
if (!tmpFolder) tmpFolder = 'npm-' + process.pid + '-' + rand
return path.resolve(npm.config.get('tmp'), tmpFolder)
},
enumerable: true
})
OS: Ubuntu 18.04
NPM: 6.5.0
When
Whenever "npm pack" fails.
Where
npm publish
How
Current Behavior
Steps to Reproduce
Expected Behavior
Who
References
The text was updated successfully, but these errors were encountered: