]> granicus.if.org Git - python/commitdiff
Merged revisions 79299 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 22 Mar 2010 20:11:09 +0000 (20:11 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 22 Mar 2010 20:11:09 +0000 (20:11 +0000)
svn+ssh://pythondev@svn.python.org/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.
........

Lib/shutil.py
Misc/NEWS

index 2ddeb2a37301ee41dc5afe67ea54f1085a25b7ea..98b7ea0060f8ad1fd584a6780154fb6479a4bc45 100644 (file)
@@ -11,6 +11,7 @@ from os.path import abspath
 import fnmatch
 from warnings import warn
 import collections
+import errno
 
 try:
     from pwd import getpwnam
@@ -105,8 +106,11 @@ def copystat(src, dst):
     if hasattr(os, 'chmod'):
         os.chmod(dst, mode)
     if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
-        os.chflags(dst, st.st_flags)
-
+        try:
+            os.chflags(dst, st.st_flags)
+        except OSError as why:
+            if not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP:
+                raise
 
 def copy(src, dst):
     """Copy data and mode bits ("cp src dst").
index 8d4706da15313d17d8f938efa20f5e35b9b504c3..86eda39a617caf50205c7af9846fcaa3613f538b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -287,6 +287,10 @@ C-API
 Library
 -------
 
+- 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.
+
 - Issue #7860: platform.uname now reports the correct 'machine' type
   when Python is running in WOW64 mode on 64 bit Windows.