From 02dd866ba9dfe6b6090b351450894489ca80311f Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Sun, 6 Apr 2025 18:20:14 -0400 Subject: git-gui: use only the configured shell 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 Signed-off-by: Johannes Sixt Signed-off-by: Taylor Blau --- lib/sshkey.tcl | 3 ++- lib/tools.tcl | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sshkey.tcl b/lib/sshkey.tcl index 589ff8f78a..c0c5d1dad8 100644 --- a/lib/sshkey.tcl +++ b/lib/sshkey.tcl @@ -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] diff --git a/lib/tools.tcl b/lib/tools.tcl index 413f1a1700..b86f72ed16 100644 --- a/lib/tools.tcl +++ b/lib/tools.tcl @@ -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] } -- cgit v1.2.3 From 00c7aa86e905175476e0dff149d570b48c34c8f1 Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Thu, 3 Apr 2025 00:37:08 -0400 Subject: git-gui: avoid auto_execok in do_windows_shortcut git-gui on Windows uses auto_execok to locate git-gui.exe, which performs the same flawed search as does the builtin exec. Use _which instead, performing a safe PATH lookup. Signed-off-by: Mark Levedahl Signed-off-by: Johannes Sixt Signed-off-by: Taylor Blau --- lib/shortcut.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/shortcut.tcl b/lib/shortcut.tcl index 674a41f5e0..263f4899c9 100644 --- a/lib/shortcut.tcl +++ b/lib/shortcut.tcl @@ -12,7 +12,7 @@ proc do_windows_shortcut {} { set fn ${fn}.lnk } # Use git-gui.exe if available (ie: git-for-windows) - set cmdLine [auto_execok git-gui.exe] + set cmdLine [list [_which git-gui]] if {$cmdLine eq {}} { set cmdLine [list [info nameofexecutable] \ [file normalize $::argv0]] -- cgit v1.2.3