git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git v2.49.0 - gitk regression on Cygwin

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Mar 28, 2025, 12:34 UTC
Message-ID
<23088b7d-ed98-4b78-bb9a-c3674da1117d@gmail.com>

referencing the upstream gitk repo at published at https://github.com/j6t/gitk.git:

Since commit 4cbe9e0e2 - "gitk(Windows): avoid inadvertently calling executables in the worktree,"

gitk no longer works on Cygwin. This commit is in Junio's tree as part of release v2.49.0, but I didn't trace to the specific merge commit.

The proximal issue is an endless loop caused by routine _which invoking exec, which is now a wrapper that invokes _which, while the builtin exec is renamed to real_exec.  This results in stack exhaustion.  There are other problems due to munging Cygwin's $PATH into Windows rather than Unix format, so changing _which to invoke real_exec just changes the failure mode on Cygwin.

Removing the Cygwin specific code so that gitk treats Cygwin as a Linux variant does work: e.g.,

diff --git a/gitk b/gitk
index bc9efa1..2c29118 100755
--- a/gitk
+++ b/gitk
@@ -49,14 +49,7 @@ proc _which {what args} {
     global env _search_exe _search_path

     if {$_search_path eq {}} {
-       if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
-           set _search_path [split [exec cygpath \
-               --windows \
-               --path \
-               --absolute \
-               $env(PATH)] {;}]
-           set _search_exe .exe
-       } elseif {[is_Windows]} {
+       if {[is_Windows]} {
             set gitguidir [file dirname [info script]]
             regsub -all ";" $gitguidir "\\;" gitguidir
             set env(PATH) "$gitguidir;$env(PATH)"

However, the above leaves code in place affecting path search on all 
platforms without justification. The commit message references the TCL 
man page for "exec", listing a number of directories (including the 
current working directory) and file suffixes searched on the Windows 
platform that could be problematic. However, that man page does not list 
any such issues for other platforms. So, it appears the patch does not 
address a known issue on Unix platforms, which includes Cygwin.

I believe the correct fix to 4cbe9e0e2 is limiting the override of exec 
and open to Windows, and I also have a patch to do that rather than what 
I show above. Let me know.

Mark
Next: Johannes Sixt
Message 1 of 13 in “git v2.49.0 - gitk regression on Cygwin”
  1. Mark LevedahlMar 28, 2025
  2. Johannes SixtMar 28, 2025
  3. Mark LevedahlMar 29, 2025
  4. gitk - override $PATH search only on WindowsMark Levedahl, Mar 31, 2025
  5. Johannes SixtMar 31, 2025
  6. Mark LevedahlMar 31, 2025
  7. 0/3 gitk: override PATH search only on WindowsMark Levedahl, Apr 1, 2025
  8. 1/3 gitk: override $PATH search only on WindowsMark Levedahl, Apr 1, 2025
  9. 2/3 gitk: _search_exe is no longer neededMark Levedahl, Apr 1, 2025
  10. 3/3 gitk: limit PATH search to bare executable namesMark Levedahl, Apr 1, 2025
  11. Johannes SchindelinApr 1, 2025
  12. Mark LevedahlApr 1, 2025
  13. Johannes SixtApr 1, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.