Repository: ghostty-org/ghostty

Issue #3083: Crash on common codepoints in tmux / vim powerline glyphs
Created: 2024-12-23T08:48:35Z
When attempting to start tmux or vim with configs that make use of powerline chevron glyphs, ghostty segfaults under GTK. The last messages I get prior to segfault are:
(ghostty:637300): Gtk-WARNING **: 09:40:19.766: AdwGizmo 0x24c50410 (tabboxchild) reported min width -6, but sizes must be >= 0
warning(stream): unimplemented mode: 7727
warning(stream): unimplemented mode: 7727
warning(stream): unimplemented mode: 7727
zsh: segmentation fault (core dumped)  ./result/bin/ghostty

At least the following glyph appears to be responsible, based on others reports I believe they are nf-cod-chevron_{left,right}:
$ cat testfile

$ cat -A testfile
M-nM-^BM-1$

According to a few others this is not reproducible in the debug build, only release fast.
The last snippet of my strace is:
getpid()                                = 637739
ioctl(18, DRM_IOCTL_I915_GEM_PIN, 0x7ffe86edf270) = 0
openat(AT_FDCWD, "/", O_RDONLY|O_CLOEXEC) = 50
fcntl(50, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
dup3(32, 50, O_CLOEXEC)                 = 50
close(32)                               = 0
openat(AT_FDCWD, "/", O_RDONLY|O_CLOEXEC) = 32
fcntl(32, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
dup3(50, 32, O_CLOEXEC)                 = 32
close(33)                               = 0
getpid()                                = 637739
futex(0x1185a140, FUTEX_WAIT_PRIVATE, 3, NULL) = ?
+++ killed by SIGSEGV (core dumped) +++
zsh: segmentation fault (core dumped)  strace ./result/bin/ghostty

My version:
$ ./result/bin/ghostty --version
Ghostty 0.1.0-b920352-nix

Version
  - version: 0.1.0-b920352-nix
  - channel: tip
Build Config
  - Zig version: 0.13.0
  - build mode : builtin.OptimizeMode.ReleaseFast
  - app runtime: apprt.Runtime.gtk
  - font engine: font.main.Backend.fontconfig_freetype
  - renderer   : renderer.OpenGL
  - libxev     : main.Backend.io_uring
  - GTK version:
    build      : 4.16.3
    runtime    : 4.16.3
  - libadwaita : enabled
    build      : 1.6.2
    runtime    : 1.6.2

My git bisect resulted in the following commit being the issue:
b920352c397c274985420ffc68ab7b3e425f45b6 is the first bad commit
commit b920352c397c274985420ffc68ab7b3e425f45b6 (HEAD)
Author: Qwerasd <qwerasd205@users.noreply.github.com>
Date:   Sun Dec 22 15:57:07 2024 -0500

    deps: update z2d to v0.4.0

    Introduces static path methods and a reworked context API that makes
    things generally cleaner.

    This update incidentally fixed a bug we had before where the corner
    triangle shade characters were drawn solid rather than medium shade.

 build.zig.zon                    |   4 +--
 nix/zigCacheHash.nix             |   2 +-
 src/font/sprite/Box.zig          | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------
 src/font/sprite/Powerline.zig    |   2 +-
 src/font/sprite/canvas.zig       | 180 ++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------
 src/font/sprite/cursor.zig       |   2 +-
 src/font/sprite/testdata/Box.ppm | Bin 1048593 -> 1048593 bytes
 src/font/sprite/underline.zig    |   2 +-
 8 files changed, 185 insertions(+), 229 deletions(-)

Duplicate issue #3085: crash when opening file in neovim
Created: 2024-12-23T14:18:23Z
Ghostty keeps crashing when I when opening a file in neovim (LazyVim). Not sure when exactly the issue was introduced, as last working build was around 2 months old and I updated it today.
Build information
❯ ghostty --version
Ghostty 0.1.0-main+2e14017b

Version
  - version: 0.1.0-main+2e14017b
  - channel: tip
Build Config
  - Zig version: 0.13.0
  - build mode : builtin.OptimizeMode.ReleaseFast
  - app runtime: apprt.Runtime.gtk
  - font engine: font.main.Backend.fontconfig_freetype
  - renderer   : renderer.OpenGL
  - libxev     : main.Backend.io_uring
  - GTK version:
    build      : 4.16.7
    runtime    : 4.16.7
  - libadwaita : enabled
    build      : 1.6.2
    runtime    : 1.6.2

Steps to reproduce:

clone lazyvim git clone https://github.com/LazyVim/starter ~/.config/nvim
start nvim and open .config/nvim/lua/plugins/example.lua
ghostty will crash

Logs captured whern starting ghossty from command line
>  ghostty --config-default-files=true --font-size=12
info: ghostty version=0.1.0-main+2e14017b
info: ghostty build optimize=ReleaseFast
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.4.0
info: dependency fontconfig=21402
info: renderer=renderer.OpenGL
info: libxev backend=main.Backend.io_uring
info(os): setlocale from env result=LC_CTYPE=en_US.UTF-8;LC_NUMERIC=en_GB.UTF-8;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=en_GB.UTF-8;LC_ADDRESS=en_GB.UTF-8;LC_TELEPHONE=en_GB.UTF-8;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=en_GB.UTF-8
info(gtk): GTK version build=4.16.7 runtime=4.16.7
info: optional config file not found, not loading path=/home/piotr/.config/ghostty/config
info(config): default shell source=env value=/usr/bin/zsh
warning(sentry): crash report written to disk path=/home/piotr/.local/state/ghostty/crash/56c1fb9c-52a6-4e3b-2c45-2b0cd853e354.ghosttycrash
info(sentry): sentry envelope does not contain crash, discarding
EGL API version 1.5 found
 - Vendor: NVIDIA
 - Version: 1.5
 - Device: /dev/dri/renderD129, 226 129
 - Client APIs: OpenGL_ES OpenGL
 - Extensions:
        EGL_ANDROID_native_fence_sync
        EGL_EXT_buffer_age
        EGL_EXT_client_sync
        EGL_EXT_create_context_robustness
        EGL_EXT_image_dma_buf_import
        EGL_EXT_image_dma_buf_import_modifiers
        EGL_EXT_output_base
        EGL_EXT_present_opaque
        EGL_EXT_stream_acquire_mode
        EGL_EXT_sync_reuse
        EGL_IMG_context_priority
        EGL_KHR_config_attribs
        EGL_KHR_context_flush_control
        EGL_KHR_create_context
        EGL_KHR_create_context_no_error
        EGL_KHR_fence_sync
        EGL_KHR_get_all_proc_addresses
        EGL_KHR_gl_colorspace
        EGL_KHR_gl_renderbuffer_image
        EGL_KHR_gl_texture_2D_image
        EGL_KHR_gl_texture_3D_image
        EGL_KHR_gl_texture_cubemap_image
        EGL_KHR_image
        EGL_KHR_image_base
        EGL_KHR_image_pixmap
        EGL_KHR_no_config_context
        EGL_KHR_partial_update
        EGL_KHR_reusable_sync
        EGL_KHR_stream
        EGL_KHR_stream_attrib
        EGL_KHR_stream_consumer_gltexture
        EGL_KHR_stream_cross_process_fd
        EGL_KHR_stream_fifo
        EGL_KHR_stream_producer_eglsurface
        EGL_KHR_surfaceless_context
        EGL_KHR_swap_buffers_with_damage
        EGL_KHR_wait_sync
        EGL_MESA_image_dma_buf_export
        EGL_NV_nvrm_fence_sync
        EGL_NV_output_drm_flip_event
        EGL_NV_post_sub_buffer
        EGL_NV_quadruple_buffer
        EGL_NV_robustness_video_memory_purge
        EGL_NV_stream_attrib
        EGL_NV_stream_consumer_eglimage
        EGL_NV_stream_consumer_gltexture_yuv
        EGL_NV_stream_cross_display
        EGL_NV_stream_cross_object
        EGL_NV_stream_cross_process
        EGL_NV_stream_cross_system
        EGL_NV_stream_dma
        EGL_NV_stream_fifo_next
        EGL_NV_stream_fifo_synchronous
        EGL_NV_stream_flush
        EGL_NV_stream_metadata
        EGL_NV_stream_origin
        EGL_NV_stream_remote
        EGL_NV_stream_reset
        EGL_NV_stream_socket
        EGL_NV_stream_socket_inet
        EGL_NV_stream_socket_unix
        EGL_NV_stream_sync
        EGL_NV_system_time
        EGL_NV_triple_buffer
        EGL_WL_bind_wayland_display
        EGL_WL_wayland_eglstream
 - Selected fbconfig: R8G8B8A8, depth 0, stencil 0
          high depth: none
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
Using OpenGL backend EGL
info(gtk): libadwaita version build=1.6.2 runtime=1.6.2

(process:31575): Gtk-WARNING **: 14:16:28.565: Unknown key gtk-modules in /home/piotr/.config/gtk-4.0/settings.ini
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60 NVIDIA
Max texture size: 32768
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓
OpenGL version: 4.6 (core)
GLSL version: 4.60 NVIDIA
Max texture size: 32768
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓

(ghostty:31575): Gtk-WARNING **: 14:16:28.665: No IM module matching GTK_IM_MODULE=cedilla found
Creating EGL context version 3.3 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60 NVIDIA
Max texture size: 32768
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓
info(grid): loaded OpenGL 4.6
warning(io_exec): shell could not be detected, no automatic shell integration will be injected
warning(gtk): unimplemented action=apprt.action.Action.Key.cell_size
warning(gtk): unimplemented action=apprt.action.Action.Key.size_limit
info(io_exec): started subcommand path=/bin/sh pid=31603
info(io_exec): subcommand cgroup=-
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60 NVIDIA
Max texture size: 32768
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓
info(grid): reallocating GPU buffer old=0 new=8
info(grid): reallocating GPU buffer old=8 new=20
warning(stream): ignoring unimplemented CSI 22/23 t
info(grid): reallocating GPU buffer old=20 new=3063
warning(stream): ignoring CSI t with unimplemented parameter: ESC [  { 8, 25, 99 } t
info(font_codepoint_resolver): found codepoint 0x2002 in fallback face=DejaVu Sans Mono
[1]    31575 segmentation fault (core dumped)  ghostty --config-default-files=true --font-size=12

dmesg logs
[Mon Dec 23 13:54:19 2024] [  T11020] renderer[11020]: segfault at 0 ip 0000000000000000 sp 00007fceeffeda78 error 14 likely on CPU 4 (core 4, socket 0)
[Mon Dec 23 13:54:19 2024] [  T11020] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 13:59:38 2024] [  T19946] renderer[19946]: segfault at 0 ip 0000000000000000 sp 00007f8cfbfeda78 error 14 likely on CPU 4 (core 4, socket 0)
[Mon Dec 23 13:59:38 2024] [  T19946] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 13:59:52 2024] [  T20995] renderer[20995]: segfault at 0 ip 0000000000000000 sp 00007f10c5adaa78 error 14 likely on CPU 2 (core 2, socket 0)
[Mon Dec 23 13:59:52 2024] [  T20995] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:01:50 2024] [  T21387] renderer[21387]: segfault at 0 ip 0000000000000000 sp 00007f1903feda78 error 14 likely on CPU 11 (core 5, socket 0)
[Mon Dec 23 14:01:50 2024] [  T21387] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:04:04 2024] [  T21789] renderer[21789]: segfault at 0 ip 0000000000000000 sp 00007f27c1bafa78 error 14 likely on CPU 11 (core 5, socket 0)
[Mon Dec 23 14:04:04 2024] [  T21789] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:04:19 2024] [  T22262] renderer[22262]: segfault at 0 ip 0000000000000000 sp 00007f57ad3aea78 error 14 likely on CPU 10 (core 4, socket 0)
[Mon Dec 23 14:04:19 2024] [  T22262] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:06:31 2024] [  T22556] renderer[22556]: segfault at 0 ip 0000000000000000 sp 00007fa3a7feda78 error 14 likely on CPU 4 (core 4, socket 0)
[Mon Dec 23 14:06:31 2024] [  T22556] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:08:04 2024] [  T23115] renderer[23115]: segfault at 0 ip 0000000000000000 sp 00007fefbb5cfa78 error 14 likely on CPU 11 (core 5, socket 0)
[Mon Dec 23 14:08:04 2024] [  T23115] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:08:13 2024] [  T26149] renderer[26149]: segfault at 0 ip 0000000000000000 sp 00007fe6113aea78 error 14 likely on CPU 2 (core 2, socket 0)
[Mon Dec 23 14:08:13 2024] [  T26149] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:08:29 2024] [  T26461] renderer[26461]: segfault at 0 ip 0000000000000000 sp 00007f0095bafa78 error 14 likely on CPU 7 (core 1, socket 0)
[Mon Dec 23 14:08:29 2024] [  T26461] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:09:01 2024] [  T27010] renderer[27010]: segfault at 4 ip 0000000002f65810 sp 00007f6c4ffeda80 error 4 in ghostty[1f64810,26f8000+9bc000] likely on CPU 11 (core 5, socket 0)
[Mon Dec 23 14:09:01 2024] [  T27010] Code: 00 49 83 f8 08 0f 82 9e 05 00 00 4d 8d 58 f8 4d 89 da 49 c1 ea 03 49 ff c2 49 83 fb 38 0f 82 cf 04 00 00 4d 89 d3 49 21 d3 90 <4c> 8b 30 41 c6 04 1e 5c 48 8b 19 4c 8d 73 01 4c 89 31 4c 8b 30 41
[Mon Dec 23 14:10:15 2024] [  T27514] renderer[27514]: segfault at 7f47f4024750 ip 00007f47f4024750 sp 00007f4805feba90 error 15 likely on CPU 9 (core 3, socket 0)
[Mon Dec 23 14:10:15 2024] [  T27514] Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <00> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[Mon Dec 23 14:10:58 2024] [  T27829] renderer[27829]: segfault at 0 ip 0000000000000000 sp 00007f02c3fedac0 error 14 likely on CPU 4 (core 4, socket 0)
[Mon Dec 23 14:10:58 2024] [  T27829] Code: Unable to access opcode bytes at 0xffffffffffffffd6.
[Mon Dec 23 14:11:28 2024] [  T28160] renderer[28160]: segfault at 4 ip 0000000002f65810 sp 00007fb543feda80 error 4 in ghostty[1f64810,26f8000+9bc000] likely on CPU 9 (core 3, socket 0)
[Mon Dec 23 14:11:28 2024] [  T28160] Code: 00 49 83 f8 08 0f 82 9e 05 00 00 4d 8d 58 f8 4d 89 da 49 c1 ea 03 49 ff c2 49 83 fb 38 0f 82 cf 04 00 00 4d 89 d3 49 21 d3 90 <4c> 8b 30 41 c6 04 1e 5c 48 8b 19 4c 8d 73 01 4c 89 31 4c 8b 30 41
[Mon Dec 23 14:16:01 2024] [  T28610] renderer[28610]: segfault at 4 ip 0000000002f65810 sp 00007f7ae2deca80 error 4 in ghostty[1f64810,26f8000+9bc000] likely on CPU 5 (core 5, socket 0)
[Mon Dec 23 14:16:01 2024] [  T28610] Code: 00 49 83 f8 08 0f 82 9e 05 00 00 4d 8d 58 f8 4d 89 da 49 c1 ea 03 49 ff c2 49 83 fb 38 0f 82 cf 04 00 00 4d 89 d3 49 21 d3 90 <4c> 8b 30 41 c6 04 1e 5c 48 8b 19 4c 8d 73 01 4c 89 31 4c 8b 30 41
[Mon Dec 23 14:16:40 2024] [  T31601] renderer[31601]: segfault at 4 ip 0000000002f65810 sp 00007f48aefeca80 error 4 in ghostty[1f64810,26f8000+9bc000] likely on CPU 1 (core 1, socket 0)
[Mon Dec 23 14:16:40 2024] [  T31601] Code: 00 49 83 f8 08 0f 82 9e 05 00 00 4d 8d 58 f8 4d 89 da 49 c1 ea 03 49 ff c2 49 83 fb 38 0f 82 cf 04 00 00 4d 89 d3 49 21 d3 90 <4c> 8b 30 41 c6 04 1e 5c 48 8b 19 4c 8d 73 01 4c 89 31 4c 8b 30 41

Closing comment (2024-12-23T14:46:00Z): Likely duplicate of #3083