GithubHelp home page GithubHelp logo

Comments (16)

Stebalien avatar Stebalien commented on September 25, 2024 1

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.

alexcrichton avatar alexcrichton commented on September 25, 2024 1

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.

KodrAus avatar KodrAus commented on September 25, 2024 1

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.

alexcrichton avatar alexcrichton commented on September 25, 2024

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.

oconnor663 avatar oconnor663 commented on September 25, 2024

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.

alexcrichton avatar alexcrichton commented on September 25, 2024

Sounds plausible to me!

from tempdir.

opilar avatar opilar commented on September 25, 2024

If we want to merge tempdir and tempfile would it be better to call it temp crate?

from tempdir.

KodrAus avatar KodrAus commented on September 25, 2024

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.

oconnor663 avatar oconnor663 commented on September 25, 2024

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.

aturon avatar aturon commented on September 25, 2024

cc me

from tempdir.

Stebalien avatar Stebalien commented on September 25, 2024

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.

KodrAus avatar KodrAus commented on September 25, 2024

I can think of a few paths forward:

  1. Do nothing
  2. Deprecate tempdir or tempfile and merge them into a single crate (in this case I think it's worth pointing out that tempfile is stable and tempdir isn't, but tempdir has more dependent crates)
  3. Add some docs/examples to tempdir and tempfile but keep the crates separate
  4. Keep the crates separate, but make another crate, temp or fsutil, or whatever that re-exports or wraps bits of tempdir and tempfile, 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.

alexcrichton avatar alexcrichton commented on September 25, 2024

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.

KodrAus avatar KodrAus commented on September 25, 2024

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.

KodrAus avatar KodrAus commented on September 25, 2024

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.

KodrAus avatar KodrAus commented on September 25, 2024

Sure, I'll get the ball rolling on this 👍

from tempdir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.