[ python-Bugs-1145257 ] shutil.copystat() may fail...

SourceForge.net noreply at sourceforge.net
Sat Mar 24 20:06:56 CET 2007


Bugs item #1145257, was opened at 2005-02-21 10:02
Message generated for change (Comment added) made by thomaswaldmann
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1145257&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Petr Prikryl (prikryl)
Assigned to: Nobody/Anonymous (nobody)
Summary: shutil.copystat() may fail...

Initial Comment:
Hi,

The shutil.copystat() may fail in case when the 
destination file has read-only attribute. It's because the 
implementation calls the os.utime() first and os.chmod() 
later. In Windows (I am not sure if also in Unix-based 
system), the os.utime() fails for read-only files. 

The implementation should ensure the read/write access 
by " try: os.chmod(dst, 0600)..." before calling the 
os.utime(). The file mode will be copied from the source 
file in the next step anyway. The simplistic test 
attached (Unix line ending used inside the tst.py zipped 
inside).

Petr

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

Comment By: Thomas Waldmann (thomaswaldmann)
Date: 2007-03-24 20:06

Message:
Logged In: YES 
user_id=100649
Originator: NO

See
http://sourceforge.net/tracker/index.php?func=detail&aid=1666318&group_id=5470&atid=105470
for another problem with utime() on win32/nt with directories.



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

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


More information about the Python-bugs-list mailing list