Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 910bd51

Browse files
committed
Merged revisions 79299 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r79299 | antoine.pitrou | 2010-03-22 20:59:46 +0100 (lun., 22 mars 2010) | 5 lines Issue #7512: shutil.copystat() could raise an OSError when the filesystem didn't support chflags() (for example ZFS under FreeBSD). The error is now silenced. ........
1 parent ca2edce commit 910bd51

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Lib/shutil.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import fnmatch
1212
from warnings import warn
1313
import collections
14+
import errno
1415

1516
try:
1617
from pwd import getpwnam
@@ -105,8 +106,11 @@ def copystat(src, dst):
105106
if hasattr(os, 'chmod'):
106107
os.chmod(dst, mode)
107108
if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
108-
os.chflags(dst, st.st_flags)
109-
109+
try:
110+
os.chflags(dst, st.st_flags)
111+
except OSError as why:
112+
if not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP:
113+
raise
110114

111115
def copy(src, dst):
112116
"""Copy data and mode bits ("cp src dst").

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ C-API
287287
Library
288288
-------
289289

290+
- Issue #7512: shutil.copystat() could raise an OSError when the filesystem
291+
didn't support chflags() (for example ZFS under FreeBSD). The error is
292+
now silenced.
293+
290294
- Issue #7860: platform.uname now reports the correct 'machine' type
291295
when Python is running in WOW64 mode on 64 bit Windows.
292296

0 commit comments

Comments
 (0)