Comments (16)
whether you'd be on board with merging these crates in some way.
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 TempDir
dereference to said directory abstraction. For example, on Linux, Directory
would keep a file descriptor open for the directory and use openat
/mkdirat
to create files under it. On macos, one can use per-thread current working directories (😈) to achieve the same effect (at the cost of two additional syscalls...).
from tempdir.
I wouldn't necessarily think this needs an RFC, but it probably couldn't hurt if you're feeling up to the task!
from tempdir.
We've now got the tempdir
API merged into tempfile
🎉
I'll go ahead and close this now, and we can continue tracking the progress of a new tempfile
release including temporary files and directories in that repository.
from tempdir.
At this point it's mostly just historical and not intentional. Long ago we had TempDir
in the standard library, then the compiler, and then this external crate. I don't think this has been actively developed since its inception really, and a PR to implement temp files would be most welcome!
from tempdir.
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
from tempdir.
Sounds plausible to me!
from tempdir.
If we want to merge tempdir and tempfile would it be better to call it temp
crate?
from tempdir.
Is this something you guys would like to do before a 1.0
release? Or do you think it's sufficient to have an example somewhere using both tempdir
and tempfile
?
cc: @alexcrichton
from tempdir.
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
https://golang.org/pkg/io/ioutil/
from tempdir.
cc me
from tempdir.
SECURITY WARNING
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.
If we want to merge tempdir and tempfile would it be better to call it temp crate?
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.
from tempdir.
I can think of a few paths forward:
- Do nothing
- Deprecate
tempdir
ortempfile
and merge them into a single crate (in this case I think it's worth pointing out thattempfile
is stable andtempdir
isn't, buttempdir
has more dependent crates) - Add some docs/examples to
tempdir
andtempfile
but keep the crates separate - Keep the crates separate, but make another crate,
temp
orfsutil
, or whatever that re-exports or wraps bits oftempdir
andtempfile
, maybe dealing with issues like conflicting destructors
I guess which option makes the most sense depends on how important this is, and whether we're happy to defer stabilising tempdir
until there's a crate that offers both temporary files and temporary directories.
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?
from tempdir.
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 :(
from tempdir.
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 tempdir
or tempfile
. @Stebalien I don't think anyone's actually properly asked you what you think and whether you'd be on board with merging these crates in some way.
from tempdir.
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?
from tempdir.
Sure, I'll get the ball rolling on this 👍
from tempdir.
Related Issues (20)
- The implementation of `Debug` breaks build on Rust 1.1 HOT 5
- TempDir affected by remove_dir_all unreliability on windows HOT 7
- (Not)Equivalent of dangling pointer dereferencing when calling `path` after `into_path` HOT 2
- Unnecessary Option in TempDir or panicky code HOT 2
- Update examples to use `?`
- Add CI for Windows and Mac HOT 1
- Add keywords and categories to Cargo.toml
- Finalize conventions for `close` HOT 10
- Update html_root_url attribute to point to https://docs.rs/tempdir/$version
- Library evaluation tracking issue HOT 4
- Support randomly-named directories HOT 3
- option to keep a temporary directory after panic, for debugging purposes HOT 9
- path to 1.0 HOT 2
- Publish New Version HOT 5
- Support ramfs through type `RamDir` HOT 2
- deprecate into_path(), rename persist() HOT 4
- Deprecate the tempdir crate HOT 11
- Move back to nursery
- Upgrade rand dependency to 0.7 and remove_dir_all to 0.6 and release new version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tempdir.