Tcl 'exec' assigns special meaning to its argument when they begin with redirection, pipe or background operator. There are a number of invocations of 'exec' which construct arguments that are taken from the Git repository or a user input. However, when file names or ref names are taken from the repository, it is possible to find names that have these special forms. They must not be interpreted by 'exec' lest it redirects input or output, or attempts to build a pipeline using a command name controlled by the repository. Introduce a helper function that identifies such arguments and prepends "./" to force such a name to be regarded as a relative file name. Convert those 'exec' calls where the arguments can simply be packed into a list. Note that most commands containing the word 'exec' route through console::exec or console::chain, which we will treat in another commit. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Taylor Blau <me@ttaylorr.com>
28 lines
631 B
Tcl
28 lines
631 B
Tcl
# git-gui Misc. native Windows 32 support
|
|
# Copyright (C) 2007 Shawn Pearce
|
|
|
|
proc win32_read_lnk {lnk_path} {
|
|
return [safe_exec [list cscript.exe \
|
|
/E:jscript \
|
|
/nologo \
|
|
[file join $::oguilib win32_shortcut.js] \
|
|
$lnk_path]]
|
|
}
|
|
|
|
proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
|
|
global oguilib
|
|
|
|
set lnk_args [lrange $lnk_exec 1 end]
|
|
set lnk_exec [lindex $lnk_exec 0]
|
|
|
|
set cmd [list wscript.exe \
|
|
/E:jscript \
|
|
/nologo \
|
|
[file nativename [file join $oguilib win32_shortcut.js]] \
|
|
$lnk_path \
|
|
[file nativename [file join $oguilib git-gui.ico]] \
|
|
$lnk_dir \
|
|
$lnk_exec]
|
|
safe_exec [concat $cmd $lnk_args]
|
|
}
|