[New-bugs-announce] [issue41669] Case mismatch between "include" and "Include"

Gregory Szorc report at bugs.python.org
Sun Aug 30 17:48:06 EDT 2020

New submission from Gregory Szorc <gregory.szorc at gmail.com>:

On Windows, `sysconfig.get_path('include')` returns `Include` (capital I).

However, the actual installation path is `include` (lowercase i).

I believe the reason for the case mismatch is in this code in PC/layout/main.py:

    if ns.include_dev:

        for dest, src in rglob(ns.source / "Include", "**/*.h"):
            yield "include/{}".format(dest), src
        src = ns.source / "PC" / "pyconfig.h"
        yield "include/pyconfig.h", src

The case mismatch is relevant for case sensitive filesystems. In my case, I was extracting a Windows Python install on Linux and then using the `sysconfig` value to locate directories within that install. Due to the case mismatch, Linux says `Include` doesn't exist since `sysconfig` points to "include."

Case only renames can be a bit wonky to perform. I would suggest preserving what is shipped today and changing `sysconfig` to advertise lowercase "include." However, this would create a mismatch between the cpython source repo and built distributions. So maybe attempting the case-only rename is doable.

Note that Windows will not allow you to have a file/directory varying only in case. i.e. you can have both an "include" and "Include." I can't recall if you can perform a case-only rename with a single system call (meaning it is atomic) or whether you need to go through a temporary directory.

components: Windows
messages: 376131
nosy: indygreg, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Case mismatch between "include" and "Include"
type: behavior
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list