Issue1783692

classification
Title: Implementation of tempfile with secure files
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey
Priority: normal Keywords: patch

Created on 2007-08-28.23:37:35 by pjenvey, last changed 2007-11-23.00:40:05 by pjenvey.

Files
File name Uploaded Description Edit Remove
tempfile_r3455.diff pjenvey, 2007-08-28.23:37:35 patch against trunk r3455
Messages
msg2842 (view) Author: Philip Jenvey (pjenvey) Date: 2007-08-28.23:37:35
Here is the tempfile module, actually from Python 2.5.1 (which doesn't offer that many changes over 2.3)

It's been updated to:

o make mkdtemp work (this supercedes ticket #1755344)

o make mkstemp work as much as it can. A secure file is created via java's File.createTempFile method (this essentially uses O_EXCL | O_CREAT under the covers, to ensure the file didn't already exist)

The problem with mkstemp is it returns a tuple (fd, filename). We obviously can't support returning a file descriptor, so we return None instead

o make [Named]TemporaryFile work with mkstemp without file descriptors

test_tempfile.py from 2.5.1 is also included. It required a couple changes to fix Jythonisms -- in particular the mkstemp test was disabled because it operates on a file descriptor. All tests pass
msg2843 (view) Author: Philip Jenvey (pjenvey) Date: 2007-08-28.23:48:59
The addition of mkdtemp also fixes test_shutil as pointed out in #1755344
msg2844 (view) Author: Philip Jenvey (pjenvey) Date: 2007-09-22.01:01:11
I'm holding off on this for a bit for an attempt to make file descriptors work (by faking them)
msg2845 (view) Author: Philip Jenvey (pjenvey) Date: 2007-11-23.00:40:05
added in r3712, now that we have file descriptors
History
Date User Action Args
2007-08-28 23:37:35pjenveycreate