Homebrew-core: Mojave: Git uses broken tcl-tk (proposed workaround)

Created on 17 May 2019  路  7Comments  路  Source: Homebrew/homebrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • [x] are reporting a bug others will be able to reproduce and not asking a question or requesting software. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh. To get software added or changed in Homebrew please file a Pull Request
  • [x] have a problem with brew install (or upgrade, reinstall) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ ] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)
  • What happened (include command output)
  • What you expected to happen
  • Step-by-step reproduction instructions (by running brew install commands)

I would have commented on the existing issue but since it has been locked I have to create a new issue instead.

Since it is not acceptable to add a tcl-tk dependency on git, I propose to detect the presence of homebrew tcl-tk when running git-gui and using the correct wish binary then.
Would such a patch be acceptable?

I have worked around the broken git-gui dialog boxes by editing the libexec/git-core/git-gui script to invoke homebrew wish instead of the system one. I tried changing the wish binary that is invoked to /usr/local/opt/tcl-tk/bin/wish instead but that gave me some errors. Therefore I add a symlink to the tcl-tk wish binary inside the share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish.homebrew directory and invoke that instead of share/git-gui/lib/Git Gui.app/Contents/MacOS/Wish.

Having to create the symlink inside share/git-gui/lib/Git Gui.app/Contents/MacOS/ is not ideal but I can't think of a better solution right now that doesn't add the tcl-tk dependency.

Fixed git-gui (which produces a working dialog box if tcl-tk is installed and an empty window if tcl-tk is missing:

#!/bin/sh
if test "z$*" = zversion ||
   test "z$*" = z--version
then
    echo 'git-gui version 0.21.GITGUI'
else
    libdir="${GIT_GUI_LIB_DIR:-/usr/local/Cellar/git/2.21.0/share/git-gui/lib}"
    wish="$libdir/Git Gui.app/Contents/MacOS/Wish"
    if [ -e "$wish.homebrew" ]; then
        echo "Using homebrew version of tcl-tk"
        wish="$wish.homebrew";
    elif [ -e "$(brew --prefix tcl-tk)/bin/wish" ]; then
        echo "Creating Wish.homebrew link in Git Gui.app to work around https://github.com/Homebrew/homebrew-core/issues/36390"
        ln -sf "$(brew --prefix tcl-tk)/bin/wish" "$wish.homebrew"
        wish="$wish.homebrew"
    else
        echo "WARNING: git-gui is probably using the broken macOS tcl-tk"
    fi
    exec "$wish" "$0" "$@"
fi
outdated

Most helpful comment

This would be great to get to work! I just upgraded to Catalina, and I'm getting the warning that Tcl/Tk will probably be removed from MacOSX.

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

All 7 comments

Since it is not acceptable to add a tcl-tk dependency on git, I propose to detect the presence of homebrew tcl-tk when running git-gui and using the correct wish binary then.
Would such a patch be acceptable?

It's hard to say without reviewing a pull request but: perhaps. Could you create one and CC me? Thanks!

@arichardson is there still progress on this? Can I help in any way?

@walski I haven't had time in the last few weeks to work on this. I haven't looked at the git formula in detail but I think it shouldn't be too hard to edit the libexec/git-core/git-gui either after install or before the build.

There is some related discussion in https://github.com/Homebrew/homebrew-core/issues/41338.

wish="$libdir/Git Gui.app/Contents/MacOS/Wish"

https://docs.brew.sh/Acceptable-Formulae#stuff-that-builds-an-app is worth noting here.

I would suggest we remove git-gui if it's not functional (and gitk if that applies too) and they could be a cask instead. We should add caveats if we do this and point people in the right direction to an alternative (e.g. brew cask install fork for a decent alternative).

@MikeMcQuaid https://github.com/Homebrew/homebrew-core/pull/42789 removes the .app, but still keeps git-gui functional. Is that an acceptable solution?

This would be great to get to work! I just upgraded to Catalina, and I'm getting the warning that Tcl/Tk will probably be removed from MacOSX.

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

This whole discussion seems to have stalled ... We found no common ground for a fix. Different things have been proposed but right now nothing looks maintainable by our team. I'll just close this, and we will leave the situation as-is.

Tcl-tk is being phased out from mac, I agree. But we really can't add the homebrew tcl-tk dependency to git.

Maybe a solution would be to have second git formula, called git-tcl-tk, with the needed bells and whistles, for those who really need it.

Was this page helpful?
0 / 5 - 0 ratings