On 12.06.2009 11:46, Adrian Buehlmann wrote:
> How nice.
> 
> in thgtaskbar.exe.log:
> 
> Exception in thread Thread-2:
> Traceback (most recent call last):
>   File "threading.pyc", line 486, in __bootstrap_inner
>   File "thgtaskbar.py", line 335, in run
>   File "thgtaskbar.py", line 316, in dispatch
>   File "thgtaskbar.py", line 296, in update
>   File "thgtaskbar.py", line 242, in update_batch
>   File "thgutil\shlib.pyc", line 95, in update_thgstatus
>   File "mercurial\util.pyc", line 840, in __call__
>   File "mercurial\util.pyc", line 763, in __init__
>   File "mercurial\util.pyc", line 715, in mktempcopy
>   File "tempfile.pyc", line 302, in mkstemp
>   File "tempfile.pyc", line 236, in _mkstemp_inner
> OSError: [Errno 13] Permission denied: 'W:\\xxx3\\.hg\\.thgstatus-j-ikfg'
> 
> Exception exceptions.AttributeError: "'NoneType' object has no attribute 
> 'closed'" in <bound method atomictempfile.__del__ of 
> <mercurial.util.atomictempfile object at 0x010BECF0>> ignored
>

Repo W:\xxx3 used here was a readonly tree (I did that for testing a few
days ago. To see what happens with repos on readonly volumes).

There are two problems here:

(1)
With the version of Mercurial used in *this* nightly (d19ab9a56bf4), we
now seem to get an OSError instead of an IOError (as previously tested).
So we need:

diff --git a/thgtaskbar.py b/thgtaskbar.py
--- a/thgtaskbar.py
+++ b/thgtaskbar.py
@@ -242,8 +242,8 @@ def update_batch(batch):
                 shlib.update_thgstatus(_ui, r, wait=False)
                 shlib.shell_notify([r])
                 logger.msg('Updated ' + r)
-            except IOError:
-                print "IOError on updating %s (check permissions)" % r
+            except (IOError, OSError):
+                print "IOError or OSError on updating %s (check permissions)" 
% r
                 logger.msg('Failed updating %s (check permissions)' % r)
                 failedroots.add(r)
         notifypaths -= failedroots

I will send a patch for this.

(2)
There is a second exception (AttributeError) that was triggered when
mercurial.util.atomictempfile tried to clean up after the first
exception. This second exception was ignored.

The second exception reveals a bug in mercurial.util.atomictempfile
as there is no 'closed' attribute if mktempcopy fails in 
atomictempfile.__init__.
So if I just apply change (1) I still have

Exception exceptions.AttributeError: "'NoneType' object has no attribute 
'closed'" in
<bound method atomictempfile.__del__ of <mercurial.util.atomictempfile object at
0x00CCF370>> ignored

left in error output, but at least thgtaskbar.exe does not crash any more in 
this
case.

Fixing (2) probably needs something like:


diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -772,12 +772,11 @@ class atomictempfile(object):
             rename(self.temp, localpath(self.__name))

     def __del__(self):
-        if not self.closed:
+        if self._fp and not self.closed:
             try:
                 os.unlink(self.temp)
             except: pass
-            if self._fp:
-                self._fp.close()
+            self._fp.close()

 def makedirs(name, mode=None):
     """recursive directory creation with parent mode inheritance"""


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to