From: Mark Levedahl <mlevedahl@gmail.com>
To: j6t@kdbg.org, johannes.schindelin@gmx.de
Cc: git@vger.kernel.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH v2 3/3] gitk: limit PATH search to bare executable names
Date: Mon, 31 Mar 2025 23:01:02 -0400 [thread overview]
Message-ID: <20250401030102.297272-4-mlevedahl@gmail.com> (raw)
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
next prev parent reply other threads:[~2025-04-01 3:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 12:34 git v2.49.0 - gitk regression on Cygwin Mark Levedahl
2025-03-28 17:30 ` Johannes Sixt
2025-03-29 21:49 ` Mark Levedahl
2025-03-31 15:12 ` [PATCH] gitk - override $PATH search only on Windows Mark Levedahl
2025-03-31 17:12 ` Johannes Sixt
2025-03-31 19:29 ` Mark Levedahl
2025-04-01 3:00 ` [PATCH v2 0/3] gitk: override PATH " Mark Levedahl
2025-04-01 3:01 ` [PATCH v2 1/3] gitk: override $PATH " Mark Levedahl
2025-04-01 3:01 ` [PATCH v2 2/3] gitk: _search_exe is no longer needed Mark Levedahl
2025-04-01 3:01 ` Mark Levedahl [this message]
2025-04-01 16:10 ` [PATCH v2 0/3] gitk: override PATH search only on Windows Johannes Schindelin
2025-04-01 16:44 ` Mark Levedahl
2025-04-01 16:40 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250401030102.297272-4-mlevedahl@gmail.com \
--to=mlevedahl@gmail.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).