[ python-Bugs-809846 ] distutils/bdistwin32 doesn't clean up RO files properly

SourceForge.net noreply at sourceforge.net
Fri Jul 2 15:28:21 EDT 2004


Bugs item #809846, was opened at 2003-09-20 19:49
Message generated for change (Comment added) made by theller
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=809846&group_id=5470

Category: Distutils
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason R. Coombs (jaraco)
Assigned to: Nobody/Anonymous (nobody)
Summary: distutils/bdistwin32 doesn't clean up RO files properly

Initial Comment:
Using Windows XP SP1, Python 2.3, Win32Extensions 
build 159:

I recently added some data_files to my setup script as 
so:

setup( ..., data_files = [ ( 'files', ['file.txt'] ) ] )

and when I ran my setup script with the build 
option 'bdist_wininst', I get the following error at the 
cleanup stage of the build:

removing 'build\bdist.win32\wininst' (and everything 
under it)
error removing build\bdist.win32\wininst: 
build\bdist.win32\wininst\DATA\file.txt: Permission denied

The error is followed by more errors attempting to 
remove the parent directories because they're not 
empty.

The reason permission is denied is because the file is 
marked as read-only (via file attributes, not file 
permissions).  The source file is marked as read-only in 
this case because it is being taken from a Visual 
SourceSafe project which uses the RO attribute to 
indicate check-out status.  If I check out the file or 
remove the RO flag, the script runs without errors.

Regardless of the reason for a file being marked RO, the 
temporary files in wininst\DATA should not be copied 
with their RO attribute or when cleaning up, the routine 
should delete the files regardless of RO status.

I'm not sure what is the best way to approach this 
problem, but I will be willing to provide input or even 
code patches.  I need input from the community, 
however, on how to best fix this issue.

----------------------------------------------------------------------

>Comment By: Thomas Heller (theller)
Date: 2004-07-02 21:28

Message:
Logged In: YES 
user_id=11105

The sdist command, for example, has the same problem - so
it's not bdist_wininst specific.
py2exe's build_exe.py module has a force_remove_tree()
variant of distutils' dir_util.remove_tree() function which
could serve as a possible example how to force removal. 
(This function was contributed by a py2exe-user, but I don't
remember who it was.)

For distutils, the remove_tree() function could grow a
'force' parameter, and that could be used in the cleanup
phase - it should be safe to remove the temporary build tree
we have created, and that wouldn't change the read-only bit
in the installed file(s).

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2004-07-02 02:46

Message:
Logged In: YES 
user_id=14198

Do other distutils commands suffer the same problem cleaning
their temp files?  If so, the problem is a little more
delicate (special-casing these attributes on Linux, for
example, would be non-trivial), but if only bdist_win32 has
the problem we could be more brutal (there are very few
attributes we need to worry about!).

The other potential problem is that people may actually want
this r/o attribute to end up on the installed file - which
means the installer and uninstaller need to deal with it too.

So I too am unsure what the "correct" thing to do is.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=809846&group_id=5470



More information about the Python-bugs-list mailing list