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

Wrong OSError message from os.rename() when dst is a non-empty directory #64292

Closed
jderose mannequin opened this issue Dec 29, 2013 · 3 comments
Closed

Wrong OSError message from os.rename() when dst is a non-empty directory #64292

jderose mannequin opened this issue Dec 29, 2013 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jderose
Copy link
Mannequin

jderose mannequin commented Dec 29, 2013

BPO 20093
Nosy @doko42, @vstinner, @jwilk, @mitya57
Files
  • test_os_rename.py: Test case
  • 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 2014-07-26.16:18:39.687>
    created_at = <Date 2013-12-29.00:50:27.534>
    labels = ['type-bug', 'library']
    title = 'Wrong OSError message from os.rename() when dst is a non-empty directory'
    updated_at = <Date 2014-07-26.16:18:39.654>
    user = 'https://bugs.python.org/jderose'

    bugs.python.org fields:

    activity = <Date 2014-07-26.16:18:39.654>
    actor = 'doko'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-07-26.16:18:39.687>
    closer = 'doko'
    components = ['Library (Lib)']
    creation = <Date 2013-12-29.00:50:27.534>
    creator = 'jderose'
    dependencies = []
    files = ['33285']
    hgrepos = []
    issue_num = 20093
    keywords = []
    message_count = 3.0
    messages = ['207058', '207077', '224072']
    nosy_count = 5.0
    nosy_names = ['doko', 'vstinner', 'jwilk', 'jderose', 'mitya57']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue20093'
    versions = ['Python 3.4']

    @jderose
    Copy link
    Mannequin Author

    jderose mannequin commented Dec 29, 2013

    Under Python 3.3, if renaming a directory with os.rename() when the destination is an existing, non-empty directory, like this:

    os.rename('/tmp/foo', '/tmp/bar')

    You'll get an OSError with a message like this:

    OSError: [Errno 39] Directory not empty: '/tmp/bar'

    However, in the current Python 3.4.0b1 package in Ubuntu Trusty, this error message will contain the source directory name instead of the destination directory name, like this:

    OSError: [Errno 39] Directory not empty: '/tmp/foo'

    I've attached a test case, which also covers renaming directories relative to an open directory descriptor. This test case works on Python 3.3, fails on Python 3.4 Beta1.

    @jderose jderose mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 29, 2013
    @mitya57
    Copy link
    Mannequin

    mitya57 mannequin commented Dec 29, 2013

    This is a result of http://hg.python.org/cpython/rev/6903f5214e99.

    Looks like we should check the error code and conditionally set the file name to either src or dst.

    @doko42
    Copy link
    Member

    doko42 commented Jul 26, 2014

    3.4.0 has this fixed. resolutions in http://bugs.python.org/issue16074 and http://bugs.python.org/issue20517

    @doko42 doko42 closed this as completed Jul 26, 2014
    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant