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

copy_file raises FileNotFoundError when src is a directory #89397

Closed
AlexGrund mannequin opened this issue Sep 17, 2021 · 8 comments
Closed

copy_file raises FileNotFoundError when src is a directory #89397

AlexGrund mannequin opened this issue Sep 17, 2021 · 8 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir

Comments

@AlexGrund
Copy link
Mannequin

AlexGrund mannequin commented Sep 17, 2021

BPO 45234
Nosy @gpshead, @ambv, @pablogsal, @miss-islington, @Fidget-Spinner, @akulakov
PRs
  • bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() #28421
  • [3.9] bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) #28507
  • [3.10] bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) #28508
  • 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-09-22.22:42:32.902>
    created_at = <Date 2021-09-17.14:04:17.038>
    labels = ['library', '3.9', '3.10', '3.11']
    title = 'copy_file raises FileNotFoundError when src is a directory'
    updated_at = <Date 2021-10-04.19:18:41.619>
    user = 'https://bugs.python.org/AlexGrund'

    bugs.python.org fields:

    activity = <Date 2021-10-04.19:18:41.619>
    actor = 'pablogsal'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-22.22:42:32.902>
    closer = 'pablogsal'
    components = ['Library (Lib)']
    creation = <Date 2021-09-17.14:04:17.038>
    creator = 'Alex Grund'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45234
    keywords = ['patch']
    message_count = 8.0
    messages = ['402057', '402061', '402374', '402387', '402389', '402395', '402473', '403149']
    nosy_count = 7.0
    nosy_names = ['gregory.p.smith', 'lukasz.langa', 'pablogsal', 'miss-islington', 'Alex Grund', 'kj', 'andrei.avk']
    pr_nums = ['28421', '28507', '28508']
    priority = None
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45234'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @AlexGrund
    Copy link
    Mannequin Author

    AlexGrund mannequin commented Sep 17, 2021

    After https://bugs.python.org/issue43219 was resolved the function now shows faulty behavior when the source is a directory:

    copy_file('/path/to/dir', '/target') throws a FileNotFoundError while previously it was a IsADirectoryError which is clearly correct.

    See #27049 (comment)

    @AlexGrund AlexGrund mannequin added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir labels Sep 17, 2021
    @akulakov
    Copy link
    Contributor

    Alex: thanks for the report!

    I've added a PR that should fix this.

    @ambv
    Copy link
    Contributor

    ambv commented Sep 21, 2021

    New changeset b7eac52 by andrei kulakov in branch 'main':
    bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421)
    b7eac52

    @ambv
    Copy link
    Contributor

    ambv commented Sep 21, 2021

    New changeset 41d48bc by Miss Islington (bot) in branch '3.10':
    bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28508)
    41d48bc

    @ambv
    Copy link
    Contributor

    ambv commented Sep 21, 2021

    Pablo, this regression was fixed in #72694 which should go into 3.10.0.

    @ambv
    Copy link
    Contributor

    ambv commented Sep 21, 2021

    New changeset 09390c8 by Miss Islington (bot) in branch '3.9':
    bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28507)
    09390c8

    @pablogsal
    Copy link
    Member

    Cherry-picked!

    @pablogsal
    Copy link
    Member

    New changeset e0b61b2 by Pablo Galindo (Miss Islington (bot)) in branch '3.10':
    bpo-45234: Fix FileNotFound exception raised instead of IsADirectoryError in shutil.copyfile() (GH-28421) (GH-28508)
    e0b61b2

    @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.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants