Opened 3 years ago
Last modified 2 years ago
#64249 reopened defect
git gui opens a window with no usable content
Reported by: | akimd (Akim Demaille) | Owned by: | ci42 |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | monterey | Cc: | herbygillot (Herby Gillot), chrstphrchvz (Christopher Chavez), zman0900 (Dan Ziemba), telotortium (Robert Irelan) |
Port: | git |
Description
On 12.1, git gui opens a window with four different panes (the list of files, the diffs etc.) but all of them are black. It's not usable at all. I'm in dark mode.
Attachments (2)
Change History (17)
Changed 3 years ago by akimd (Akim Demaille)
Attachment: | git gui.png added |
---|
comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | herbygillot added |
---|---|
Keywords: | monterey added |
Owner: | set to ci42 |
Status: | new → assigned |
comment:2 Changed 3 years ago by chrstphrchvz (Christopher Chavez)
git gui is using Tcl/Tk Aqua 8.5.9 included in macOS, which is very old and appears to be unusable on macOS 12. Since macOS 10.15, the system Tcl/Tk has been deprecated and is likely to be removed in future macOS (as warned on the command line).
If git gui is using wish
from PATH
, then installing MacPorts’ tk (either the +quartz or +x11 variant is fine) may work around this issue.
If git gui and gitk should always be using MacPorts’ Tcl/Tk, it may be desirable to separate them from the git port, so that git itself isn’t dependent on Tcl/Tk ports.
comment:3 Changed 3 years ago by chrstphrchvz (Christopher Chavez)
Cc: | chrstphrchvz added |
---|
comment:4 Changed 3 years ago by akimd (Akim Demaille)
Hi Christopher, git gui is hard-coded to use its own Wish:
$ cat /opt/local/libexec/git-core/git-gui #!/bin/sh if test "z$*" = zversion || test "z$*" = z--version then echo 'git-gui version 0.21.0.99.gdf4f9e' else libdir="${GIT_GUI_LIB_DIR:-/opt/local/share/git-gui/lib}" exec "$libdir/Git Gui.app/Contents/MacOS/Wish" "$0" "$@" fi
But this Wish (which is a universal binary) appears to be doing something special. Just replacing it with macport's does not work. It execs
exec '/opt/local/share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish' /opt/local/libexec/git-core/git-gui
Yes, it is passing the above shell script to that Wish, which appears to handle it in a special way. The regular wish won't grok it.
$ /opt/local/bin/wish /opt/local/libexec/git-core/git-gui Error in startup script: invalid bareword "test" in expression "test"; should be "$test" or "{test}" or "test(...)" or ... (parsing expression "test") invoked from within "if test "z$*" = zversion ||" (file "/opt/local/libexec/git-core/git-gui" line 2)
I have no idea what needs to be passed to it. My best try won't work.
$ /opt/local/bin/wish /opt/local/share/git-gui/lib/git-gui.tcl -- browser usage: /opt/local/share/git-gui/lib/git-gui.tcl [{blame|browser|citool}]
I don't understand what it wants and how my command line is incorrect.
comment:5 Changed 3 years ago by chrstphrchvz (Christopher Chavez)
Did you try $ /opt/local/bin/wish /opt/local/share/git-gui/lib/git-gui.tcl browser
(no --
)?
Git Gui.app/Contents/MacOS/Wish
appears to be copied from /System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish
during build.
If building Git Gui.app is desirable, I’m not aware whether it requires Tk to be built as a framework, which MacPorts Tk currently does not do. (Homebrew does not build Tk as a framework either, and they opted to not provide Git Gui.app: https://github.com/Homebrew/homebrew-core/commit/dfa3ccf1e7d3)
comment:6 Changed 3 years ago by akimd (Akim Demaille)
Yes, I had tried that, to no avail.
It turns out that this git-gui.tcl script makes stupid and useless error messages. In most situations of errors it just dumps this stupid usage message instead of forging a genuine error message that tells what it's unhappy about. And once you hacked your way into the script and add details, you find out that this script looks at its name (argv[0]) to decide what to do. And it is taught to recognize git-gui
, not git-gui.tcl
...
So I have ln -s git-gui.tcl git-gui
and now /opt/local/bin/wish /opt/local/share/git-gui/lib/git-gui
works properly (no argument such as browser is needed).
I don't understand how
$ cat /opt/local/libexec/git-core/git-gui #!/bin/sh if test "z$*" = zversion || test "z$*" = z--version then echo 'git-gui version 0.21.0.99.gdf4f9e' else libdir="${GIT_GUI_LIB_DIR:-/opt/local/share/git-gui/lib}" exec "$libdir/Git Gui.app/Contents/MacOS/Wish" "$0" "$@" fi
works exactly, but there appears to be some magic in $libdir/Git Gui.app/Contents/MacOS/Wish on the way it groks $0. If you do the obvious thing (replace that Wish with /opt/local/bin/wish) it fails, and the error message shows that tcl was really try to read $0, i.e., a shell script, and failed:
$ git gui Error in startup script: invalid bareword "test" in expression "test"; should be "$test" or "{test}" or "test(...)" or ... (parsing expression "test") invoked from within "if test "z$*" = zversion ||" (file "/opt/local/libexec/git-core/git-gui" line 2)
So we still need to find a way for /opt/local/libexec/git-core/git-gui
to work out of the box. The obvious
$ cat /opt/local/libexec/git-core/git-gui #!/bin/sh if test "z$*" = zversion || test "z$*" = z--version then echo 'git-gui version 0.21.0.99.gdf4f9e' else libdir="${GIT_GUI_LIB_DIR:-/opt/local/share/git-gui/lib}" exec "/opt/local/bin/wish" "$libdir/git-gui" "$@" fi
works.
comment:7 Changed 3 years ago by zman0900 (Dan Ziemba)
Cc: | zman0900 added |
---|
comment:8 Changed 3 years ago by chrstphrchvz (Christopher Chavez)
I believe #64925 is a duplicate of this
comment:9 Changed 3 years ago by gma-uw (gma1)
Thanks for the redirect to this.
FYI, I made the suggested symlink on my machine as follows
ln -s /opt/local/share/git-gui/lib/git-gui.tcl /opt/local/share/git-gui/lib/git-gui
Then I get this strange behavior:
/opt/local/bin/wish /opt/local/share/git-gui/lib/git-gui.tcl FAILS
/opt/local/bin/wish /opt/local/share/git-gui/lib/git-gui WORKS
At least something works, but I have no idea why.
comment:10 Changed 3 years ago by mohd-akram (Mohamed Akram)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:11 Changed 3 years ago by zman0900 (Dan Ziemba)
With git 2.35.3_0 installed on MacOS 12.3.1 x86_64, running either gitk
or git gui
still results in an unusable, mostly black window.
comment:12 Changed 3 years ago by zman0900 (Dan Ziemba)
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Both still output deprecation warning about system tk. gitk
also shows this error after closing the window:
Error in startup script: can't invoke "tk" command: application has been destroyed while executing "tk windowingsystem" invoked from within "if {[tk windowingsystem] eq "win32"} { focus -force . }" (file "/opt/local/bin/gitk" line 12697)
comment:13 Changed 3 years ago by telotortium (Robert Irelan)
Cc: | telotortium added |
---|
comment:14 Changed 3 years ago by telotortium (Robert Irelan)
On my computer (macOS Monterey 12.3.1 M1), the issue is fixed for me by installed tk
with the quartz
variant - the x11
variant doesn't work for me. I have XQuartz installed (from http://xquartz.org I believe).
Changed 2 years ago by gagarine (Simon)
Attachment: | Screenshot 2022-06-09 at 16.32.48.png added |
---|
gitk on MacOS in dark
Screenshot