You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
@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 SpooledTempfile, which enable us to fallback to generic impl, or add a new type for this.
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.
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: