git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/3] gitk: limit PATH search to bare executable names

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Apr 1, 2025, 03:01 UTC
Message-ID
<20250401030102.297272-4-mlevedahl@gmail.com>
In-Reply-To
<20250401030102.297272-1-mlevedahl@gmail.com>
The path search overrides used by gitk on Windows are applied to any
executable whose name is not 'absolute', meaning that
	[exec foo/bar ...]
will search each element of $PATH to find one with subdirectory foo
containing bar. But, per POSIX, and Tcl implementation on all platforms,
foo/bar is taken as $(pwd)/foo/bar, and is not searched on $PATH.

Fix this descrepency using the same approach applied to git-gui in commit 3f71c97e. The key is that the executable name must have no path component, indicated by [file split $exename] having array length 1.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gitk b/gitk
index e4d0500..e38e071 100755
--- a/gitk
+++ b/gitk
@@ -58,7 +58,7 @@ if {[is_Windows]} {
 		set i $from_index
 		while {$i < [llength $command_line]} {
 			set cmd [lindex $command_line $i]
-			if {[file pathtype $cmd] ne "absolute"} {
+			if {[llength [file split $cmd]] < 2} {
 				set fullpath [_which $cmd]
 				if {$fullpath eq ""} {
 					throw {NOT-FOUND} "$cmd not found in PATH"
-- 
2.49.0.99.31
Previous: Mark LevedahlNext: Johannes Schindelin
Message 10 of 13 in “git v2.49.0 - gitk regression on Cygwin”
  1. Mark LevedahlMar 28, 2025
  2. Johannes SixtMar 28, 2025
  3. Mark LevedahlMar 29, 2025
  4. gitk - override $PATH search only on WindowsMark Levedahl, Mar 31, 2025
  5. Johannes SixtMar 31, 2025
  6. Mark LevedahlMar 31, 2025
  7. 0/3 gitk: override PATH search only on WindowsMark Levedahl, Apr 1, 2025
  8. 1/3 gitk: override $PATH search only on WindowsMark Levedahl, Apr 1, 2025
  9. 2/3 gitk: _search_exe is no longer neededMark Levedahl, Apr 1, 2025
  10. 3/3 gitk: limit PATH search to bare executable namesMark Levedahl, Apr 1, 2025
  11. Johannes SchindelinApr 1, 2025
  12. Mark LevedahlApr 1, 2025
  13. Johannes SixtApr 1, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.