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.which() should preserve path case #61197

Closed
serhiy-storchaka opened this issue Jan 18, 2013 · 9 comments
Closed

shutil.which() should preserve path case #61197

serhiy-storchaka opened this issue Jan 18, 2013 · 9 comments
Assignees
Labels
OS-windows stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 16993
Nosy @pitrou, @tarekziade, @skrah, @hynek, @serhiy-storchaka
Files
  • shutil_which_normcase.patch
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-01-24.18:18:34.258>
    created_at = <Date 2013-01-18.09:25:25.438>
    labels = ['type-bug', 'library', 'OS-windows']
    title = 'shutil.which() should preserve path case'
    updated_at = <Date 2013-01-24.18:18:34.230>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2013-01-24.18:18:34.230>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-01-24.18:18:34.258>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2013-01-18.09:25:25.438>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['28781']
    hgrepos = []
    issue_num = 16993
    keywords = ['patch']
    message_count = 9.0
    messages = ['180181', '180246', '180248', '180338', '180357', '180371', '180373', '180534', '180539']
    nosy_count = 7.0
    nosy_names = ['pitrou', 'tarek', 'skrah', 'python-dev', 'Ramchandra Apte', 'hynek', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16993'
    versions = ['Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    Now which lowercase found directory name and extension on Windows.

    >>> shutil.which("python")
    'c:\\python33\\python.exe'

    Proposed patch preserve case.

    >>> shutil.which("python")
    'C:\\Python33\\python.exe'

    Please test this on Windows.

    @serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir OS-windows labels Jan 18, 2013
    @RamchandraApte
    Copy link
    Mannequin

    RamchandraApte mannequin commented Jan 19, 2013

    Somehow the patch is not showing for me.

    @serhiy-storchaka
    Copy link
    Member Author

    Oh, sorry. Here is a patch.

    @serhiy-storchaka serhiy-storchaka self-assigned this Jan 21, 2013
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 21, 2013

    New changeset d2db601a53b3 by Serhiy Storchaka in branch '3.3':
    Issue bpo-16993: shutil.which() now preserves the case of the path and extension
    http://hg.python.org/cpython/rev/d2db601a53b3

    New changeset 5faae2bdf1e0 by Serhiy Storchaka in branch 'default':
    Issue bpo-16993: shutil.which() now preserves the case of the path and extension
    http://hg.python.org/cpython/rev/5faae2bdf1e0

    @serhiy-storchaka
    Copy link
    Member Author

    Test broken on Windows because PATHEXT contains uppercased extension ".EXT".

    Proposed solutions:

    1. Fix the test: expect uppercased extension, or do case-insensitive extension comparison, or get extension from PATHEXT.
    2. Rollback the part of previous changes which preserve case of extensions from PATHEXT and always lowercase them.
    3. Rollback the changes overall.
    4. Use not used for now ntpath._getfinalpathname() to get a real file name (it resolves symlinks, though).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 22, 2013

    New changeset 28282e4e9d04 by Serhiy Storchaka in branch '3.3':
    Fix shutil.which() test for issue bpo-16993.
    http://hg.python.org/cpython/rev/28282e4e9d04

    New changeset e8f40d4f497c by Serhiy Storchaka in branch 'default':
    Fix shutil.which() test for issue bpo-16993.
    http://hg.python.org/cpython/rev/e8f40d4f497c

    @serhiy-storchaka
    Copy link
    Member Author

    I chose the first simplest variant.

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jan 24, 2013

    Serhiy, test_pathext_checking still fails on many Windows buildbots:

    http://buildbot.python.org/all/waterfall?category=3.x.stable&category=3.x.unstable

    @skrah skrah mannequin reopened this Jan 24, 2013
    @serhiy-storchaka
    Copy link
    Member Author

    Thank you, Stefan. This relates to bpo-16957.

    @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
    OS-windows 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