Compiling python on windows with vs

Eryk Sun eryksun at gmail.com
Thu Jun 15 12:35:46 EDT 2023


On 6/15/23, Thomas Schweikle via Python-list <python-list at python.org> wrote:
>
> No. This flag is not inherited. Someone has to set it for created
> directories. It is easy to confirm: take a directory not under MSYS or
> cygwin control (because it is mounted by MSYS or cygwin), set the flag,
> then create directories. They all will have caseSensitivInfo disabled.

That was how the attribute was implemented initially in Windows 10,
but subsequently it was made inheritable. For example:

    C:\Temp\test>mkdir spam
    C:\Temp\test>fsutil file setCaseSensitiveInfo spam enable
    Error:  Access is denied.

Setting the case-sensitive attribute requires the right to add files
and directories (i.e. "WD" = "write data" / "add file"; "AD" = "append
data" / "add subdirectory") and the right to remove files and
directories (i.e. "DC" = "delete child"). The owner of a directory
doesn't necessarily inherit these rights from the parent directory
(which is my case here), but the owner of any object usually has the
implicit right to modify discretionary security. Let's simply grant
the owner (i.e. "OW" = "owner rights") full control of the directory
(i.e. "F"), inheritable to child directories (i.e. "CI" = "container
inherit").

    C:\Temp\test>icacls spam /grant *OW:(CI)(F)
    processed file: spam
    Successfully processed 1 files; Failed processing 0 files

    C:\Temp\test>fsutil file setCaseSensitiveInfo spam enable
    Case sensitive attribute on directory C:\Temp\test\spam is enabled.

Now, create a child directory and confirm that it inherits the
case-sensitive flag.

    C:\Temp\test>mkdir spam\eggs
    C:\Temp\test>fsutil file queryCaseSensitiveInfo spam\eggs
    Case sensitive attribute on directory C:\Temp\test\spam\eggs is enabled.

> Python itself isn't the problem here. It is MSBuild.exe. For some reason
> this tool lowercases sometimes whole paths to files included. This does
> not matter if case sensitivity is disabled. It matters if case
> sensitivity is enabled! There is no reason MSBUild.exe does it. But it
> is done for some paths (as someone else pointed out).

For the specific problem you had when building 3.10 and 3.11, it's
actually a bug in Python's source code, which is no longer present in
3.12+. It can be fixed in 3.11, but 3.10 no longer gets bug fixes.
Here's the link to the issue on GitHub:

https://github.com/python/cpython/issues/105737

I encountered a different bug when building the main branch. Building
the _decimal extension module includes an .asm file. The relative path
in the project file has the correct case, but the build system
resolved the fully-qualified path as all lower case. This problem only
occurred for this single file, out of hundreds of relative paths in
the project files, so it's not like the build system is completely
broken when working in case-sensitive directories.

There are probably a few such bugs that need to be fixed in msbuild,
the compiler, and linker. After all, these tools have been developed
and tested for decades on only case-insensitive filesystems. But you
don't have to be on the bleeding edge. There's no reason to make
directories case-sensitive for repositories that are intended for use
on Windows, such as CPython.


More information about the Python-list mailing list