From: Mark Levedahl <mlevedahl@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, johannes.schindelin@gmx.de, me@yadavpratyush.com
Subject: Re: BUG: git-gui no longer executes hook scripts
Date: Fri, 15 Sep 2023 19:33:55 -0400 [thread overview]
Message-ID: <454d8b7b-96df-ec8f-2285-e022de66c66c@gmail.com> (raw)
In-Reply-To: <xmqq5y4bgxy1.fsf@gitster.g>
On 9/15/23 13:15, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Shouldn't this "is it absolute" check with "$cmd" also check if $cmd
>> has either forward or backward slash in it?
>>
>> Checking the use of _which with fixed arguments, it is used to spawn
>> git, gitk, nice, sh; and _which finding where they appear on the
>> search path does sound sane. But _which does not seem to have the "if
>> given a command with directory separator, the search path does not
>> matter. The caller means it is relative to the $cwd" logic at all,
>> so it seems it is the callers responsibility to make sure it does
>> not pass things like ".git/hooks/pre-commit" to it.
> In other words, something along this line may go in the right
> direction (I no longer speak Tcl, and this is done with manual in
> one hand, while typing with the other hand).
>
I think a simpler fix is just to examine the number of path components -
more than one means a relative or absolute command (/foo splits into two
parts). The below works for me on Linux.
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 277a2b1c8c..0c39d9fa26 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -118,7 +118,7 @@ proc sanitize_command_line {command_line from_index} {
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"
We could also wrap the entirety of commit aae9560a in
if {[is_Windows]} { ... }
as all of this code is fixing a Windows specific vulnerability, though a
fix like the above is needed regardless.
Mark
next prev parent reply other threads:[~2023-09-15 23:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 16:45 BUG: git-gui no longer executes hook scripts Mark Levedahl
2023-09-15 17:00 ` Junio C Hamano
2023-09-15 17:15 ` Junio C Hamano
2023-09-15 23:33 ` Mark Levedahl [this message]
2023-09-16 0:35 ` [PATCH] git-gui - re-enable use of " Mark Levedahl
2023-09-16 17:28 ` Junio C Hamano
2023-09-16 21:01 ` [PATCH v2] " Mark Levedahl
2023-09-16 21:51 ` Junio C Hamano
2023-09-17 19:22 ` Mark Levedahl
2023-09-17 19:24 ` [PATCH] git-gui - use git-hook, honor core.hooksPath Mark Levedahl
2023-09-18 15:27 ` Johannes Schindelin
2023-09-18 15:58 ` Junio C Hamano
2023-09-18 16:25 ` Mark Levedahl
2023-09-18 17:53 ` Junio C Hamano
2023-09-20 13:05 ` Pratyush Yadav
2023-09-20 15:30 ` Mark Levedahl
2023-09-20 16:58 ` Junio C Hamano
2023-09-20 15:49 ` Junio C Hamano
2023-09-18 15:26 ` [PATCH v2] git-gui - re-enable use of hook scripts Johannes Schindelin
2023-09-18 16:04 ` Junio C Hamano
2023-09-20 13:27 ` Pratyush Yadav
2023-09-16 4:45 ` BUG: git-gui no longer executes " Junio C Hamano
2023-09-16 12:56 ` Mark Levedahl
2023-09-16 14:49 ` Mark Levedahl
2023-09-16 17:31 ` Junio C Hamano
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=454d8b7b-96df-ec8f-2285-e022de66c66c@gmail.com \
--to=mlevedahl@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=me@yadavpratyush.com \
/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).