[PATCH] mkstemp: make sure we don't try to unlink files which were not created

Giorgos Keramidas keramida at ceid.upatras.gr
Wed May 2 08:05:40 CDT 2007


On 2007-05-02 16:02, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> # HG changeset patch
> # User Giorgos Keramidas <keramida at ceid.upatras.gr>
> # Date 1178110924 -10800
> # Node ID 52803b0fdf2e57f76b80ddc00c87809633b5b677
> # Parent  15289406f89c3866e5a1e1ce7d666a7555a23631
> mkstemp: make sure we don't try to unlink files which were not created
> 
> The tempfile.mkstemp() call may fail (i.e. because a file system is
> mounted as readonly after some file system errors).  In this case, we
> should not try to call os.unlink() or file.close() in finally: blocks.
> 
> Inspired by:	trace posted by 'mathieu' on #mercurial

This only fixes *some* of the places where tempfile.mkstemp() is used.

I'm not 100% sure about the changes, so any comments and suggestions to
make this better, are welcome :)

The backtrace mentioned in the commit log is currently available online
at rafb.net <http://rafb.net/p/HJm7fV19.html>



More information about the Mercurial-devel mailing list