-
Notifications
You must be signed in to change notification settings - Fork 114
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
feat: Support creating unreachable named tempfile on Linux #274
Comments
@Stebalien I agree with you that a generic cross-platform impl, I just want to provide a potentially better, though platform-dependent way of fixing the issue I know. I believe it would be best to add this to I'm not aware of anyway of achieving this in freeBSD, macOS or Windows, it would be great if there 's some way of achieving it on these OSes. |
We'd have to have an entirely new type. If we changed
We'd need some new temporary "persistable" temporary file type that's named on some platforms (where we have no choice) but not on others. I'll have to think about it, but I'm skeptical. Either:
|
That's true...Maybe I should write a dedicated crate for this. |
There's a better way to create tempfile that persists after writing is done on Linux using
O_TMPFILE
.While it only supports ext2, ext3, ext4, UDF, Minix, tmpfs
XFS (Linux 3.15), Btrfs (Linux 3.16), F2FS (Linux 3.16), ubifs (Linux 4.9), and needs either
CAP_DAC_READ_SEARCH
or a procfs to be mounted, it's still a pretty good solution.It prevents any other process from manipulating the file (except through procfs) until the caller process marked it as ready, and it removed the file on process exit even if the rust destructor is not called (e.g. panic during unwinding, calling
exit
directly)Originally posted by @NobodyXu in #273 (comment)
The text was updated successfully, but these errors were encountered: