LoginSignup
1
0

More than 1 year has passed since last update.

Ubuntu環境のgitkを開いた瞬間にすぐクラッシュすることがある問題について

Posted at

問題

ある特定Gitリポジトリを可視化しようと gitk コマンドによってウインドウを立ち上げた。
しかし、何故かあるリポジトリのみ即時にクラッシュし、それ以外のリポジトリは正常に開ける。

環境は Ubuntu 20.04 LTS。 クラッシュ時には以下のようなメッセージが表示された。

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

原因と対応策

上記で説明があるように、絵文字(🍣とか)を gitk 上に表示しようとしてクラッシュしているらしい。
デバッグ結果を見る限り、絵文字として利用するフォントのピクセルが大きすぎて文字を表示しきれないエラーが生じているように見える。

デバッグ結果
$ XFT_DEBUG=1 gitk --all
XFT_DEBUG=1
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (13.3333 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (13.3333 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (13.3333 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 5 (13.3333 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 5 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 5 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc: 5 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: 5 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Medium.ttc: 0 (12 pixels)
XftFontInfoFill: /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc: 0 (12 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:  140 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  4236
  Current serial number in output stream:  4282

絵文字を使わないように、該当の絵文字フォントを削除することでも対応できるが、これを実施するとそれ以外の場面で絵文字が使えなくなってしまうため、別の方法で対処したい。

その方法の1つとしては、別のフォントをインストールする方法がある。
unifont をインストールすることで、gitk 上の絵文字は豆腐文字として表示されるようにはなるが、クラッシュすることはなくなる。

$ sudo apt install unifont

ちなみに、今回この現象は Gatsby が自動生成する README.md をコミットしたことによって発生した。
一部抜粋すると、以下のように 🚀 の絵文字が使われていることが分かる。

## 🚀 Quick start

1.  **Create a Gatsby site.**

    Use the Gatsby CLI to create a new site, specifying the minimal TypeScript starter.

    ```shell
    # create a new Gatsby site using the minimal TypeScript starter
    npm init gatsby
    ```
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0