Repository navigation
Conversation
find_git() skipped candidates matching sys.executable, which is the gitcache binary only in a frozen build. In a pip installation it is the Python interpreter, so a git symlink to the gitcache entry point script was returned as the real git command whenever RealGit was not configured (e.g. HOME pointing to a fresh directory). Every git call then spawned itself until the system ran out of memory. Also compare candidates with sys.argv[0], the script being run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
find_git()skips a PATH candidate only when it is the same file assys.executable. That holds for the frozen builds, wheresys.executableis the gitcache binary. In a pip installation,sys.executableis the Python interpreter, and the gitcache entry point is a script run by it, so agitsymlink to that script is not skipped.As long as
~/.gitcache/configsetsRealGit, the default is never used and nothing happens. But when no config is found, e.g. withHOMEpointing to a fresh/tmp directory, the default wins:find_git()returns the wrapper itself, and everygitcall starts anothergitthat waits on its child. On my machine this grew to about 2,000 processes and 86 GB of memory before the OOM killer took down the desktop.Reproduce with a pip/venv install and
~/.local/bin/git -> gitcache:The fix also compares each candidate with
sys.argv[0], the script being run, ignoring it when it is empty or does not exist.Tests:
test_skip_git_symlink_to_scriptcovers agitsymlink to a script run by a separate interpreter and fails without the fix.test_skip_without_argv0covers an emptysys.argv[0].