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

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
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

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1145257&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to