]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: avoid auto_execok for git-bash menu item
authorMark Levedahl <mlevedahl@gmail.com>
Wed, 2 Apr 2025 21:37:27 +0000 (17:37 -0400)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:04:23 +0000 (17:04 -0400)
On Windows, git-gui offers to open a git-bash session for the current
repository from the menu, but uses [auto_execok start] to get the
command to actually run that shell.

The code for auto_execok, in /usr/share/tcl8.6/tcl.init, has 'start' in
the 'shellBuiltins' list for cmd.exe on Windows: as a result,
auto_execok does not actually search for start, meaning this usage is
technically ok with auto_execok now.  However, leaving this use of
auto_execok in place will just induce confusion about why a known unsafe
function is being used on Windows. Instead, let's switch to using our
known safe _which function that looks only in $PATH, excluding the
current working directory.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
git-gui.sh

index 72da2443e5eb6e86e91b542e50bc7e05f4be1810..3bfe4364c726728729839c3bcdc79fdc8978b0e9 100755 (executable)
@@ -2769,7 +2769,7 @@ if {[is_Windows]} {
        }
        .mbar.repository add command \
                -label [mc "Git Bash"] \
-               -command {eval exec [auto_execok start] $cmdLine}
+               -command {eval exec [list [_which cmd] /c start] $cmdLine}
 }
 
 if {[is_Windows] || ![is_bare]} {