[Buildbot-devel] Exception when performing full SVN update on windows slave

Dustin J. Mitchell dustin at v.igoro.us
Mon Dec 12 04:25:55 UTC 2011


On Thu, Dec 8, 2011 at 4:55 AM, Jean-Marc Dressler
<buildbot at jmd.fastmail.fm> wrote:
> First I want to mention that I have tried to report this problem through trac, but my ticket always gets rejected by the trac spam filter.

The track spam filters have some false positives -- usually caused by
things that look like email addresses -- but have gone a long way to
remove an awful rash of spam tickets and wiki edits.  This is about
the limit of my Trac skills, but I'm happy to hand the reins of the
Trac instance to someone who is willing to do a better job maintaining
it long-term.

> (1) The first issue is that the error message (`strerror`) returned with the `WindowsError` exception can contain non ascii characters (on my french windows XP for example), which causes an uncaught exception.

Is e.strerror always utf-8?  If not, is there a way to tell what
encoding it's using?

> (2) But the main issue is that the rmdirRecursive() function does not check if its argument is a file or not. When it is a file a call to os.listdir fails which triggers the exception with the unicode character problem described in (1).

Your fix addresses a corner case, where the top-level rmdirRecursive
is not given a directory as its argument.

I've merged an even simpler version:

diff --git a/slave/buildslave/commands/utils.py
b/slave/buildslave/commands/utils.py
index 21fd91f..a4e0bcf 100644
--- a/slave/buildslave/commands/utils.py
+++ b/slave/buildslave/commands/utils.py
@@ -49,7 +49,7 @@ if runtime.platformType  == 'win32':
         if not os.path.exists(dir):
             return

-        if os.path.islink(dir):
+        if os.path.islink(dir) or os.path.isfile(dir):
             os.remove(dir)
             return

Dustin




More information about the devel mailing list