Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shutil.copy2 fails with even with source network filesystem not supporting extended attributes #81031

Closed
hans-meine mannequin opened this issue May 8, 2019 · 2 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@hans-meine
Copy link
Mannequin

hans-meine mannequin commented May 8, 2019

BPO 36850
Nosy @iritkatriel
PRs
  • bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() #8601
  • bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() #13369
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-12-07.20:24:16.226>
    created_at = <Date 2019-05-08.07:43:31.727>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'shutil.copy2 fails with even with source network filesystem not supporting extended attributes'
    updated_at = <Date 2021-12-07.20:24:16.225>
    user = 'https://bugs.python.org/hans-meine'

    bugs.python.org fields:

    activity = <Date 2021-12-07.20:24:16.225>
    actor = 'eryksun'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-07.20:24:16.226>
    closer = 'eryksun'
    components = ['Library (Lib)']
    creation = <Date 2019-05-08.07:43:31.727>
    creator = 'hans-meine'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36850
    keywords = ['patch']
    message_count = 2.0
    messages = ['341857', '407935']
    nosy_count = 3.0
    nosy_names = ['hans-meine', 'grebdioZ', 'iritkatriel']
    pr_nums = ['8601', '13369']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36850'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @hans-meine
    Copy link
    Mannequin Author

    hans-meine mannequin commented May 8, 2019

    This is a near duplicate of bpo-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

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

    In our case with our CIFS mount, and in the NFS mounts mentioned in bpo-24564, os.listxattr() raises an IOError with errno.EINVAL (22). It was proposed in bpo-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.

    @hans-meine hans-meine mannequin added 3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir labels May 8, 2019
    @iritkatriel
    Copy link
    Member

    This seems fixed, can it be closed?

    @eryksun eryksun closed this as completed Dec 7, 2021
    @eryksun eryksun added the type-bug An unexpected behavior, bug, or error label Dec 7, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants