Skip to content

correctly handle uname-cmd that doesn't point to an executable file #2026

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

Merged
merged 16 commits into from
May 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check for the existence/execute bit on the uname command before tryin…
…g to run it
  • Loading branch information
gcmarx committed May 21, 2025
commit de5e57caf26e5f6772ac02a3944e58e0aba177f3
6 changes: 6 additions & 0 deletions git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,13 @@ def _is_cygwin_git(git_executable: str) -> bool:
git_dir = osp.dirname(res[0]) if res else ""

# Just a name given, not a real path.
# Let's see if the same path has uname
uname_cmd = osp.join(git_dir, "uname")
if not (osp.isfile(uname_cmd) and os.access(uname_cmd, os.X_OK)):
_logger.debug(f"File {uname_cmd} either does not exist or is not executable.")
_is_cygwin_cache[git_executable] = is_cygwin
return is_cygwin

process = subprocess.Popen([uname_cmd], stdout=subprocess.PIPE, universal_newlines=True)
uname_out, _ = process.communicate()
# retcode = process.poll()
Expand Down