Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdist_wininst doesn't clean up read-only files in build dir #39262

Closed
jaraco opened this issue Sep 20, 2003 · 5 comments
Closed

bdist_wininst doesn't clean up read-only files in build dir #39262

jaraco opened this issue Sep 20, 2003 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jaraco
Copy link
Member

jaraco commented Sep 20, 2003

BPO 809846
Nosy @mhammond, @theller, @jaraco, @vstinner, @tarekziade, @merwok, @dstufft

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/tarekziade'
closed_at = <Date 2021-01-11.12:50:49.581>
created_at = <Date 2003-09-20.17:49:39.000>
labels = ['type-bug', 'library']
title = "bdist_wininst doesn't clean up read-only files in build dir"
updated_at = <Date 2021-01-11.12:50:49.578>
user = 'https://github.com/jaraco'

bugs.python.org fields:

activity = <Date 2021-01-11.12:50:49.578>
actor = 'vstinner'
assignee = 'tarek'
closed = True
closed_date = <Date 2021-01-11.12:50:49.581>
closer = 'vstinner'
components = ['Distutils']
creation = <Date 2003-09-20.17:49:39.000>
creator = 'jaraco'
dependencies = []
files = []
hgrepos = []
issue_num = 809846
keywords = []
message_count = 5.0
messages = ['60389', '60390', '60391', '227791', '384815']
nosy_count = 7.0
nosy_names = ['mhammond', 'theller', 'jaraco', 'vstinner', 'tarek', 'eric.araujo', 'dstufft']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue809846'
versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

@jaraco
Copy link
Member Author

jaraco commented Sep 20, 2003

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.

@jaraco jaraco added stdlib Python modules in the Lib dir labels Sep 20, 2003
@mhammond
Copy link
Contributor

mhammond commented Jul 2, 2004

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.

@theller
Copy link

theller commented Jul 2, 2004

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).

@merwok merwok added the type-bug An unexpected behavior, bug, or error label Jul 28, 2010
@merwok merwok added the type-bug An unexpected behavior, bug, or error label Jul 28, 2010
@merwok merwok changed the title distutils/bdistwin32 doesn't clean up RO files properly bdist_wininst doesn't clean up read-only files in build dir Aug 18, 2010
@merwok merwok changed the title distutils/bdistwin32 doesn't clean up RO files properly bdist_wininst doesn't clean up read-only files in build dir Aug 18, 2010
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Sep 29, 2014

I understand from the experts list that tarek is no longer maintaining distutils but I can't change the "assigned to" field. As a matter of interest there are another 67 issues with tarek assigned.

@vstinner
Copy link
Member

The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants