[PATCH] tags: don't allow environment errors to be raised from _writetagscache
Matt Mackall
mpm at selenic.com
Fri Jun 17 19:22:36 UTC 2011
On Thu, 2011-06-16 at 15:26 -0500, Steve Borho wrote:
> # HG changeset patch
> # User Steve Borho <steve at borho.org>
> # Date 1308255977 18000
> # Node ID 4196f029b6b4a1f05dd0eac9a9df9d19424af4cc
> # Parent ba3c36cea66e7a9cc0bb274b7f7b73ad65212df7
> tags: don't allow environment errors to be raised from _writetagscache
>
> See https://bitbucket.org/tortoisehg/thg/issue/719
>
> diff -r ba3c36cea66e -r 4196f029b6b4 mercurial/tags.py
> --- a/mercurial/tags.py Thu Jun 16 14:33:06 2011 -0500
> +++ b/mercurial/tags.py Thu Jun 16 15:26:17 2011 -0500
> @@ -286,4 +286,7 @@
> for (name, (node, hist)) in cachetags.iteritems():
> cachefile.write("%s %s\n" % (hex(node), name))
>
> - cachefile.rename()
> + try:
> + cachefile.rename()
> + except (OSError, IOError):
> + pass
I tend to agree we shouldn't ever fail on reading and writing these
caches.
Generally, we won't hit this on Unix because we if we can create a temp
file in a directory, we can also overwrite a file in that directory. But
there are exceptions:
- directories with the 'sticky bit' set
- non-traditional security regimes (ACLs, SELinux, etc.)
- non-native filesystems
I think if we want to do something about the visibility of these silent
failures, we should add some ui.debug messages here or similar.
So... queued.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list