[PATCH 2 of 2] util/rename: update to work better with virus scanners on Windows

Sune Foldager cryo at cyanite.org
Tue Feb 17 01:53:40 CST 2009


Matt Mackall wrote:

> [complicated patch]

Hmm, hardly complicated?, but it breaks down in two parts: a) don't rely on
exceptions for something that always happens on windows (this makes it a bit
more complicated), and b) use mktemp and not mkstemp (this reduces
complication by 2 lines).

> I queued up this patch yesterday, is there any reason this won't work?
> rename: simplify forced renaming

No, it'll work I bet. But it kinda sucks from an aesthetic point of view,
honestly :-p. I mean, no offense, but it takes a weird scenario "we need a
file name, so let's make a file and get rid of it right away" and turns it
into an even weirder one "we need a file name, so let's make a file, get rid
of it and use its former name to make something". It hurts my eyes and sense
of code-aesthetics ;-).

My patch, apart from the complicated part which we could drop, brings the
scenario to "we need a file name, so let's make one". And we could throw in
our own mktemp if needed (yes it's already there, but the deprecation issue
and all). Even just an ad-hoc in-line one-liner to construct a file name
would be preferred over this use of mkstemp IMHO. But of course all this is
not my call, but I implore you sincerely to chose quality over pragmatism
here :-) (...and so should Python instead of deprecating mktemp.)

If we could at least do it any other way than making pointless files, even
if it's not the way I do it in my patch.

-- 
Sune Foldager




More information about the Mercurial-devel mailing list