[issue16860] Use O_CLOEXEC in the tempfile module

2013-03-03 Thread Charles-François Natali
Charles-François Natali added the comment: Closing. Let's keep O_NOFOLLOW: it doesn't buy much, and might be useful for some arcane reason on some weird platform... -- resolution: - fixed stage: - committed/rejected status: open - closed ___

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-12 Thread STINNER Victor
STINNER Victor added the comment: I'll wait a little before removing O_NOFOLLOW I don't know this flag. What is its effect of the directory part of the path? Does it change anything if the directory is a symbolic link? -- ___ Python tracker

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-12 Thread Charles-François Natali
Charles-François Natali added the comment: I'll wait a little before removing O_NOFOLLOW I don't know this flag. What is its effect of the directory part of the path? Does it change anything if the directory is a symbolic link? No, it only has an effect if the target file is a symlink.

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-12 Thread STINNER Victor
STINNER Victor added the comment: No, it only has an effect if the target file is a symlink. Oh ok, so O_NOFOLLOW is useless when O_EXCL is used. It is safe to remove it, but please only modify Python 3.4 (just in case...). -- ___ Python tracker

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread STINNER Victor
New submission from STINNER Victor: os.O_CLOEXEC has been added to Python 3.3. This flag solves a race condition if the process is forked between open() and a call to fcntl() to set the FD_CLOEXEC flag. The following patch written by neologix should fix this issue: diff --git

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread STINNER Victor
STINNER Victor added the comment: See also #16850 which proposes to expose O_CLOEXEC feature in the open() builtin function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16860 ___

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread Charles-François Natali
Charles-François Natali added the comment: Here's the patch. It also removes O_NOFOLLOW, which is basically useless (if the file is created with O_CREAT|O_EXCL, then by definition it's not a symlink). -- keywords: +needs review, patch type: - behavior Added file:

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread STINNER Victor
STINNER Victor added the comment: Here's the patch. _set_cloexec() is still called whereas it is useless if the OS supports O_CLOEXEC... But the call must be kept because Linux 2.6.23 just ignores O_CLOEXEC: we would have to check _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) _fcntl.FD_CLOEXEC to

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 64883c614c88 by Charles-François Natali in branch 'default': Issue #16860: In tempfile, use O_CLOEXEC when available to set the http://hg.python.org/cpython/rev/64883c614c88 -- nosy: +python-dev ___

[issue16860] Use O_CLOEXEC in the tempfile module

2013-01-04 Thread Charles-François Natali
Charles-François Natali added the comment: I've committed it only to default, since it's not really a bug, but rather an improvement (if we did consider this a security bug then it should also be backported to 2.7, 3.1, etc). I'll wait a little before removing O_NOFOLLOW: I'm 99% sure it's