Skip to content

Commit 02dd866

Browse files
mark987ttaylorr
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 10637fc commit 02dd866

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/sshkey.tcl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ proc make_ssh_key {w} {
8383
set sshkey_title [mc "Generating..."]
8484
$w.header.gen configure -state disabled
8585

86-
set cmdline [list sh -c {echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
86+
set cmdline [list [shellpath] -c \
87+
{echo | ssh-keygen -q -t rsa -f ~/.ssh/id_rsa 2>&1}]
8788

8889
if {[catch { set sshkey_fd [_open_stdout_stderr $cmdline] } err]} {
8990
error_popup [mc "Could not start ssh-keygen:\n\n%s" $err]

lib/tools.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ proc tools_exec {fullname} {
110110

111111
set cmdline $repo_config(guitool.$fullname.cmd)
112112
if {[is_config_true "guitool.$fullname.noconsole"]} {
113-
tools_run_silent [list sh -c $cmdline] \
113+
tools_run_silent [list [shellpath] -c $cmdline] \
114114
[list tools_complete $fullname {}]
115115
} else {
116116
regsub {/} $fullname { / } title
117117
set w [console::new \
118118
[mc "Tool: %s" $title] \
119119
[mc "Running: %s" $cmdline]]
120-
console::exec $w [list sh -c $cmdline] \
120+
console::exec $w [list [shellpath] -c $cmdline] \
121121
[list tools_complete $fullname $w]
122122
}
123123

0 commit comments

Comments
 (0)