[MacPorts] #64249: git gui opens a window with no usable content

MacPorts noreply at macports.org
Wed Dec 22 06:22:11 UTC 2021


#64249: git gui opens a window with no usable content
---------------------+----------------------
  Reporter:  akimd   |      Owner:  ci42
      Type:  defect  |     Status:  assigned
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:  2.7.1
Resolution:          |   Keywords:  monterey
      Port:  git     |
---------------------+----------------------

Comment (by akimd):

 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.

-- 
Ticket URL: <https://trac.macports.org/ticket/64249#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list