rmtree doesn't remove read-only files on Windows

RESOLVED FIXED in Thunderbird 3.0b3

Status

RESOLVED FIXED
10 years ago
9 years ago

People

(Reporter: sid0, Assigned: sid0)

Tracking

Trunk
Thunderbird 3.0b3
x86
Windows 7

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

10 years ago
Created attachment 383541 [details] [diff] [review]
patch

rmtree doesn't cope with read-only files on Windows, so do it ourselves.
Attachment #383541 - Flags: review?(bugzilla)
(Assignee)

Updated

10 years ago
Assignee: nobody → sid.bugzilla
Status: NEW → ASSIGNED

Comment 1

10 years ago
I've been running with this patch for a while w/o problems, and when I accidentally unapplied it, things went south right away. So I think this is worth getting in so that we can run mozmill tests on windows...
I've been hesitant with getting round to this. This bit just makes me think twice:

+# From pathutils <http://www.voidspace.org.uk/python/pathutils.html>
+# by Michael Foord
+# rmtreeing read-only files fails on Windows

Looking at this again, that has a BSD license and this is test code only but with an MPL license header. I believe the two are compatible, but this makes me think twice. cc'ing gerv who I'm sure will have a better idea if it is ok just to copy/paste this code than me.
There's only six actual lines of code there, and it debatable how many different ways there are to do what you want, and therefore whether there's a copyright interest.

The easiest thing to do would be to email the developer: fuzzyman@voidspace.org.uk, and ask for permission to include it under the existing terms for the file. 

Gerv

Comment 4

9 years ago
You have my permission (in as much as you needed it in the first place...) to use, modify and relicense those 6 lines of code. :-)

I'm on holiday at the moment and won't get a chance to look at the actual bug report for a few days. If the problem you are trying to solve is genuinely just removing read-only files on Windows with shutil.rmtree then the onerror handler should work fine for this purpose.
Thanks, Michael :-)

Gerv
Comment on attachment 383541 [details] [diff] [review]
patch

>+# From pathutils <http://www.voidspace.org.uk/python/pathutils.html>
>+# by Michael Foord
>+# rmtreeing read-only files fails on Windows

Based on Michael's comment, I think we can drop these lines and add Michael to the contributors list in the license header.

Thanks Michael.

r=Standard8.
Attachment #383541 - Flags: review?(bugzilla) → review+
(Assignee)

Comment 7

9 years ago
http://hg.mozilla.org/comm-central/rev/8bcda0062dae
Status: ASSIGNED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Assignee)

Updated

9 years ago
Target Milestone: --- → Thunderbird 3.0b3
You need to log in before you can comment on or make changes to this bug.