Skip to content

Support Python 3.12 on Cygwin #1988

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

Closed
wants to merge 2 commits into from

Conversation

EliahKagan
Copy link
Member

Cygwin has had Python 3.9 as its latest version for a while, with progress both on moving past 3.9.16 for Python 3.9, as well as on packaging Python 3.y for higher y, stalled due to the problem described in #1814. However, packaging work has resumed. This includes Cygwin builds of Python 3.12 (which is successfully packaged for the parallel/forked MSYS2 target). Such builds are marked "test" and do not work properly yet (reports and discussion can be seen in this month's list archive).

Since GitPython has long-standing support for Cygwin, which I suspect remains one of the important use cases of GitPython (with some alternatives not supporting Cygwin), it seems to me that it is worthwhile to support Python 3.12 on Cygwin, as well as to test it on CI. Since the Cygwin downstream build of Python 3.12 is currently experimental and not fully working, I don't expect GitPython to work with it yet. This PR is for testing that, and for keeping track of changes that are known to be wanted whenever Cygwin Python 3.12 is working. I have encountered substantial differences between CI and my local setup with Cygwin in the past, so testing this on CI now may help avoid surprises. It may also lead to the discovery of bugs, or information about known bugs, that could be useful to report on the Cygwin mailing list. This PR is definitely not ready to be merged.

This PR is separate from and in parallel to #1955 (which is about Python 3.13 and blocked due to a need to change some GitPython code to support that version on Windows), because they are conceptually separate with no known overlap in blockers or in changes that would fix them, and because it seems to me that having two PRs makes the situation clear, both to me and to other people who might wish to contribute.

@EliahKagan
Copy link
Member Author

EliahKagan commented Jan 4, 2025

In both this older run before the #1989-related rebase, and this newer run, the Cygwin Python 3.12 job seems to stall either when attempting to download mypy or immediately afterward. (I can't tell from the logs if the download completes.)

This resembles the problem described for Cygwin python39 3.9.18-1 in #1814, so maybe it's simply that this problem is not solved yet--or maybe it is a different problem that only seems superficially the same. (The part of the download that blocked consistently had been drawing scroll bars, which does not seem to be happening here.)

I have not reproduced that problem locally. The problems I encounter locally--other than the venv pip issue, which is known, worked around in this PR, and which I work around locally--occur once I am actually trying to run the tests. pytest either runs, collects tests, then mysteriously terminates, yet with an exit status of 0; or pytest does not start at all, and an error message is shown, yet still the command has an exit status of 0. This is the second of the two anticipated problems described in 18c7b96; I don't know if they would happen on CI or not, since we don't get that far. Most details of what I observed locally can be seen in this gist.

Edit: I also tried locally running the tests with an MSYS2 build of Python 3.12. (That is, with the downstream Python 3.12 packaged by the MSYS2 project for the MSYS environment. Other environments are native Windows builds, while the MSYS environment is Cygwin-like due to MSYS and MSYS2 being forked from Cygwin. In the MSYS2 build of Python, sys.platform gives 'cygwin'.) This worked fairly well; it does not have the problems observed on the Cygwin Python 3.12. That makes sense, though, since the Cygwin Python 3.12 is experimental. Full details are in this other gist.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Python 3.12 is currently marked "test" and should not be expected
to fully work. Assuming this successfully installs it, based on
local testing I expect two encounter two problems:

1. Currently, creating a venv with `pip` in Python 3.12 on Cygwin
   does not seem to be working, even though its own global `pip`
   exists. Running `python -m ensurepip` likewise does not work,
   reporting that the bundled `pip-24.3.1-py3-none-any.whl` does
   not exist. The https://bootstrap.pypa.io/get-pip.py script can
   be used as a workaround, assuming the problem also happens on
   CI (which I expect). Eventually, `pip` should be fully working.

2. Once that is worked around, there seem to be problems where
   Python processes terminate unexpectedly and wrongly report
   success, or where subprocess creation fails.

   When I ran `pytest` loading it as a module (`python -m pytest`),
   it collected tests and sometimes started running them, but then
   suddenly terminated with an exit status of 0. When I ran it via
   the `pytest` command (no `python -m`), that problem also usually
   happened, but one time I got an immediate termination instead,
   reporting the following errors, yet still with a 0 exit status:

       0 [main] python3.12 2724 C:\cygwin64\bin\python3.12.exe: *** fatal error in forked process - WFSO timed out performed fork fixups and dynamic dll loading
       0 [main] python3.12 2769 C:\cygwin64\bin\python3.12.exe: *** fatal error in forked process - WFSO timed out performed fork fixups and dynamic dll loading

   And one time I got an immediate termination reporting this
   slightly different error, also with an exit status of 0:

       0 [main] python3.12 3371 C:\cygwin64\bin\python3.12.exe: *** fatal error in forked process - WFSO timed out after longjmp

   This curious combination of errors (or the same error arising
   and being reported in different ways?) is my main motivation for
   testing GitPython on CI with Python 3.12 in Cygwin now, even
   though the Cygwin package `python312` and assocated packages are
   still marked "test". If the problems I observed locally can be
   reproduced, then this may help to find a minimal case that shows
   the problem (assuming that it is due to a Cygwin-related bug).

This commit contains no attempt to avoid or work around either of
those two anticipated problems.
This works around a problem in Python 3.12 on Cygwin where `pip`
fails to intall in a venv via `ensurepip` (both implicitly when the
venv is created normally, and explicitly when `python -m ensurepip`
is attempted), by creating the venv with `--without-pip` and then,
once the venv is set up, bootstrapping `pip` in it by running the
https://bootstrap.pypa.io/get-pip.py script.

Eventually, when `pip` is working automatically in a venv in
Python 3.12 on Cygwin (the problem is specific to that combination,
and the Cygwin `python312*` packages are still marked "test"), this
special-casing can be removed.
@EliahKagan
Copy link
Member Author

EliahKagan commented Feb 20, 2025

The stall still happens, both on CI and locally, including after upgrading from 3.12.8-1 to 3.12.8-2. I believe it is known still to occur, having been reported upstream by others, including for this version--I'm subscribed to the mailing list and I vaguely recall this to be so--but I'll try to check. It resembles the original problem that keeps 3.9 on Cygwin from having a stable version higher than 3.9.16. The stall is not specific to installing mypy--it will occur when installing other dependencies.

Because I have a substantial backlog of more important things than this PR, both in GitPython and elsewhere, my plan right now is to check if the 3.9 job itself is still working on the main branch and, if so, to close this PR, with the hope of revisiting it in the future if bugs in the Cygwin downstream Python 3.12 package are fixed.

Edit: The Cygwin test job is broken on the main branch as well. See #2004 for details. These are very unlikely to share a common cause, and a fix for that seems very unlikely to affect this in any way. Nonetheless, I'll keep this open for a short while longer or until that is fixed. This is in the hope of being able to confirm, when closing this without merging, that the matrix is capable of generating a working job (for 3.9) but that 3.12 is still not working

Over time, my guess is that this will get fixed, but if not, Python 3.12 on MSYS2 does noth have similar problems. So I predict that, if this does not end up being fixed in the Cygwin packages, then some current users of Python on Cygwin will use it on MSYS2 instead. If that becomes popular among GitPython users, then an MSYS2 job should be added. Right now, though, that's all hypothetical; unless requested by users, I don't think it's currently a priority to test GitPython on the MSYS2 downstream build of Python.


Relating to MSYS2 environments, only the MSYS environment is Cygwin-like rather than native. The MINGW64, UCRT64, and CLANG64 builds of Python installable through the MSYS2 package manager--unlike what I am calling the MSYS2 builds, i.e. unlike the MSYS builds for MSYS2--are native builds, and I expect them already to work.

The CLANGARM64 build, which I haven't worked with, is likewise native and comparable to upstream/normal ARM64 builds, which has stable versions on the downloads page. We don't currently test AArch64/ARM64 at all on Windows.

That may be something to look into once GitHub-hosted ARM64 Windows GHA runners are available without fee. From past cloud experiments on ARM64 Linux, and past QEMU experiments with the even more different s390x architecture--taken together with how the macOS jobs run on Apple Silicon, which is ARM64--my guess is that GitPython will behave the same and have no new problems on ARM64 Windows compared to x86-64 Windows. But it might still be good to try testing more than one architecture on Windows.

However, because GitPython and its gitdb and smmap dependencies, like many Python projects, are mostly written in a way that abstracts out details that vary between architectures, it seems to me that testing on a variety of architectures is lower priority in GitPython than in some other projects such as gitoxide.

@Byron
Copy link
Member

Byron commented Feb 25, 2025

I don't know if it's related, but Cygwin seems broken on main now as well. There seems to be no error message or anything to go on, unfortunately.

@EliahKagan
Copy link
Member Author

The Cygwin breakage on main is due to #2004. I don't think there's any connection between this and that, but that issue is why I haven't closed this yet (per #1988 (comment), I want to verify that Python 3.12 is not working even when Python 3.9 is working).

The reason #2004 wasn't observed on main earlier is just that there was no event to trigger a run; I did produce it on the main branch of my fork. I do very much expect that #2004 can be solved (it looks nontrivial but not nearly as hard as the issue here).

@EliahKagan
Copy link
Member Author

Once CI is green again, such as after #2009, I can try to rebase this to verify that it is really not working due to problems we can't fix here (before closing it).

@EliahKagan
Copy link
Member Author

EliahKagan commented Apr 20, 2025

Status - it's not working

I haven't rebased this, but pytest terminates unexpectedly in local runs with Python 3.12 in test/deprecation/test_basic.py::test_diff_renamed_file_does_not_warn.

(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:07 $ python -m pytest -p no:sugar -vv
================================================= test session starts ==================================================
platform cygwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /home/ek/repos-cygwin/GitPython/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/ek/repos-cygwin/GitPython
configfile: pyproject.toml
testpaths: test
plugins: cov-6.1.1, instafail-0.5.0, mock-3.14.0
collected 669 items

test/deprecation/test_basic.py::test_diff_renamed_warns PASSED                                                   [  0%]
test/deprecation/test_basic.py::test_diff_renamed_file_does_not_warn (.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:09 $

Some new package versions have been released. That happens both before and after upgrading to them. The above run is done with the newer versions (which are shown in a log below).

An occasional message that may or may not be relevant

Occasionally I get:

(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:12 $ /home/ek/repos-cygwin/GitPython/.venv/bin/python -m pytest -p no:sugar -vv
================================================= test session starts ==================================================
platform cygwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /home/ek/repos-cygwin/GitPython/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/ek/repos-cygwin/GitPython
configfile: pyproject.toml
testpaths: test
plugins: cov-6.1.1, instafail-0.5.0, mock-3.14.0
collected 669 items

test/deprecation/test_basic.py::test_diff_renamed_warns PASSED                                                   [  0%]
test/deprecation/test_basic.py::test_diff_renamed_file_does_not_warn       0 [main] python 1876 child_copy: stack write copy failed, 0x7FFFF9770..0x800000000, done 0, windows pid 8284, Win32 error 998
   1548 [main] python 1876 dofork: child 0 - pid 24044, exitval 0x103, errno 11
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:12 $       0 [main] python3.12 1404 C:\cygwin64\bin\python3.12.exe: *** fatal error in forked process - WFSO timed out after longjmp

I used an absolute path there. The messages far more often are shown when using an absolute path, and possibly are never shown when just using python. But they are not usually shown with an absolute path either. I have verified that the path python resolves to in the shell is the same as the file the absolute path points to, and that this is the python command installed in the virtual environment.

Producing strace output

To use strace in Cygwin requires that one use an absolute path to a binary executable, i.e., not a symlink. I set up a new virtual environment whose interpreter was installed as a copy rather than a symlink to achieve this. Other aspects of the virtual environment setup were the same as before. Rather than terminating on its own, this stopped responding and used about one full core of CPU continuously until I terminated it by killing the parent strace process once strace.out reached over 600 MiB in size:

✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:14 $ python -m venv .venv --copies --without-pip
✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:15 $ . .venv/bin/activate
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:15 $ type python
python is /home/ek/repos-cygwin/GitPython/.venv/bin/python
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:15 $ file /home/ek/repos-cygwin/GitPython/.venv/bin/python
/home/ek/repos-cygwin/GitPython/.venv/bin/python: PE32+ executable (console) x86-64, for MS Windows, 11 sections
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:15 $ wget -qO- https://bootstrap.pypa.io/get-pip.py | python
Collecting pip
  Using cached pip-25.0.1-py3-none-any.whl.metadata (3.7 kB)
Using cached pip-25.0.1-py3-none-any.whl (1.8 MB)
Installing collected packages: pip
Successfully installed pip-25.0.1
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:16 $ python -m pip install -U pip wheel
Requirement already satisfied: pip in ./.venv/lib/python3.12/site-packages (25.0.1)
Collecting wheel
  Using cached wheel-0.45.1-py3-none-any.whl.metadata (2.3 kB)
Using cached wheel-0.45.1-py3-none-any.whl (72 kB)
Installing collected packages: wheel
Successfully installed wheel-0.45.1
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:16 $ python -m pip install -e '.[test]'
Obtaining file:///home/ek/repos-cygwin/GitPython
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Collecting gitdb<5,>=4.0.1 (from GitPython==3.1.44)
  Using cached gitdb-4.0.12-py3-none-any.whl.metadata (1.2 kB)
Collecting coverage[toml] (from GitPython==3.1.44)
  Using cached coverage-7.8.0-py3-none-any.whl.metadata (8.5 kB)
Collecting ddt!=1.4.3,>=1.1.1 (from GitPython==3.1.44)
  Using cached ddt-1.7.2-py2.py3-none-any.whl.metadata (832 bytes)
Collecting mypy (from GitPython==3.1.44)
  Using cached mypy-1.15.0-py3-none-any.whl.metadata (2.1 kB)
Collecting pre-commit (from GitPython==3.1.44)
  Using cached pre_commit-4.2.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting pytest>=7.3.1 (from GitPython==3.1.44)
  Using cached pytest-8.3.5-py3-none-any.whl.metadata (7.6 kB)
Collecting pytest-cov (from GitPython==3.1.44)
  Using cached pytest_cov-6.1.1-py3-none-any.whl.metadata (28 kB)
Collecting pytest-instafail (from GitPython==3.1.44)
  Using cached pytest_instafail-0.5.0-py3-none-any.whl.metadata (2.2 kB)
Collecting pytest-mock (from GitPython==3.1.44)
  Using cached pytest_mock-3.14.0-py3-none-any.whl.metadata (3.8 kB)
Collecting pytest-sugar (from GitPython==3.1.44)
  Using cached pytest_sugar-1.0.0-py3-none-any.whl.metadata (4.4 kB)
Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->GitPython==3.1.44)
  Using cached smmap-5.0.2-py3-none-any.whl.metadata (4.3 kB)
Collecting iniconfig (from pytest>=7.3.1->GitPython==3.1.44)
  Using cached iniconfig-2.1.0-py3-none-any.whl.metadata (2.7 kB)
Collecting packaging (from pytest>=7.3.1->GitPython==3.1.44)
  Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting pluggy<2,>=1.5 (from pytest>=7.3.1->GitPython==3.1.44)
  Using cached pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Collecting typing_extensions>=4.6.0 (from mypy->GitPython==3.1.44)
  Using cached typing_extensions-4.13.2-py3-none-any.whl.metadata (3.0 kB)
Collecting mypy_extensions>=1.0.0 (from mypy->GitPython==3.1.44)
  Using cached mypy_extensions-1.0.0-py3-none-any.whl.metadata (1.1 kB)
Collecting cfgv>=2.0.0 (from pre-commit->GitPython==3.1.44)
  Using cached cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting identify>=1.0.0 (from pre-commit->GitPython==3.1.44)
  Using cached identify-2.6.10-py2.py3-none-any.whl.metadata (4.4 kB)
Collecting nodeenv>=0.11.1 (from pre-commit->GitPython==3.1.44)
  Using cached nodeenv-1.9.1-py2.py3-none-any.whl.metadata (21 kB)
Collecting pyyaml>=5.1 (from pre-commit->GitPython==3.1.44)
  Using cached pyyaml-6.0.2-cp312-cp312-cygwin_3_6_1_x86_64.whl
Collecting virtualenv>=20.10.0 (from pre-commit->GitPython==3.1.44)
  Using cached virtualenv-20.30.0-py3-none-any.whl.metadata (4.5 kB)
Collecting termcolor>=2.1.0 (from pytest-sugar->GitPython==3.1.44)
  Using cached termcolor-3.0.1-py3-none-any.whl.metadata (6.1 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit->GitPython==3.1.44)
  Using cached distlib-0.3.9-py2.py3-none-any.whl.metadata (5.2 kB)
Collecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit->GitPython==3.1.44)
  Using cached filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)
Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit->GitPython==3.1.44)
  Using cached platformdirs-4.3.7-py3-none-any.whl.metadata (11 kB)
Using cached ddt-1.7.2-py2.py3-none-any.whl (7.1 kB)
Using cached gitdb-4.0.12-py3-none-any.whl (62 kB)
Using cached pytest-8.3.5-py3-none-any.whl (343 kB)
Using cached mypy-1.15.0-py3-none-any.whl (2.2 MB)
Using cached pre_commit-4.2.0-py2.py3-none-any.whl (220 kB)
Using cached pytest_cov-6.1.1-py3-none-any.whl (23 kB)
Using cached pytest_instafail-0.5.0-py3-none-any.whl (4.2 kB)
Using cached pytest_mock-3.14.0-py3-none-any.whl (9.9 kB)
Using cached pytest_sugar-1.0.0-py3-none-any.whl (10 kB)
Using cached cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB)
Using cached coverage-7.8.0-py3-none-any.whl (203 kB)
Using cached identify-2.6.10-py2.py3-none-any.whl (99 kB)
Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Using cached nodeenv-1.9.1-py2.py3-none-any.whl (22 kB)
Using cached packaging-25.0-py3-none-any.whl (66 kB)
Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
Using cached smmap-5.0.2-py3-none-any.whl (24 kB)
Using cached termcolor-3.0.1-py3-none-any.whl (7.2 kB)
Using cached typing_extensions-4.13.2-py3-none-any.whl (45 kB)
Using cached virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
Using cached iniconfig-2.1.0-py3-none-any.whl (6.0 kB)
Using cached distlib-0.3.9-py2.py3-none-any.whl (468 kB)
Using cached filelock-3.18.0-py3-none-any.whl (16 kB)
Using cached platformdirs-4.3.7-py3-none-any.whl (18 kB)
Building wheels for collected packages: GitPython
  Building editable for GitPython (pyproject.toml) ... done
  Created wheel for GitPython: filename=gitpython-3.1.44-0.editable-py3-none-any.whl size=10226 sha256=443b522e51c62114aea1f56a4f2a156bf34e4b64c5b9acf9955fac7fd459eece
  Stored in directory: /tmp/pip-ephem-wheel-cache-1tf98fds/wheels/6c/de/78/cae8c6cbd4af1a44e430f06e36db3ba96ee04d3d4a155efa99
Successfully built GitPython
Installing collected packages: distlib, ddt, typing_extensions, termcolor, smmap, pyyaml, pluggy, platformdirs, packaging, nodeenv, mypy_extensions, iniconfig, identify, filelock, coverage, cfgv, virtualenv, pytest, mypy, gitdb, pytest-sugar, pytest-mock, pytest-instafail, pytest-cov, pre-commit, GitPython
Successfully installed GitPython-3.1.44 cfgv-3.4.0 coverage-7.8.0 ddt-1.7.2 distlib-0.3.9 filelock-3.18.0 gitdb-4.0.12 identify-2.6.10 iniconfig-2.1.0 mypy-1.15.0 mypy_extensions-1.0.0 nodeenv-1.9.1 packaging-25.0 platformdirs-4.3.7 pluggy-1.5.0 pre-commit-4.2.0 pytest-8.3.5 pytest-cov-6.1.1 pytest-instafail-0.5.0 pytest-mock-3.14.0 pytest-sugar-1.0.0 pyyaml-6.0.2 smmap-5.0.2 termcolor-3.0.1 typing_extensions-4.13.2 virtualenv-20.30.0
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:17 $ /home/ek/repos-cygwin/GitPython/.venv/bin/python -m pytest -p no:sugar -vv
================================================= test session starts ==================================================
platform cygwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /home/ek/repos-cygwin/GitPython/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/ek/repos-cygwin/GitPython
configfile: pyproject.toml
testpaths: test
plugins: cov-6.1.1, instafail-0.5.0, mock-3.14.0
collected 669 items

test/deprecation/test_basic.py::test_diff_renamed_warns PASSED                                                   [  0%]
test/deprecation/test_basic.py::test_diff_renamed_file_does_not_warn       0 [main] python 2837 child_copy: stack write copy failed, 0x7FFFF9770..0x800000000, done 0, windows pid 4936, Win32 error 998
   1801 [main] python 2837 dofork: child 0 - pid 13424, exitval 0x103, errno 11
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:17 $ type strace
strace is /usr/bin/strace
(.venv) ✔ ~/repos-cygwin/GitPython [master L|⚑ 1]
20:18 $ strace -o strace.out /home/ek/repos-cygwin/GitPython/.venv/bin/python -m pytest -p no:sugar -vv
================================================= test session starts ==================================================
platform cygwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0 -- /home/ek/repos-cygwin/GitPython/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/ek/repos-cygwin/GitPython
configfile: pyproject.toml
testpaths: test
plugins: cov-6.1.1, instafail-0.5.0, mock-3.14.0
collected 669 items

test/deprecation/test_basic.py::test_diff_renamed_warns PASSED                                                   [  0%]
test/deprecation/test_basic.py::test_diff_renamed_file_does_not_warn Terminated

What we see with strace

The strace.out file was 9707586 lines long. In case it is somehow useful, I've published the first 500000 lines in this gist. Even that amount is hard to view in a web browser, so anyone interested might prefer to clone the gist rather than view more than the first 7000 or so lines previewed there, though you can try to load the raw file if you want.

The strace output eventually becomes mostly the following error repeated:

--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000

Here's a fragment of possible interest:

211188 30948102 [python] python 2922 fhandler_pipe::release_select_sem: raw_read(PIPER) release 1
  307 30948409 [python] python 2922 fhandler_base::read: returning 146, binary mode
  231 30948640 [python] python 2922 read: 146 = read(17, 0xA009C92F0, 146)
 1060  238173 [main] git 2929 time: 1745108334 = time(0x0)
   74  238247 [main] git 2929 fstat: 0 = fstat(1, 0x7FFFFC950)
  297  238544 [main] git 2929 do_exit: do_exit (0), exit_state 1
   91  238635 [main] git 2929 void: 0x0 = signal (20, 0x1)
   86  238721 [main] git 2929 void: 0x0 = signal (1, 0x1)
   84  238805 [main] git 2929 void: 0x0 = signal (2, 0x1)
   85  238890 [main] git 2929 void: 0x0 = signal (3, 0x1)
   85  238975 [main] git 2929 fhandler_base::close: closing '/dev/null' handle 0x230
 1254 30949894 [python] python 2922 read: read(17, 0xA009C92F0, 65536) blocking
   91  239066 [main] git 2929 fhandler_pipe::release_select_sem: close(PIPEW) release 1
   99  239165 [main] git 2929 fhandler_base::close: closing 'pipe:[85899356244]' handle 0x2A0
  108  239273 [main] git 2929 fhandler_pipe::release_select_sem: close(PIPEW) release 1
  106  239379 [main] git 2929 fhandler_base::close: closing 'pipe:[90194323540]' handle 0x354
  105  239484 [main] git 2929 init_cygheap::close_ctty: closing cygheap->ctty 0x8000091A0
  101  239585 [main] git 2929 fhandler_base::close_with_arch: closing passed in archetype 0x0, usecount 0
  108  239693 [main] git 2929 fhandler_console::close: closing: 0x1D4, 0x1DC
   94  239787 [main] git 2929 fhandler_console::free_console: freed console, res 1
   75  239862 [main] git 2929 dtable::delete_archetype: deleting element 0 for /dev/cons0(3/0)
   68  239930 [main] git 2929 getpid: 2929 = getpid()
   64  239994 [main] git 2929 proc_terminate: child_procs count 0
   64  240058 [main] git 2929 proc_terminate: leaving
   68  240126 [main] git 2929 pinfo::exit: Calling dlls.cleanup_forkables n 0x0, exitcode 0x0
   67  240193 [main] git 2929 pinfo::exit: Calling ExitProcess n 0x0, exitcode 0x0
--- Process 8352 (pid: 2929) thread 17776 exited with status 0x0
--- Process 8352 (pid: 2929) thread 8760 exited with status 0x0
--- Process 8352 (pid: 2929) thread 22108 exited with status 0x0
--- Process 8352 (pid: 2929) thread 8928 exited with status 0x0
--- Process 8352 (pid: 2929) exited with status 0x0
 1926 30951820 [waitproc] python 2922 pinfo::maybe_set_exit_code_from_windows: pid 2929, exit value - old 0x8000000, windows 0xDEADBEEF, cygwin 0x8000000
  102 30951922 [waitproc] python 2922 sig_send: sendsig 0x14C, pid 2922, signal 20, its_me 1
  167 30952089 [waitproc] python 2922 sig_send: Not waiting for sigcomplete.  its_me 1 signal 20
  155 30952244 [sig] python 2922 sigpacket::process: signal 20 processing
  151 30952395 [waitproc] python 2922 sig_send: returning 0x0 from sending signal 20
   94 30952489 [sig] python 2922 init_cygheap::find_tls: sig 20
   89 30952578 [waitproc] python 2922 proc_waiter: exiting wait thread for pid 2929
   91 30952669 [sig] python 2922 sigpacket::process: using tls 0x7FFFFCE00
  174 30952843 [sig] python 2922 sigpacket::process: signal 20 default is currently ignore
   78 30952921 [sig] python 2922 sigpacket::process: returning 1
   80 30953001 [sig] python 2922 proc_subproc: args: 4, 0
   77 30953078 [sig] python 2922 proc_subproc: looking for processes to reap, count 3
   76 30953154 [sig] python 2922 proc_subproc: finished processing terminated/stopped child
   74 30953228 [sig] python 2922 proc_subproc: returning 1
 2513 30955741 [python] python 2922 fhandler_base::read: returning 0, binary mode
  111 30955852 [python] python 2922 fhandler_base::read: returning 0, binary mode
  204 30956056 [python] python 2922 read: 0 = read(20, 0xA009D9300, 0)
  282 30956338 [python] python 2922 read: 0 = read(17, 0xA009C92F0, 0)
 2336 30958674 [python] python 2922 close: close(20)
  161 30958835 [python] python 2922 fhandler_pipe::release_select_sem: close(PIPER) release 0
  160 30958995 [python] python 2922 fhandler_base::close: closing 'pipe:[90194323540]' handle 0xAB8
  158 30959153 [python] python 2922 close: 0 = close(20)
 2692 30961845 [python] python 2922 open: open(/tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD, 0x50000)
  738 30962583 [python] python 2922 munmap: munmap (addr 0x6FFFFF780000, len 16384)
  101 30962684 [python] python 2922 munmap: 0 = munmap(): 0x6FFFFF780000
  150 30962834 [python] python 2922 normalize_posix_path: src /tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD
  162 30962996 [python] python 2922 normalize_posix_path: /tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD = normalize_posix_path (/tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD)
  159 30963155 [python] python 2922 mount_info::conv_to_win32_path: conv_to_win32_path (/tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD)
  158 30963313 [python] python 2922 mount_info::conv_to_win32_path: src_path /tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD, dst C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, flags 0x30008, rc 0
  373 30963686 [python] python 2922 symlink_info::check: 0x0 = NtCreateFile (\??\C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD)
  180 30963866 [] python 2922 _cygtls::remove: wait 4294967295
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000a00261f70
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  233 30964099 [python] python 2922 symlink_info::check: not a symlink
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  179 30964278 [python] python 2922 symlink_info::check: 0 = symlink.check(C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, 0x7FFDFA630) (mount_flags 0x30008, path_flags 0x0)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  183 30964461 [python] python 2922 path_conv::check: this->path(C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD), has_acls(1)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  176 30964637 [python] python 2922 build_fh_pc: fh 0x800013DD0, dev 000000C3
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  273 30964910 [python] python 2922 fhandler_base::open: (\??\C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, 0x50000)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  599 30965509 [python] python 2922 fhandler_base::set_flags: flags 0x50000, supplied_bin 0x10000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  194 30965703 [python] python 2922 fhandler_base::set_flags: O_TEXT/O_BINARY set in flags 0x10000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  168 30965871 [python] python 2922 fhandler_base::set_flags: filemode set to binary
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  171 30966042 [python] python 2922 fhandler_base::open: 0x0 = NtCreateFile (0xBC0, 0x80100000, \??\C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, io, NULL, 0x0, 0x7, 0x1, 0x4020, NULL, 0)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  326 30966368 [python] python 2922 fhandler_base::open: 1 = fhandler_base::open(\??\C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, 0x50000)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  329 30966697 [python] python 2922 fhandler_base::open_fs: 1 = fhandler_disk_file::open(\??\C:\cygwin64\tmp\pytest-of-ek\pytest-17\test_diff_renamed_warns0\.git\HEAD, 0x50000)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
  302 30966999 [python] python 2922 open: 11 = open(/tmp/pytest-of-ek/pytest-17/test_diff_renamed_warns0/.git/HEAD, 0x50000)
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000
--- Process 10324 (pid: 2922), exception c0000005 at 0000000000000000

That makes it look like the problem happens when GitPython is picking back up from having waited on an invocation of git. But I do not know that to be the case.

Furthermore, even if that is the case, my guess is that the bug is neither in nor particularly specific to GitPython, because...

This is what we saw before, or very similar to it

This seems to be the same problem as happened with Python 3.9.18 in #1814. The behavior with the strace log growing unbounded, and the lines eventually being c0000005 at an all-zero address repeatedly, are the same or similar to what I observed in #1814 (comment).

I'm closing this PR, but I hope this can be fixed eventually

Since this isn't mergeable anyway due to a conflict and we don't know what the workflow will look like when it is eventually feasible to test GitPython on Python 3.12 in Cygwin or to recommend it for such use--neither of which are feasible today--I'm going ahead and closing this PR.

However, since Cygwin seems to be one of the platforms that GitPython gets used on in practice, and significant other Python software does seem somehow already to be working on Python 3.12 in Cygwin (I think I recall people have mentioned being able to do so on the mailing list), it may be good to have an issue for this if we don't have one. I'll try to do this if anybody inquires about the matter or, even if no one does, eventually (one I've had a chance to look over the history of the similar or identical problem in 3.9.18).

@EliahKagan EliahKagan closed this Apr 20, 2025
@EliahKagan EliahKagan deleted the cygwin-py312 branch April 20, 2025 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants