-
Notifications
You must be signed in to change notification settings - Fork 93
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
should not lock dir in os.tmp #250
should not lock dir in os.tmp #250
Comments
@bluelovers this has been documented as one of the breaking changes in version 0.2.0 and was introduced as a precaution so that one cannot inject arbitrary directories into tmp have it remove these directories recursively, say /etc or something like that. Is yarn-cache/tmp your default tmp directory? Or are you using multiple such temporary root for different purposes? An option would be to pass in the system's TEMP as an environment variable, that way you could point your application to TEMP=T:\cache\yarn-cache\tmp and it will work. T:\yarn-cache-tmp -> T:\cache\yarn-cache\tmp and use dir = yarn-cache-tmp, which should work as expected. Alternatively you can omit the symlink and just use T:\cache\yarn-cache\tmp with TEMP = |
@silkentrance, our application doesn't use system temporary directory for some reasons. One of them is that this directory is cleaned and also used by some legacy software which fails working with system temporary directory due to permission reasons (some files in Symlinking temporary directory and passing its path as an environment variable are also not good options. Paths to temporary directories of our application are set in a separate configuration file and making additional efforts by linking directories and setting up environment variables don't allow our app to work out-of-box. Wouldn't it be better to add an option that sets an alternative root temporary directory (or multiple root temporary directories) programatically? I don't see any graceful ways to make this version of |
Another (and most important) reason for us is that we're using beegfs cluster FS where our software is processing data distributed on many computers. Having temporary directories in this file system for data processing is mandatory and doesn't suit locking temporary directory to OS' one. Please, consider adding an option to remove these restrictions. We know what we are doing by removing such restrictions, and for sure, it will not affect important system directories such as |
Providing an option to explicitly skip this behavior sounds like a good middleground to me. |
@raszi this is a sound proposal. @ezze @bluelovers A temporary workaround for this, while the new release is under way, is to replace os.tmpdir() with a custom function like so (we do this in our tests and it works just fine):
Remember to cast os to any when using Typescript, e.g.
This was a bad idea and will bring up unwanted side effects. |
@raszi @ezze @bluelovers Alternatively, of course, one could set the process environment variable, which gets evaluated by os.tmpDir(), e.g.
As always, there are multiple ways to achieve this without having to change the tmp API. Let me know which approach would suit you best.
|
I don't think that any of those suggestion would work. Think about another projects depending on the environment variables or the |
@silkentrance, I agree with @raszi. |
So we would then settle on an extra option that lets the user override the tmpdir location, e.g.
and so on. This will then require the user to always pass in the tmpdir option. I still do not see a problem in using the process environment for setting it globally. In other projects we always do it this way and it never caused any unwanted side effects. Unless, of course, you have software that uses a hard coded path to some I see the point about switching the tmp dir provider during runtime, though, as this will fail tmp if the user used a temporary directory created under a different path and then switches the tmp dir provider to point to a different root location. So this will definitely bring up unwanted side effects. I also see the point of dynamically changing the process environment variable that points to the temporary storage, similar unwanted side effects can be had here as well. |
Yes, that is the proposal I had in mind, optionally override the tmpdir location. |
@silkentrance The problem comes when you use some dependency that relies on the same version of |
The best option to my taste is to bypass root tmp directory checks at all in order to avoid duplicated parts in |
I just found out that changes to the options will leak out. Also changing that. @ezze It is a security feature that is required. Not all users are power users and some might wreck their systems when allowing that. |
@silkentrance, ok, it's just my proposal. Changing root temporary directory for single tmp function call is also fine for us. |
PR is here: #252 |
fix #250: introduce tmpdir option for overriding the system tmp dir
Operating System
NodeJS Version
Tmp Version
0.2.0
Expected Behavior
should allow any dir
Experienced Behavior
TBD:What did actually happen?
The text was updated successfully, but these errors were encountered: