Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDesign question: why support just dirs and not files? #19
Comments
This comment has been minimized.
This comment has been minimized.
|
At this point it's mostly just historical and not intentional. Long ago we had |
This comment has been minimized.
This comment has been minimized.
|
Ooo good to know. I bet a lot of @Stebalien's work on https://stebalien.github.io/tempfile/tempfile could be imported. (There are a bunch of places in those docs where it says "SECURITY WARNING" though, will want to think carefully about those one way or another.) Edit: relevant context https://www.reddit.com/r/rust/comments/32n864/tempfile_temporary_file_library/cqd3ic0/?context=3 |
This comment has been minimized.
This comment has been minimized.
|
Sounds plausible to me! |
This comment has been minimized.
This comment has been minimized.
|
If we want to merge tempdir and tempfile would it be better to call it |
This comment has been minimized.
This comment has been minimized.
|
Is this something you guys would like to do before a cc: @alexcrichton |
This comment has been minimized.
This comment has been minimized.
|
It seems like most other languages I've used handle both in one library? New users might find it a little surprising to split them? https://docs.python.org/3.6/library/tempfile.html |
This comment has been minimized.
This comment has been minimized.
aturon
commented
Aug 3, 2017
|
cc me |
This comment has been minimized.
This comment has been minimized.
Stebalien
commented
Aug 3, 2017
Basically, relying on named temporary files in the presence of temporary file cleaners is tricky. However, to be honest, I could probably soften those warnings.
I'd also be happy to give up the tempfile crate name for the greater good. Alternatively, someone could write an fsutil crate for all these miscellaneous filesystem related tools. |
This comment has been minimized.
This comment has been minimized.
|
I can think of a few paths forward:
I guess which option makes the most sense depends on how important this is, and whether we're happy to defer stabilising Maybe we should cast the net wider and see if other Rustacean's expect temporary file and directory handling in a single crate? What do you all think? |
This comment has been minimized.
This comment has been minimized.
|
I'd be totally down for merging the two crates somehow if desired, it's sort of what I'd expect! I think tempfiles have the nice property that they can almost always have guaranteed cleanup on process exit, whereas temporary directories not so much :( |
This comment has been minimized.
This comment has been minimized.
|
Having the one crate with a consistent API for temporary directories and files does sound nice. I'm just not sure how much we should churn users of |
This comment has been minimized.
This comment has been minimized.
Stebalien
commented
Aug 7, 2017
Completely on board. However, I'd really like a directory abstraction that allows one to securely create files/directories under a directory (guaranteeing that the files are actually created under the given directory) and have |
This comment has been minimized.
This comment has been minimized.
|
It looks like this is something folks are pretty much on-board with, but it's a pretty significant undertaking. Would a good next step be a pre-RFC to work out specifics like crate name and API? |
This comment has been minimized.
This comment has been minimized.
|
I wouldn't necessarily think this needs an RFC, but it probably couldn't hurt if you're feeling up to the task! |
This comment has been minimized.
This comment has been minimized.
|
Sure, I'll get the ball rolling on this |
opilar
pushed a commit
to opilar/tempdir
that referenced
this issue
Sep 22, 2017
This comment has been minimized.
This comment has been minimized.
|
We've now got the I'll go ahead and close this now, and we can continue tracking the progress of a new |
oconnor663 commentedJan 23, 2017
I'm curious about the reasons for focusing specifically on temp dirs and not temp files. Are there security benefits to always using a dir? Or simplicity/portability benefits? Asking out of historical interest more than anything else. (Apologies if this is an abuse of issues :) )