This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: shutil.copy2 fails with even with source network filesystem not supporting extended attributes
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: grebdioZ, hans-meine, iritkatriel
Priority: normal Keywords: patch

Created on 2019-05-08 07:43 by hans-meine, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8601 giampaolo.rodola, 2019-05-09 19:59
PR 13369 merged yingw787, 2019-05-16 23:38
Messages (2)
msg341857 - (view) Author: hans.meine (hans-meine) Date: 2019-05-08 07:43
This is a near duplicate of #24564, but has a slightly smaller scope.

We're using a CIFS filesystem and noticed that copying files *from* that filesystem to a local path with `shutil.copy2` does not work, but fails with an `OSError: [Errno 22] Invalid argument`.  This is because `copy2()` calls `copystat()` which contains

        names = os.listxattr(src, follow_symlinks=follow_symlinks)
    except OSError as e:
        if e.errno not in (errno.ENOTSUP, errno.ENODATA):

In our case with our CIFS mount, and in the NFS mounts mentioned in #24564, `os.listxattr()` raises an IOError with `errno.EINVAL` (22).  It was proposed in #24564 already to also ignore EINVAL, but with this issue I wanted to specifically propose to do so for the *reading* part.  While I also think that copy2() should work with both source *and* target filesystems not supporting xattr, our use case where the likelihood of data loss is zero (because there have never been xattr in the first place) is particularly annoying.
msg407935 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-12-07 14:07
This seems fixed, can it be closed?
Date User Action Args
2022-04-11 14:59:14adminsetgithub: 81031
2021-12-07 20:24:16eryksunsetstatus: open -> closed
type: behavior
resolution: fixed
stage: patch review -> resolved
2021-12-07 14:07:20iritkatrielsetnosy: + iritkatriel
messages: + msg407935
2019-05-16 23:38:55yingw787setpull_requests: + pull_request13280
2019-05-09 19:59:52giampaolo.rodolasetkeywords: + patch
stage: patch review
pull_requests: + pull_request13133
2019-05-08 08:25:42grebdioZsetnosy: + grebdioZ
2019-05-08 07:43:31hans-meinecreate