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: Add O_TMPFILE to os module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, jcea, jwilk, pitrou, python-dev, socketpair, tshepang, vstinner
Priority: normal Keywords: easy

Created on 2013-08-06 19:43 by christian.heimes, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg194569 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-08-06 19:43
Linux 3.11 gets a new flag for open():

Quote from http://lwn.net/Articles/557314/
---
The new O_TMPFILE option to the open() and openat() system calls allows filesystems to optimize the creation of temporary files — files which need not be visible in the filesystem. When O_TMPFILE is present, the provided pathname is only used to locate the containing directory (and thus the filesystem where the temporary file should be). So, among other things, programs using O_TMPFILE should have fewer concerns about vulnerabilities resulting from symbolic link attacks.
---

Tasks:

- add O_TEMPFILE to posixmodule.c
- use O_TEMPFILE in tempfile module when it's supported by the current kernel
msg194580 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-06 21:14
> - use O_TEMPFILE in tempfile module when it's supported by the current 
> kernel

I assume this would only be done in TemporaryFile()?
msg194769 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-09 20:25
> use O_TEMPFILE in tempfile module when it's supported by the current kernel

How do you detect that a kernel does not support the flag? Try to use the flag and handle the error?
msg195320 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-16 12:38
New changeset f6034602410c by Christian Heimes in branch 'default':
Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel
http://hg.python.org/cpython/rev/f6034602410c

New changeset 815b7bb3b08d by Christian Heimes in branch 'default':
Issue #18673: Add versionchanged to docs
http://hg.python.org/cpython/rev/815b7bb3b08d
msg195322 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-08-16 12:56
I have added O_TMPFILE to the os module.

I like to hold off with the actual use of O_TMPFILE in tempfile until Python 3.5. The feature is too new and I don't have any way to test it. Some people have reported file system corruption in 3.11-rc4, too.
msg213093 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-10 22:11
New changeset 0525f7268067 by R David Murray in branch 'default':
whatsnew: os.open O_TMPFILE (#18673).
http://hg.python.org/cpython/rev/0525f7268067
msg253194 - (view) Author: Марк Коренберг (socketpair) * Date: 2015-10-19 21:18
Just for link. Issue #21515 — tempfile use this functionality now.
History
Date User Action Args
2022-04-11 14:57:49adminsetgithub: 62873
2015-10-19 21:18:27socketpairsetnosy: + socketpair
messages: + msg253194
2014-03-10 22:11:18python-devsetmessages: + msg213093
2014-01-30 14:49:19jwilksetnosy: + jwilk
2013-08-16 12:56:28christian.heimessetstatus: open -> closed
title: Add and use O_TMPFILE for Linux 3.11 -> Add O_TMPFILE to os module
messages: + msg195322

resolution: fixed
stage: needs patch -> resolved
2013-08-16 12:38:01python-devsetnosy: + python-dev
messages: + msg195320
2013-08-10 01:58:25tshepangsetnosy: + tshepang
2013-08-09 20:25:45vstinnersetnosy: + vstinner
messages: + msg194769
2013-08-08 14:02:21jceasetnosy: + jcea
2013-08-06 21:14:50pitrousetnosy: + pitrou
messages: + msg194580

components: - Extension Modules
keywords: + easy
2013-08-06 19:43:40christian.heimescreate