[Mailman-Developers] Re: tempfile bug or doc bug
Scott
scott@chronis.pobox.com
Tue, 13 Oct 1998 21:44:08 -0400
just read the tempfile.py source and saw the reason behind this:
tempfile.mktemp says
while ...
if not os.path.exists(filename):
return filename
the app says
fname = tempfile.mktemp()
fp = open(fname, "a+")
which doesn't exactly test whether the path exists and simultaneously
create a file ;)
perhaps a better warning should be added to mktemp docs?
scott
On Tue, Oct 13, 1998 at 08:27:28PM -0400, Scott wrote:
|
| the docs to tempfile state that:
|
| Warning: if a Unix process uses mktemp(), then calls fork() and both
| parent and child continue to use mktemp(), the processes will generate
| conflicting temporary names. To resolve this, the child process
| should assign None to template, to force recomputing the default on
| the next call to mktemp().
|
| So I have a unix process (part of mailman) that forks, and can fork
| quite a bit, the parent process *never* calls mktemp, but the child
| processes all do, and i have darn good evidence of generation of
| duplicate file names by mktemp() under these circumstances.
|
| i suggest that we either fix the docs to mktemp to include this
| circumstance as an exception or make mktemp() not generate duplicates
| under these circumstances.
|
| scott
|
|
|
|
|
|