[PATCH 05 of 11] cmdutil: securely rename a to A on disk
Martin Geisler
mg at lazybytes.net
Tue Aug 11 06:41:14 CDT 2009
Simon Heimberg <simohe at besonet.ch> writes:
> def temprename(src):
> """renames a file to a temporary name
> the new name is returned"""
> temp = tempname.mktemp(suffix='tmpmv', dir=os.path.dirname(src))
> os.rename(src, temp)
> return temp
>
> Is there a reason why tempname.mktemp was not used?
Yes, it is explained in the big comment just above the tempname function
you moved :-)
Short summary: an eager antivirus program might open the file created by
mktemp, and thereby lock the file under Windows.
So please move this rather important comment too, if you move the
function it applies to.
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090811/f1e9197d/attachment.pgp
More information about the Mercurial-devel
mailing list