Skip to content
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

Choose a writable temp dir please #112

Closed
gilescope opened this issue Nov 9, 2019 · 6 comments
Closed

Choose a writable temp dir please #112

gilescope opened this issue Nov 9, 2019 · 6 comments

Comments

@gilescope
Copy link

Reading the docs for the windows temp dir selection, it goes through several fallbacks before it selects a dir:

https://docs.microsoft.com/en-gb/windows/win32/api/fileapi/nf-fileapi-gettemppatha

Would it be possible for this crate to check that the dir selected is writable by the current user before selecting it? ( See rust-lang/cargo#4350 )

@KodrAus
Copy link
Collaborator

KodrAus commented Nov 9, 2019

Ah that's a bit unfortunate! We could write our own alternative to env::temp_dir, like writable_temp_dir, that on Windows follows through the same environment variables, and on Linux just forwards to env::temp_dir.

Would you like to submit a PR that does something like this?

@Stebalien
Copy link
Owner

I'm not sure this is the right behavior. The docs imply that one should:

  1. Call GetTempPath to get the location where temporary files should be written.
  2. Check to make sure that this directory is accessible.

That's effectively what we're doing by trying to actually create a file/directory.

The docs don't say that one should check if the paths specified by TMP, TEMP, and USERPROFILE are writable in-turn.

From what I can tell, specifying a TMP that isn't writable is a misconfiguration. I'd rather fail early than work around it.

@hunger

This comment has been minimized.

@Stebalien

This comment has been minimized.

@hunger
Copy link

hunger commented Dec 2, 2020

@Stebalien : Oh, sorry, I got here by following a link from the cargo bug tracker and had not noticed that I was in a different project now!

@spoelstraethan
Copy link

Writable isn't the only issue, if you can write files there but can't execute them, you are still going to get build failures. Not sure if that is a separate issue or just another unit/integration test to use against the code changes.

@Stebalien Stebalien closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants