summaryrefslogtreecommitdiff
path: root/merge-blobs.c
diff options
context:
space:
mode:
authorMark Levedahl <mlevedahl@gmail.com>2025-03-31 23:01:00 -0400
committerJohannes Sixt <j6t@kdbg.org>2025-04-01 18:11:08 +0200
commit1925c292e84eb9cee40bfa2582900afa9a310154 (patch)
tree254e6b82c2f49769024c4cdd0b3b9102cb56f157 /merge-blobs.c
parentb55e1131111b7dd58af6668d321d560b08f0c996 (diff)
gitk: override $PATH search only on Windows
Commit 4cbe9e0e2 was written to address problems that result from Tcl's documented behavior on Windows where the current working directory and a number of Windows system directories are automatically prepended to $PATH when searching for executables [1]. This basic Windows behavior has resulted in more than one CVE against git for Windows: CVE-2023-23618, CVE-2022-41953 are listed on the git for Windows github website for the Tcl components of git (gitk, git-gui). 4cbe9e0e2 is intended to restrict the search to looking only in directories given in $PATH and in the given order, which is exactly the Tcl behavior documented to exist on non-Windows platforms [1]. Thus, this change could have been written to affect only Windows, leaving other platforms alone. However, 4cbe9e0e2 implements the override for all platforms. This includes specialized code for Cygwin, copied from git-gui prior to commit 7145c654 on https://github.com/j6t/git-gui, so targets a long retired Cygwin port of the Windows Tcl/Tk using Windows pathnames. Since 2012, Cygwin uses a Unix/X11 port requiring Unix pathnames, meaning 4cbe9e0e2 is incompatible. 4cbe9e0e2 also induces an infinite recursion as _which now invokes the exec wrapper that invokes _which. This is part of git v2.49.0, so gitk on Cygwin is broken in that release. Rather than fix the unnecessary override code for Cygwin, let's just limit the override of exec/open to Windows, leaving all other platforms using their native exec/open as they did prior to 4cbe9e0e2. This patch wraps the override code in an "if {[is_Windows]} { ... }" block while removing the non-Windows code added in 4cbe9e0e2. [1] see https://www.tcl-lang.org/man/tcl8.6/TclCmd/exec.htm Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 'merge-blobs.c')
0 files changed, 0 insertions, 0 deletions