mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
installations are present, by always unlinking the destination file before copying to it. Without the unlink(), the copied file remains owned by its previous UID, causing the subsequent chmod() to fail. Bugfix candidate, though it may cause changes on platforms where file ownership behaves differently.
This commit is contained in:
parent
8cb6540652
commit
3b388ec8b3
1 changed files with 7 additions and 0 deletions
|
@ -36,6 +36,13 @@ def _copy_file_contents (src, dst, buffer_size=16*1024):
|
|||
raise DistutilsFileError, \
|
||||
"could not open '%s': %s" % (src, errstr)
|
||||
|
||||
if os.path.exists(dst):
|
||||
try:
|
||||
os.unlink(dst)
|
||||
except os.error, (errno, errstr):
|
||||
raise DistutilsFileError, \
|
||||
"could not delete '%s': %s" % (dst, errstr)
|
||||
|
||||
try:
|
||||
fdst = open(dst, 'wb')
|
||||
except os.error, (errno, errstr):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue