On Fri, 2009-02-20 at 11:00 -0600, Craig A. Berry wrote:
> On Jan 18, 2009, at 7:15 PM, Craig A. Berry wrote:
> 
> > On Jan 18, 2009, at 6:13 PM, TK Soh wrote:
> >
> >> On Sun, Jan 18, 2009 at 3:23 PM, Craig Berry <[email protected]>
> >> wrote:
> >>> After installing TortoiseHg awhile back, I noticed that attempting
> >>> to open certain network folders resulted in a hang in explorer and
> >>> I would have to kill it with Task Manager.
> >>
> >> Thanks for looking into this.
> >
> > Thanks for the reply.
> >
> >>>  The hang can be further narrowed to the call to os.path.isdir
> >>> with the following test program:
> >>>
> >>> ---- begin check_isdir.py -----
> >>> import os.path
> >>> import sys
> >>>
> >>> hgpath = os.path.join(sys.argv[1], ".hg")
> >>> print "Checking whether '" + hgpath + "' is a directory."
> >>> if os.path.isdir(hgpath):
> >>>  print "Yes, it is"
> >>> ----- end check_isdir.py -----
> >>>
> >>>
> >>> C:\work>python check_isdir.py \\mynode
> >>> Checking whether '\\mynode\.hg' is a directory.
> >>
> >> Does  '\\mynode\.hg' exist?
> >
> > No, not as far as I know, but of course part of the point is that I
> > don't have read access there to see.  Changing the filename from .hg
> > to any arbitrary string makes no difference.
> >
> >> Also, does it hang if you call
> >> os.path.isdir("\\mynode")?
> >
> > os.path.isdir("\\mynode") returns false immediately regardless of
> > whether it's a node where I have permissions to see what shares are
> > available.
> >
> >>> and here we hang again.  So, to summarize, calling os.path.isdir("\
> >>> \mynode\.hg") when I do not have read access to the root of \
> >>> \mynode causes a hang.  This may well be a Python bug as it's
> >>> actually getting hung in os.stat, which is called by os.path.isdir.
> >>>
> >>
> >> Hopefully not, else it will be hard to fix.
> 
> 
> Finally got back to this and put together a little patch, attached  
> below.  It just adds two lines to find_root that check for the  
> readability of path p before checking os.path.isdir(os.path.join(p,  
> ".hg")), and bails out if there is no access.  It doesn't seem like  
> this should be necessary if os.path.isdir were behaving, but it's  
> pretty non-intrusive and does solve the problem.

Pushed, thanks.

--
Steve


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to