]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: use only the configured shell
authorMark Levedahl <mlevedahl@gmail.com>
Sun, 6 Apr 2025 22:20:14 +0000 (18:20 -0400)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:04:23 +0000 (17:04 -0400)
git-gui has a few places where a bare "sh" is passed to exec, meaning
that the first instance of "sh" on $PATH will be used rather than the
shell configured. This violates expectations that the configured shell
is being used. Let's use [shellpath] everywhere.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
lib/sshkey.tcl
lib/tools.tcl

index 589ff8f78aba8273651b33005c6f6abd1db2fa27..c0c5d1dad8252d927d10482911d2dc656b74b637 100644 (file)
@@ -83,7 +83,8 @@ proc make_ssh_key {w} {
        set sshkey_title [mc "Generating..."]
        $w.header.gen configure -state disabled
 
-       set cmdline [list sh -c {echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
+       set cmdline [list [shellpath] -c \
+               {echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
 
        if {[catch { set sshkey_fd [_open_stdout_stderr $cmdline] } err]} {
                error_popup [mc "Could not start ssh-keygen:\n\n%s" $err]
index 413f1a170079e0cec78ecdbd1adb7baeb83406f2..b86f72ed16756812ae27e03bde7d0389880abe29 100644 (file)
@@ -110,14 +110,14 @@ proc tools_exec {fullname} {
 
        set cmdline $repo_config(guitool.$fullname.cmd)
        if {[is_config_true "guitool.$fullname.noconsole"]} {
-               tools_run_silent [list sh -c $cmdline] \
+               tools_run_silent [list [shellpath] -c $cmdline] \
                                 [list tools_complete $fullname {}]
        } else {
                regsub {/} $fullname { / } title
                set w [console::new \
                        [mc "Tool: %s" $title] \
                        [mc "Running: %s" $cmdline]]
-               console::exec $w [list sh -c $cmdline] \
+               console::exec $w [list [shellpath] -c $cmdline] \
                                 [list tools_complete $fullname $w]
        }