This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Support linking unnamed temp files into filesystem on Linux
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: WGH
Priority: normal Keywords:

Created on 2021-09-12 23:45 by WGH, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg401676 - (view) Author: WGH (WGH) Date: 2021-09-12 23:45
In Linux, it's possible to create an unnamed temporary file in a specified directory by using open with O_TMPFILE flag (as if it was created with random name and immediately unlinked, but atomically). Unless O_EXCL is specified, the file can be then linked into filesystem using linkat syscall.

It would be neat if it was possible in Python.

There're a couple of things missing:

1) tempfile.TemporaryFile creates a file with O_EXCL flag, which prevents linking it into filesystem.

2) linkat must be called with AT_SYMLINK_FOLLOW flag (otherwise EXDEV is returned), which is broken right now (#37612)
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89341
2021-09-18 01:22:30terry.reedysettitle: Support for linking unnamed temporary files into filesystem on Linux -> Support linking unnamed temp files into filesystem on Linux
stage: test needed
versions: + Python 3.11
2021-09-12 23:45:46WGHcreate