42

I'm able to open gitk but it crashes as soon as I open a commit whom changes contains an emoji (not the commit message).

Error

❯ gitk --all
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  6687
  Current serial number in output stream:  6706

Env

❯ cat /etc/os-release --plain
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal

Git

❯ git --version git version 2.25.1

Examples

6e05ecd add v3->v4 migration script to update variables https://github.com/rafaelrinaldi/pure/pull/271/commits/6e05ecdad0e4f623050e154e16c0af0315767940

Questions

I tried various things:

  • removing ~/.Xresources config related to fonts
  • editing then removing ~/.config/fontconfig/conf.d/30-icons.conf

Without success, most of the issues I found were related to st terminal. However, I'm not using it but guake, and the issue also happened with yakuake, gnome-terminal and hyper

How could I fix this?

4 Answers 4

42

As suggested in https://bugs.launchpad.net/ubuntu/+source/git/+bug/1852985/comments/11, I am able to stop gitk from crashing by installing unifont:

sudo apt install unifont

Like in the comment, the emoji is displayed in gitk as an empty square, but gitk no longer crashes.

2
  • 4
    Nice! This is much better solution since removing fonts-noto-color-emoji removes emojis in other apps e.g. chrome. Commented Sep 14, 2021 at 10:01
  • Worked on Ubuntu 20.04 but broke emojis in Chrome bookmarks (and probably elsewhere). Commented Jun 6, 2022 at 9:47
34

After digging with XFT_DEBUG flag I found something weird. I run the command with the flag and navigate to the problematic commit:

❯ XFT_DEBUG=1 gitk --all
XFT_DEBUG=1
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Medium.ttf: 0 (15.9999 pixels)
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Medium.ttf: 0 (15.9999 pixels)
…
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Medium.ttf: 0 (17.5999 pixels)
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSans-Bold.ttf: 0 (17.5999 pixels)
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoSansSymbols2-Regular.ttf: 0 (17.5999 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 2 (17.5999 pixels)
XftFontInfoFill: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: 0 (17.5999 pixels)
XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: 0 (109 pixels)
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  6687
  Current serial number in output stream:  6706

Then spotted the last line prior to the fail had an excentric pixel size

XftFontInfoFill: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: 0 (17.5999 pixels)

XftFontInfoFill: /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf: 0 (109 pixels)

Removing the Noto-color-emoji fonts solved the issue

apt remove --purge fonts-noto-color-emoji

No more crash and a consistent font size is used to render

XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 2 (17.5999 pixels)

Version

❯ apt show fonts-noto-color-emoji
…
Version: 0~20200408-1
2
  • 5
    This answer is not perfect. While it helped with gitk it also removed emojis in other apps e.g. chrome. Commented Sep 14, 2021 at 10:02
  • You can't easily remove this package in KDE neon, as neon-desktop depends on it. I ended up temporarily removing the font package with sudo dpkg -P --force-depends fonts-noto-color-emoji, re-doing commit of script suggested by github actions with emojis removed from comments, force-push the new git history to github, and reinstalling the fonts-noto-color-emoji package to fix packaging system. What a trap, just because of some emojis in YML config file... facepalm. Thank you for your answer, it was essential to make me figure out solution.
    – Ped7g
    Commented Sep 10, 2022 at 23:05
13

From my research, this appears to be a bug in xorg library "libXft" (see issue libxft#6 and pending merge request libxft!1).

Related discussions:

  • Bug report on noto-emoji (noto-emoji#183). Conclusion: It's not a noto-emoji bug.
  • A launchpad.net bug report against Ubuntu's git package.
  • This thread on a git mailing list.

As per Édouard's answer, a workaround is to uninstall the fonts-noto-color-emoji package (apt remove --purge fonts-noto-color-emoji).

1
  • Removing fonts-noto-color-emoji may remove emojis in other apps e.g. chrome. Try unifont answer which does not have that issue for me. Commented Sep 14, 2021 at 10:03
2

On Fedora, I was able to fix a similar error I was getting with git-gui, by removing the google-noto-emoji-color-fonts package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .