]> granicus.if.org Git - python/commitdiff
Merged revisions 79301 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 22 Mar 2010 20:12:40 +0000 (20:12 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 22 Mar 2010 20:12:40 +0000 (20:12 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79301 | antoine.pitrou | 2010-03-22 21:11:09 +0100 (lun., 22 mars 2010) | 11 lines

  Merged revisions 79299 via svnmerge from
  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 dc36820dc9a77c893bf4c58ce0d81cabb9a88eb0..78504b9d3fb3b9e4cde4fdeebe6a025cfc7085e0 100644 (file)
@@ -9,6 +9,7 @@ import sys
 import stat
 from os.path import abspath
 import fnmatch
+import errno
 
 __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
            "copytree","move","rmtree","Error", "SpecialFileError"]
@@ -88,8 +89,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 1c329dd266212f8980aa2287d985ac89eb1b5a6b..f82919b43fd77a6092cf9d41d88b748857249f39 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,10 @@ Core and Builtins
 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 #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
 
 - Issue #6716/2: Backslash-replace error output in compilall.