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

os.path.normpath change between 3.11.0a2 and 3.11.0a3+ #90366

Closed
hugovk opened this issue Dec 30, 2021 · 8 comments
Closed

os.path.normpath change between 3.11.0a2 and 3.11.0a3+ #90366

hugovk opened this issue Dec 30, 2021 · 8 comments
Labels
3.11 only security fixes release-blocker stdlib Python modules in the Lib dir

Comments

@hugovk
Copy link
Member

hugovk commented Dec 30, 2021

BPO 46208
Nosy @tiran, @zooba, @hugovk, @neonene
PRs
  • bpo-46208: Fix the relative path normalization of _Py_normpath() in fileutils.c #30362
  • 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 2022-01-06.19:13:47.064>
    created_at = <Date 2021-12-30.19:38:30.032>
    labels = ['release-blocker', 'library', '3.11']
    title = 'os.path.normpath change between 3.11.0a2 and 3.11.0a3+'
    updated_at = <Date 2022-01-06.19:13:47.064>
    user = 'https://github.com/hugovk'

    bugs.python.org fields:

    activity = <Date 2022-01-06.19:13:47.064>
    actor = 'steve.dower'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-06.19:13:47.064>
    closer = 'steve.dower'
    components = ['Library (Lib)']
    creation = <Date 2021-12-30.19:38:30.032>
    creator = 'hugovk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46208
    keywords = ['patch']
    message_count = 8.0
    messages = ['409384', '409386', '409390', '409419', '409506', '409646', '409893', '409901']
    nosy_count = 4.0
    nosy_names = ['christian.heimes', 'steve.dower', 'hugovk', 'neonene']
    pr_nums = ['30362']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46208'
    versions = ['Python 3.11']

    @hugovk
    Copy link
    Member Author

    hugovk commented Dec 30, 2021

    The behaviour of os.path.normpath appears to have changed between Python 3.10/Python 3.11.0a2 and 3.11.0a3+.

    I don't see anything mentioned in https://docs.python.org/3.11/whatsnew/3.11.html

    Is this intentional?

    Old behaviour:

    Python 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from os.path import normpath
    >>> normpath('handbook/../../Tests/image.png')
    '../Tests/image.png'
    >>>
    
    
    Python 3.11.0a2 (main, Dec 30 2021, 21:22:15) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from os.path import normpath
    >>> normpath('handbook/../../Tests/image.png')
    '../Tests/image.png'
    >>>

    New behaviour:

    Python 3.11.0a3+ (heads/main:af6b406, Dec  9 2021, 15:34:48) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from os.path import normpath
    >>> normpath('handbook/../../Tests/image.png')
    'Tests/image.png'
    >>>
    
    
    Python 3.11.0a3+ (heads/main:8d7644f, Dec 30 2021, 21:32:51) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from os.path import normpath
    >>> normpath('handbook/../../Tests/image.png')
    'Tests/image.png'
    >>>

    (Found in sphinx-doc/sphinx#10030.)

    @hugovk hugovk added 3.11 only security fixes stdlib Python modules in the Lib dir labels Dec 30, 2021
    @tiran
    Copy link
    Member

    tiran commented Dec 30, 2021

    The issue could be related to 99fcf15 / bpo-45582.

    @hugovk
    Copy link
    Member Author

    hugovk commented Dec 30, 2021

    git bisect between v3.11.0a2 and v3.11.0a3 points to the same commit, 99fcf15.

    @zooba
    Copy link
    Member

    zooba commented Dec 31, 2021

    Yep, it's a bug and should be fixed.

    I'm still not back coding yet, but I'll get to it once I am if nobody else gets there first. This is going to affect getpath.py in the native implementation, so it ought to be fixed there (and we need tests for this case, since it's apparently a gap).

    @hugovk
    Copy link
    Member Author

    hugovk commented Jan 2, 2022

    Here's a branch with a passing ntpath.normpath test and a failing posixpath.normpath test:

    https://github.com/hugovk/cpython/tree/issue-46208-tests

    hugovk@d7e8da1

    @neonene
    Copy link
    Mannequin

    neonene mannequin commented Jan 4, 2022

    Here's a branch with a passing ntpath.normpath test and a failing posixpath.normpath test:

    I took the test cases for my PR, thanks.
    On Windows machine, ntpath fails and posixpath passes. It seems that the passing one is tested with pure python code.

    @zooba
    Copy link
    Member

    zooba commented Jan 6, 2022

    I'm happy with PR 30362 now - any other comments before we merge?

    @zooba
    Copy link
    Member

    zooba commented Jan 6, 2022

    New changeset 9c5fa9c by neonene in branch 'main':
    bpo-46208: Fix normalization of relative paths in _Py_normpath()/os.path.normpath (GH-30362)
    9c5fa9c

    @zooba zooba closed this as completed Jan 6, 2022
    @zooba zooba closed this as completed Jan 6, 2022
    @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.11 only security fixes release-blocker stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants