Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alacritty crashes when closed. Hyprland, Wayland #7146

Closed
pd2s opened this issue Aug 16, 2023 · 50 comments · Fixed by rust-windowing/glutin#1632
Closed

alacritty crashes when closed. Hyprland, Wayland #7146

pd2s opened this issue Aug 16, 2023 · 50 comments · Fixed by rust-windowing/glutin#1632

Comments

@pd2s
Copy link

pd2s commented Aug 16, 2023

Steps to reproduce

  1. open alacritty
  2. close alacritty

Expected behavior

Alacritty closes

Actual behavior

crash

System

OS: Arch Linux (kernel 6.4.10-zen2-1-zen)
Version: alacritty 0.12.2 (9d9982d)
Compositor: Hyprland

Logs

Created log file at "/tmp/Alacritty-3985.log"
[0.000000870s] [INFO ] [alacritty] Welcome to Alacritty
[0.000026360s] [INFO ] [alacritty] Version 0.12.2 (9d9982d)
[0.000031220s] [INFO ] [alacritty] Running on Wayland
[0.000183220s] [INFO ] [alacritty] Configuration files loaded from:
"/home/user/.config/alacritty/alacritty.yml"
[0.049363487s] [INFO ] [alacritty] Using EGL 1.5
[0.051254478s] [ERROR] [sctk_adwaita] XDG Settings Portal did not return response in time: timeout: 100ms, key: color-scheme
[0.058066502s] [TRACE] [crossfont] Number of fonts is 167
[0.058088242s] [TRACE] [crossfont] Got font path="/usr/share/fonts/noto/NotoSans-Bold.ttf", index=0
[0.058133342s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.062155994s] [INFO ] [alacritty] Window scale factor: 1
[0.098153124s] [DEBUG] [alacritty] Loading "Cascadia Mono" font
[0.098748704s] [TRACE] [crossfont] Number of fonts is 169
[0.098766484s] [TRACE] [crossfont] Got font path="/usr/share/fonts/TTF/CascadiaMono.ttf", index=0
[0.098802854s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.100419245s] [TRACE] [crossfont] Number of fonts is 167
[0.100434975s] [TRACE] [crossfont] Got font path="/usr/share/fonts/TTF/CascadiaMono.ttf", index=393216
[0.100478015s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.102089356s] [TRACE] [crossfont] Number of fonts is 170
[0.102104266s] [TRACE] [crossfont] Got font path="/usr/share/fonts/TTF/CascadiaMonoItalic.ttf", index=0
[0.102135896s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.103806807s] [TRACE] [crossfont] Number of fonts is 168
[0.103821397s] [TRACE] [crossfont] Got font path="/usr/share/fonts/TTF/CascadiaMonoItalic.ttf", index=393216
[0.103857297s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.163398790s] [INFO ] [alacritty] Running on NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
[0.163411160s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.164833451s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.169027953s] [INFO ] [alacritty] Cell size: 19 x 38
[0.169037493s] [INFO ] [alacritty] Padding: 0 x 0
[0.169041903s] [INFO ] [alacritty] Width: 800, Height: 600
[0.169150793s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 182, g: 182, b: 182 } to Rgb { r: 120, g: 120, b: 120 }
[0.169159753s] [TRACE] [alacritty] Deriving dim colors from normal colors
[0.169163543s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 0, g: 0, b: 0 } to Rgb { r: 0, g: 0, b: 0 }
[0.169167693s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 153, g: 0, b: 0 } to Rgb { r: 100, g: 0, b: 0 }
[0.169171533s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 0, g: 166, b: 0 } to Rgb { r: 0, g: 109, b: 0 }
[0.169175923s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 153, g: 153, b: 0 } to Rgb { r: 100, g: 100, b: 0 }
[0.169180113s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 0, g: 0, b: 178 } to Rgb { r: 0, g: 0, b: 117 }
[0.169184303s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 178, g: 0, b: 178 } to Rgb { r: 117, g: 0, b: 117 }
[0.169188443s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 0, g: 166, b: 178 } to Rgb { r: 0, g: 109, b: 117 }
[0.169192483s] [TRACE] [alacritty_terminal] Scaling RGB by 0.66 from Rgb { r: 191, g: 191, b: 191 } to Rgb { r: 126, g: 126, b: 126 }
[0.169197293s] [INFO ] [alacritty] PTY dimensions: 15 x 42
[0.170674494s] [INFO ] [alacritty] Initialisation complete
[0.171534584s] [TRACE] [crossfont] Number of fonts is 169
[0.172085635s] [TRACE] [crossfont] Number of fonts is 167
[0.172631735s] [TRACE] [crossfont] Number of fonts is 170
[0.173176275s] [TRACE] [crossfont] Number of fonts is 168
[0.173223045s] [INFO ] [alacritty] Font size changed to Size(48) with scale factor of 1
[0.173229555s] [INFO ] [alacritty] Cell size: 19 x 38
[0.173242155s] [DEBUG] [alacritty_terminal] New num_cols is 42 and num_lines is 10
[0.176676017s] [INFO ] [alacritty] Padding: 0 x 0
[0.176684147s] [INFO ] [alacritty] Width: 800, Height: 600
[0.176699347s] [TRACE] [alacritty_terminal] Carriage return
[0.176713667s] [TRACE] [alacritty_terminal] Linefeed
[0.177474488s] [TRACE] [alacritty_terminal] Setting mode: BracketedPaste
[0.182479500s] [TRACE] [alacritty_terminal] Setting title to 'Some("~")'
[0.182490000s] [TRACE] [alacritty_terminal] Setting attribute: Foreground(Named(Black))
[0.182495820s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182500170s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182504660s] [TRACE] [alacritty_terminal] Carriage return
[0.182510380s] [TRACE] [alacritty_terminal] Setting attribute: Foreground(Named(BrightGreen))
[0.182515370s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182519660s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182524140s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182528390s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182532600s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182536690s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182540720s] [TRACE] [alacritty_terminal] Setting attribute: Foreground(Named(Green))
[0.182547600s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182551790s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182556110s] [TRACE] [alacritty_terminal] Configuring charset G0 as Ascii
[0.182560440s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.182564960s] [TRACE] [alacritty_terminal] Clearing line: Right
[0.182569380s] [TRACE] [alacritty_terminal] Carriage return
[0.182573800s] [TRACE] [alacritty_terminal] Moving forward: 11
[0.220945411s] [TRACE] [crossfont] Number of fonts is 169
[0.221510242s] [TRACE] [crossfont] Number of fonts is 167
[0.222062092s] [TRACE] [crossfont] Number of fonts is 170
[0.222611072s] [TRACE] [crossfont] Number of fonts is 168
[0.222647892s] [INFO ] [alacritty] Font size changed to Size(48) with scale factor of 1
[0.222654052s] [INFO ] [alacritty] Cell size: 19 x 38
[0.222663382s] [DEBUG] [alacritty_terminal] New num_cols is 50 and num_lines is 10
[0.228502306s] [INFO ] [alacritty] Padding: 0 x 0
[0.228512126s] [INFO ] [alacritty] Width: 958, Height: 538
warning: queue 0x7f5d78000ca0 destroyed while proxies still attached:
zwp_primary_selection_offer_v1@4278190082 still attached
wl_data_offer@4278190080 still attached
zwp_primary_selection_device_v1@26 still attached
zwp_primary_selection_device_manager_v1@22 still attached
wl_data_device@25 still attached
wl_seat@24 still attached
wl_data_device_manager@23 still attached
wl_registry@21 still attached
warning: queue 0x55963971e5c0 destroyed while proxies still attached:
xdg_wm_base@38 still attached
wl_output@16 still attached
wl_output@15 still attached
wp_fractional_scale_manager_v1@14 still attached
xdg_activation_v1@13 still attached
zwp_text_input_manager_v3@12 still attached
zwp_relative_pointer_manager_v1@11 still attached
zwp_pointer_constraints_v1@10 still attached
zxdg_decoration_manager_v1@9 still attached
wl_seat@8 still attached
wp_viewporter@7 still attached
wl_subcompositor@6 still attached
wl_compositor@5 still attached
wl_shm@4 still attached
wl_registry@2 still attached
[3.401194155s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-3985.log"
fish: Job 1, 'alacritty -vvv' terminated by signal SIGSEGV (Address boundary error)

Coredump

core.alacritty.1000.b9e9f6d8863e44978041ef467da814e5.3985.1692193963000000.zip

            Stack trace of thread 3985:
            #0  0x00007f5d7e15c415 n/a (libwayland-client.so + 0x8415)
            #1  0x00007f5d7e15c573 n/a (libwayland-client.so + 0x8573)
            #2  0x00007f5d7e15e132 wl_proxy_marshal_array_flags (libwayland-client.so + 0xa132)
            #3  0x00007f5d7e15ebda wl_proxy_marshal_flags (libwayland-client.so + 0xabda)
            #4  0x00007f5d7d5a452f n/a (libnvidia-egl-wayland.so.1 + 0x852f)
            #5  0x00007f5d7d5a710f n/a (libnvidia-egl-wayland.so.1 + 0xb10f)
            #6  0x00007f5d7d2acdd0 n/a (libEGL_nvidia.so.0 + 0xacdd0)
            #7  0x00007f5d7d2a2c20 n/a (libEGL_nvidia.so.0 + 0xa2c20)
            #8  0x00007f5d7dc40cc6 n/a (libc.so.6 + 0x40cc6)
            #9  0x00007f5d7dc40e10 exit (libc.so.6 + 0x40e10)
            #10 0x00007f5d7dc27cd7 n/a (libc.so.6 + 0x27cd7)
            #11 0x00007f5d7dc27d8a __libc_start_main (libc.so.6 + 0x27d8a)
            #12 0x00005596383a01b5 n/a (alacritty + 0x8a1b5)

            Stack trace of thread 4008:
            #0  0x00007f5d7dd039df __poll (libc.so.6 + 0x1039df)
            #1  0x00007f5d76934caf n/a (libnvidia-eglcore.so.535.98 + 0x1534caf)
            #2  0x00007f5d7693361a n/a (libnvidia-eglcore.so.535.98 + 0x153361a)
            #3  0x00007f5d7dc8c9eb n/a (libc.so.6 + 0x8c9eb)
            #4  0x00007f5d7dd1123c n/a (libc.so.6 + 0x11123c)
            ELF object binary architecture: AMD x86-64
@kchibisov
Copy link
Member

Try latest master

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

same

@kchibisov
Copy link
Member

kchibisov commented Aug 16, 2023

The one crashing on your trace is nvidia though. Could you try different drivers?

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

already tried 530., 535. versions open source(https://github.com/NVIDIA/open-gpu-kernel-modules) and proprietary. The result is the same. As far as i know nouveau does not support 30* series cards.

@kchibisov
Copy link
Member

The issue is in user space stuff (egl lib from nvidia).

Well, the issue might resolve over time then. Would suggest to try other egl applications, like github.com/rust-windowing/glutin/ and https://github.com/emersion/hello-wayland/tree/opengl

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

Should i report this to https://github.com/NVIDIA/egl-wayland ?

@kchibisov
Copy link
Member

if it happens with https://github.com/emersion/hello-wayland/tree/opengl then yes.

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

@kchibisov
Copy link
Member

Does it happen with https://github.com/rust-windowing/glutin ?

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

Yes

@kchibisov
Copy link
Member

Maybe it wants eglTerminate() in the end, can't think of anything else at this point. Will send a patch later, but it shouldn't really matter...

@pd2s
Copy link
Author

pd2s commented Aug 16, 2023

Ok. Thanks. I will report this to https://github.com/NVIDIA/egl-wayland

@erik-kz
Copy link

erik-kz commented Aug 16, 2023

Maybe it wants eglTerminate() in the end, can't think of anything else at this point. Will send a patch later, but it shouldn't really matter...

This would fix the problem. When an EGL application exits we will try to clean up any remaining unterminated EGLDisplays. This includes releasing and Wayland resources associated with them. The issue here is that the Wayland display connection is being closed by another .fini hook, which happens to run before ours.

Xlib lets libraries register a callback to be invoked when a Dispaly is closed, which avoids this sort of problem. Unfortunately Wayland doesn't have anything like that. So we have no way of knowing whether the wl_display associated with a given EGLDisplay is still valid.

@kchibisov
Copy link
Member

This would fix the problem. When an EGL application exits we will try to clean up any remaining unterminated EGLDisplays. This includes releasing and Wayland resources associated with them. The issue here is that the Wayland display connection is being closed by another .fini hook, which happens to run before ours.

Hm, I guess. mesa works fine here though, but I guess it really depends how you do things internally and what your constraints are.

It's a bit weird that you try to clear arbitrary resources though, given that we don't inform termination by any means and all objects we drop are dropped before the wl_display is being dropped, including all the EGL resources, so it's a bit weird that all of that ends to crash. Are you destroying resources synchronously and eglTerminate would work like a barrier? It's not clear how do you hook up to termination, unless you hook exit itself.

The eglTerminate is not called due to how fragile it's in libraries unless we have private/ref counted version of it, which is not supported by mesa yet...

@erik-kz
Copy link

erik-kz commented Aug 16, 2023

It's not clear how do you hook up to termination, unless you hook exit itself.

We register an __attribute__((destructor)) function which is invoked when libEGL.so is unloaded or the program exits. We need to do this because otherwise resources might be leaked if a program calls dlclose but keeps running.

@kchibisov
Copy link
Member

Hm, yeah, in our case it's on program exit since we don't call dlclose and intentionally leak on exit.

I could call eglTerminate in alacritty, but such thing can't be automated reliably without display platform extensions, because RAII guard calling eglTerminate without any extension doing private/ref counting is a foot gun (unless library owns everything which is not the case)...

Btw, does nvidia supports EGL_KHR_display_reference? If it does I could just use it and it should work, because with it we can sort of reliably call eglTerminate and not blow up everything.

@erik-kz
Copy link

erik-kz commented Aug 16, 2023

Btw, does nvidia supports EGL_KHR_display_reference?

We do.

@kchibisov
Copy link
Member

Hm, yeah, then I guess I'll just push this rust-windowing/glutin#1609 myself, because the main issue is that I have no way to test this thing before...

Thx for clarifying.

@kchibisov kchibisov added this to the Version 0.13.0 milestone Aug 16, 2023
@kchibisov kchibisov self-assigned this Aug 16, 2023
kchibisov added a commit to kchibisov/glutin that referenced this issue Aug 16, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: rust-windowing#1588
@kchibisov
Copy link
Member

@pd2s could you run git clone --depth 1 https://github.com/kchibisov/glutin -b egl-display-reference && cd glutin && cargo run --example window and tell whether it crashes for you?

kchibisov added a commit to kchibisov/glutin that referenced this issue Aug 16, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: rust-windowing#1588
@pd2s
Copy link
Author

pd2s commented Aug 17, 2023

@kchibisov
Copy link
Member

kchibisov commented Aug 17, 2023

Could you apply this patch on top of branch you've cloned

diff --git a/glutin/src/api/egl/display.rs b/glutin/src/api/egl/display.rs
index 468dd9c..c5e5faf 100644
--- a/glutin/src/api/egl/display.rs
+++ b/glutin/src/api/egl/display.rs
@@ -203,11 +203,12 @@ impl Display {
     /// and managed by other libraries. Use this function only when you're
     /// bringing everything down.
     pub unsafe fn terminate(self) {
-        if !self.inner.client_extensions.contains("EGL_KHR_display_reference") {
+        // if !self.inner.client_extensions.contains("EGL_KHR_display_reference") {
             unsafe {
+                eprintln!("Terminating!");
                 self.inner.egl.Terminate(*self.inner.raw);
             }
-        }
+        // }
     }
 
     fn get_platform_display(egl: &Egl, display: RawDisplayHandle) -> Result<EglDisplay> {
@@ -546,6 +547,7 @@ impl Drop for DisplayInner {
         // terminate the display without worry for the instance being
         // reused elsewhere.
         if self.client_extensions.contains("EGL_KHR_display_reference") {
+            println!("Trying to drop with display reference!");
             let mut track_references = MaybeUninit::<u32>::uninit();
             unsafe {
                 if match self.raw {
diff --git a/glutin_examples/src/lib.rs b/glutin_examples/src/lib.rs
index 46ab5da..1d9d9c1 100644
--- a/glutin_examples/src/lib.rs
+++ b/glutin_examples/src/lib.rs
@@ -9,7 +9,7 @@ use winit::window::WindowBuilder;
 
 use glutin::config::ConfigTemplateBuilder;
 use glutin::context::{ContextApi, ContextAttributesBuilder, Version};
-use glutin::display::GetGlDisplay;
+use glutin::display::{GetDisplayExtensions, GetGlDisplay};
 use glutin::prelude::*;
 use glutin::surface::SwapInterval;
 
@@ -100,6 +100,11 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), Box<dyn
 
     let mut state = None;
     let mut renderer = None;
+    match &gl_display {
+        glutin::display::Display::Egl(display) => println!("{:?}", display.extensions()),
+        glutin::display::Display::Glx(_) => (),
+    }
+    let display_copy = gl_display.clone();
     event_loop.run(move |event, window_target, control_flow| {
         control_flow.set_wait();
         match event {
@@ -184,6 +189,11 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), Box<dyn
         }
     })?;
 
+    match display_copy {
+        glutin::display::Display::Egl(display) => unsafe { display.terminate() },
+        glutin::display::Display::Glx(_) => (),
+    }
+
     Ok(())
 }
 

And post the output of it?

@pd2s
Copy link
Author

pd2s commented Aug 17, 2023

cargo run --example window
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running target/debug/examples/window
Picked a config with 8 samples
{"EGL_EXT_stream_consumer_egloutput", "EGL_KHR_gl_texture_3D_image", "EGL_KHR_image_base", "EGL_KHR_get_all_proc_addresses", "EGL_NV_robustness_video_memory_purge", "EGL_EXT_image_dma_buf_import_modifiers", "EGL_EXT_stream_acquire_mode", "EGL_KHR_gl_renderbuffer_image", "EGL_KHR_gl_texture_cubemap_image", "EGL_NV_nvrm_fence_sync", "EGL_NV_quadruple_buffer", "EGL_NV_stream_cross_object", "EGL_NV_stream_reset", "EGL_NV_stream_socket_inet", "EGL_NV_stream_consumer_eglimage", "EGL_NV_stream_origin", "EGL_KHR_create_context_no_error", "EGL_NV_triple_buffer", "EGL_KHR_stream_cross_process_fd", "EGL_KHR_stream_consumer_gltexture", "EGL_NV_stream_cross_display", "EGL_KHR_swap_buffers_with_damage", "EGL_EXT_create_context_robustness", "EGL_KHR_image", "EGL_EXT_buffer_age", "EGL_NV_stream_remote", "EGL_KHR_create_context", "EGL_WL_wayland_eglstream", "EGL_NV_stream_fifo_synchronous", "EGL_KHR_gl_colorspace", "EGL_EXT_present_opaque", "EGL_KHR_stream_attrib", "EGL_KHR_wait_sync", "EGL_KHR_context_flush_control", "EGL_KHR_no_config_context", "EGL_KHR_surfaceless_context", "EGL_NV_stream_metadata", "EGL_NV_stream_sync", "EGL_KHR_config_attribs", "EGL_EXT_image_dma_buf_import", "EGL_NV_stream_flush", "EGL_NV_stream_consumer_gltexture_yuv", "EGL_EXT_client_sync", "EGL_KHR_reusable_sync", "EGL_EXT_output_base", "EGL_WL_bind_wayland_display", "EGL_KHR_gl_texture_2D_image", "EGL_NV_stream_dma", "EGL_NV_stream_fifo_next", "EGL_EXT_protected_content", "EGL_EXT_sync_reuse", "EGL_NV_stream_cross_system", "EGL_NV_stream_socket", "EGL_NV_system_time", "EGL_KHR_partial_update", "EGL_KHR_stream_producer_eglsurface", "EGL_IMG_context_priority", "EGL_MESA_image_dma_buf_export", "EGL_KHR_fence_sync", "EGL_KHR_stream", "EGL_KHR_stream_fifo", "EGL_NV_stream_cross_process", "EGL_EXT_output_drm", "EGL_NV_stream_socket_unix", "EGL_NV_output_drm_flip_event", "EGL_NV_stream_attrib"}
Running on NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2
OpenGL Version 3.3.0 NVIDIA 535.98
Shaders version on 3.30 NVIDIA via Cg compiler
Terminating!
fish: Job 1, 'cargo run --example window' terminated by signal SIGSEGV (Address boundary error)

@kchibisov
Copy link
Member

@pd2s could you also post the eglinfo output, just in case (it comes from mesa-progs usually)?

@erik-kz I'm not sure what it really wants at this point, given that we call eglTerminate, I guess it wants us to call eglMakeCurrent and disable current, stuff? Maybe it wants a roundtrip to cleanup the stuff?

@kchibisov
Copy link
Member

@Molytho could you try to repro that with the glutin example? it's a one file and should be simple there. you could even try to manually force the terminate.

@kchibisov
Copy link
Member

@Molytho if you look at the glutin example, the wl_display is created and carried in this structure https://github.com/rust-windowing/glutin/blob/d4e2cb00c7776ccb8797f935b99c248ddc77a572/glutin_examples/src/lib.rs#L25 (event_loop).

The actual EGLDisplay is created around here https://github.com/rust-windowing/glutin/blob/d4e2cb00c7776ccb8797f935b99c248ddc77a572/glutin_examples/src/lib.rs#L47 and it's being dropped.

Objects in rust are dropped in the reverse order (LIFO), so I don't see a way EGLDislay could outlive the wl_display (it's all unsafe, so it's fine that lifetimes are not used here). There could be a reference cycle inside the inner display in glutin, but it drops all the objects before the event_loop and even manual call to eglTerminate wasn't fixing it.

Maybe nvidia wants the wl_display to be alive even when I terminate -> close and wl_display? I don't have other explanation for that, sorry, and given that alacritty is not the only app crashing I sort of suspect that it's not like we're really wrong.

@erik-kz
Copy link

erik-kz commented Sep 1, 2023

The eglinfo crash is a separate issue. It seems to be some sort of heap corruption. I'm not sure if it's the driver's fault or the application's.

@kchibisov
Copy link
Member

@Molytho also, you can try to edit https://github.com/emersion/hello-wayland/blob/opengl/main.c to call eglTerminate and close the wl_display in right/wrong order to verify that it's really an issue, since it doesn't crash when not calling eglTerminate and not closing the wl_display at all.

@Molytho
Copy link

Molytho commented Sep 1, 2023

@kchibisov I found the problem:
The issue is that eglTerminate just isn't called because of this checks:
https://github.com/kchibisov/glutin/blob/b39853aaf68da3c9dbb14a2d69a8de7f22fe20e7/glutin/src/api/egl/display.rs#L548

The client_extensions HashSet does not contain EGL_KHR_display_reference because it is queried through eglQueryString with a valid display as argument instead of EGL_NO_DISPLAY. EGL_KHR_display_reference is not contained in the returned string.
The spec states:

If display is EGL_NO_DISPLAY, then the EGL_EXTENSIONS string describes the set of supported client extensions. If display is a valid, initialized display, then the EGL_EXTENSIONS string describes the set of display extensions supported by that display. The set of supported client extensions is disjoint from the set of extensions supported by any given display.

https://registry.khronos.org/EGL/sdk/docs/man/html/eglQueryString.xhtml

EGL_KHR_display_reference is a client extension so I guess this is correct behavior as of my current understanding.
Maybe @erik-kz can confirm this?

When I delete this check everything runs fine without a segmentation fault.

@erik-kz
Copy link

erik-kz commented Sep 1, 2023

EGL_KHR_display_reference is a client extension so I guess this is correct behavior as of my current understanding.
Maybe @erik-kz can confirm this?

This is correct.

@kchibisov
Copy link
Member

@Molytho but I was told before that it wasn't fixing anything, since I did a patch doing a manual call to eglTerminate. Could you try this #7146 (comment) with an example, from what I understood it crashed everything?

The client_extensions HashSet does not contain EGL_KHR_display_reference because it is queried through eglQueryString with a valid display as argument instead of EGL_NO_DISPLAY. EGL_KHR_display_reference is not contained in the returned string.
The spec states:

I know that extension wasn't working, I just assumed that the patch to manually terminate was used. The extension is not used, because it's hidden by libglvnd somehow.

@kchibisov
Copy link
Member

@erik-kz in which set the extension will end up or should I just check union of NO_DISPLAY + <PLATFORM>? I had an assumption that it'll be in NO_DISPLAY, but I thought that one could implement it only for one platform...

@erik-kz
Copy link

erik-kz commented Sep 2, 2023

EGL_KHR_display_reference should appear in the client extension list. That is, the one returned from calling eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)

Unfortunately it does not actually appear in that list because of the issue I mentioned earlier #7146 (comment) but that's a bug in libglvnd.

Also, off-topic, but that eglinfo crash did end up being a silly bug in the NVIDIA driver. It will be fixed in the next release.

@kchibisov
Copy link
Member

EGL_KHR_display_reference should appear in the client extension list. That is, the one returned from calling eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)

Thx, I'll fix my handling of it then.

Also, off-topic, but that eglinfo crash did end up being a silly bug in the NVIDIA driver. It will be fixed in the next release

Nice.

@Molytho
Copy link

Molytho commented Sep 2, 2023

@Molytho but I was told before that it wasn't fixing anything, since I did a patch doing a manual call to eglTerminate. Could you try this #7146 (comment) with an example, from what I understood it crashed everything?

With this patch eglTerminate is called but too late. The wl_display is still dropped before. I think this happens because EventLoop::run is taking self. It is destroyed right after the run call.

#0  wl_display_disconnect (display=0x555555ce7080) at ../wayland-1.22.0/src/wayland-client.c:1319
#1  0x0000555555aac93b in wayland_backend::sys::client_impl::{impl#19}::drop (self=0x555555ceb248) at src/sys/client_impl/mod.rs:1020
#2  0x0000555555a98977 in core::ptr::drop_in_place<wayland_backend::sys::client_impl::ConnectionState> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#3  0x0000555555a97eeb in core::ptr::drop_in_place<core::cell::UnsafeCell<wayland_backend::sys::client_impl::ConnectionState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#4  0x0000555555a97f3f in core::ptr::drop_in_place<std::sync::mutex::Mutex<wayland_backend::sys::client_impl::ConnectionState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#5  0x0000555555a9876b in core::ptr::drop_in_place<wayland_backend::sys::client_impl::Inner> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#6  0x0000555555a96080 in alloc::sync::Arc<wayland_backend::sys::client_impl::Inner>::drop_slow<wayland_backend::sys::client_impl::Inner> (self=0x555555cf9c78)
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/sync.rs:1263
#7  0x0000555555a96632 in alloc::sync::{impl#27}::drop<wayland_backend::sys::client_impl::Inner> (self=0x555555cf9c78) at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/sync.rs:1897
#8  0x0000555555a98c2b in core::ptr::drop_in_place<alloc::sync::Arc<wayland_backend::sys::client_impl::Inner>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#9  0x0000555555a9883b in core::ptr::drop_in_place<wayland_backend::sys::client_impl::InnerBackend> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#10 0x0000555555a986bb in core::ptr::drop_in_place<wayland_backend::sys::client::Backend> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#11 0x0000555555a10c5b in core::ptr::drop_in_place<wayland_client::conn::Connection> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#12 0x00005555555ee63c in core::ptr::drop_in_place<wayland_client::event_queue::EventQueue<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#13 0x00005555555ee547 in core::ptr::drop_in_place<wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#14 0x00005555555eef0a in core::ptr::drop_in_place<calloop::sources::DispatcherInner<wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<()>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#15 0x00005555555eefea in core::ptr::drop_in_place<core::cell::UnsafeCell<calloop::sources::DispatcherInner<wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<()>>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#16 0x00005555555eefde in core::ptr::drop_in_place<core::cell::RefCell<calloop::sources::DispatcherInner<wayland_client::calloop::WaylandSource<winit::platform_impl::platform::wayland::state::WinitState>, winit::platform_impl::platform::wayland::event_loop::{impl#0}::new::{closure_env#1}<()>>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#17 0x00005555556f1510 in core::ptr::drop_in_place<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#18 0x00005555557aa729 in alloc::rc::{impl#20}::drop<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>> (self=0x555555cfa050)
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/rc.rs:1607
#19 0x00005555556f1cbb in core::ptr::drop_in_place<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#20 0x00005555557e4b5b in core::mem::manually_drop::ManuallyDrop<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>::drop<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>> (slot=0x555555cfa050) at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/mem/manually_drop.rs:144
#21 0x00005555556fa282 in slotmap::basic::{impl#1}::drop<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>> (self=0x555555cfa050)
    at /home/robin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/slotmap-1.0.6/src/basic.rs:78
#22 0x00005555556f262b in core::ptr::drop_in_place<slotmap::basic::Slot<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#23 0x00005555556f293e in core::ptr::drop_in_place<[slotmap::basic::Slot<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>]> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#24 0x00005555556e619a in alloc::vec::{impl#24}::drop<slotmap::basic::Slot<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>, alloc::alloc::Global>
    (self=0x555555cee848) at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/vec/mod.rs:3013
#25 0x00005555556f2d97 in core::ptr::drop_in_place<alloc::vec::Vec<slotmap::basic::Slot<alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>, alloc::alloc::Global>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#26 0x00005555556f2f1b in core::ptr::drop_in_place<slotmap::basic::SlotMap<calloop::loop_logic::CalloopKey, alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#27 0x00005555556f349b in core::ptr::drop_in_place<core::cell::UnsafeCell<slotmap::basic::SlotMap<calloop::loop_logic::CalloopKey, alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#28 0x00005555556f33af in core::ptr::drop_in_place<core::cell::RefCell<slotmap::basic::SlotMap<calloop::loop_logic::CalloopKey, alloc::rc::Rc<dyn calloop::sources::EventDispatcher<winit::platform_impl::platform::wayland::state::WinitState>>>>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#29 0x00005555556f0d1f in core::ptr::drop_in_place<calloop::loop_logic::LoopInner<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#30 0x00005555557ab083 in alloc::rc::{impl#20}::drop<calloop::loop_logic::LoopInner<winit::platform_impl::platform::wayland::state::WinitState>> (self=0x555555cfa1a0)
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/rc.rs:1607
#31 0x00005555556f1a5b in core::ptr::drop_in_place<alloc::rc::Rc<calloop::loop_logic::LoopInner<winit::platform_impl::platform::wayland::state::WinitState>>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#32 0x00005555556f0e4b in core::ptr::drop_in_place<calloop::loop_logic::LoopHandle<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#33 0x0000555555645e27 in core::ptr::drop_in_place<calloop::loop_logic::EventLoop<winit::platform_impl::platform::wayland::state::WinitState>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#34 0x0000555555649832 in core::ptr::drop_in_place<winit::platform_impl::platform::wayland::event_loop::EventLoop<()>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#35 0x000055555564602a in core::ptr::drop_in_place<alloc::boxed::Box<winit::platform_impl::platform::wayland::event_loop::EventLoop<()>, alloc::alloc::Global>> ()
    at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#36 0x0000555555648b02 in core::ptr::drop_in_place<winit::platform_impl::platform::EventLoop<()>> () at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ptr/mod.rs:497
#37 0x00005555556678c7 in winit::platform_impl::platform::EventLoop<()>::run<(), glutin_examples::main::{closure_env#3}> (self=..., callback=...)
    at /home/robin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/platform_impl/linux/mod.rs:795
#38 0x00005555556709d8 in winit::event_loop::EventLoop<()>::run<(), glutin_examples::main::{closure_env#3}> (self=..., event_handler=...)
    at /home/robin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.1-beta/src/event_loop.rs:316
#39 0x00005555555fe916 in glutin_examples::main (event_loop=...) at glutin_examples/src/lib.rs:108
#40 0x00005555555d3a9b in window::main () at glutin_examples/examples/window.rs:6
#0  eglTerminate (dpy=0x555555d76fc0) at src/generate/g_egldispatchstubs.c:296
#1  0x000055555569c67f in glutin_egl_sys::egl::Egl::Terminate (self=0x555555cde5d8 <glutin::api::egl::EGL::hd0c578eee35a1fcf+16>, dpy=0x555555d76fc0)
    at target/debug/build/glutin_egl_sys-1a1d9b549564c54c/out/egl_bindings.rs:601
#2  0x0000555555693a2c in glutin::api::egl::display::Display::terminate (self=...) at glutin/src/api/egl/display.rs:209
#3  0x00005555555fe9fc in glutin_examples::main (event_loop=...) at glutin_examples/src/lib.rs:193
#4  0x00005555555d3a9b in window::main () at glutin_examples/examples/window.rs:6

@kchibisov
Copy link
Member

Ah, yeah, the loop is consumed, I forgot that we've changed the semantic of that a while ago...

We'd need to drop within the loop then.

Molytho added a commit to Molytho/glutin that referenced this issue Oct 9, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: rust-windowing#1588
Molytho added a commit to Molytho/glutin that referenced this issue Oct 9, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: rust-windowing#1588
Molytho added a commit to Molytho/glutin that referenced this issue Oct 10, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: rust-windowing#1588
kchibisov pushed a commit to rust-windowing/glutin that referenced this issue Oct 10, 2023
This resolves a past issue where glutin would not be able to terminate
a display due to risk of two displays being created from the same
native display.

Besides not terminating EGL raises issue with nvidia on Wayland, thus
the `api::egl::Display::terminate` is added to help clients call this
function when calling `eglTerminate` is generally unsafe to do
automatically when dropping the `Display`.

Links: alacritty/alacritty#7146
Fixes: #1588
@kchibisov
Copy link
Member

Huh, this closed cross projects. weird.

@kchibisov kchibisov reopened this Oct 21, 2023
kchibisov added a commit to kchibisov/alacritty that referenced this issue Oct 21, 2023
@kchibisov
Copy link
Member

Could some test #7220 ?

@brightonanc
Copy link

I believe I was also having this problem and have just tested #7220 ; you've fixed it!

In these logs, I've followed the exact same steps as the original post (open alacritty then immediately Ctrl-D to close it).

System

OS: Arch Linux (kernel 6.5.7.arch1-1)
Compositor: Qtile (Wayland backend)
Software:

  • nvidia=535.113.01-5
  • libglvnd=1.7.0-1
  • wayland=1.22.0-1
  • eglexternalplatform=1.1-2
  • egl-wayland=2:1.1.13-1
  • wlroots=0.16.2-2
  • python-pywlroots=0.16.5-1
  • python=3.11.5-2

Log (master, bugged) (6071a7b)

Created log file at "/tmp/Alacritty-62851.log"
[0.000016941s] [INFO ] [alacritty] Welcome to Alacritty
[0.000073197s] [INFO ] [alacritty] Version 0.13.0-dev (6071a7bf)
[0.000092002s] [INFO ] [alacritty] Running on Wayland
[0.000322344s] [INFO ] [alacritty_config_derive] No config file found; using default
[0.015362860s] [INFO ] [alacritty] Using EGL 1.5
[0.015423744s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: OPENGL | GLES1 | GLES2 | GLES3
                                     srgb_capable: true
[0.020549998s] [INFO ] [alacritty] Window scale factor: 1
[0.031956348s] [DEBUG] [alacritty] Loading "monospace" font
[0.037674251s] [TRACE] [crossfont] Number of fonts is 9
[0.037699939s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Regular.ttf", index=0
[0.037757397s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.038002226s] [TRACE] [crossfont] Number of fonts is 9
[0.038020571s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Bold.ttf", index=0
[0.038060195s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.038300335s] [TRACE] [crossfont] Number of fonts is 10
[0.038316636s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Italic.ttf", index=0
[0.038356080s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.038601260s] [TRACE] [crossfont] Number of fonts is 9
[0.038618843s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Bold-Italic.ttf", index=0
[0.038664087s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.060199744s] [INFO ] [alacritty] Running on NVIDIA GeForce RTX 2070/PCIe/SSE2
[0.060221625s] [INFO ] [alacritty] OpenGL version 3.3.0 NVIDIA 535.113.01, shader_version 3.30 NVIDIA via Cg compiler
[0.060233076s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.062228889s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.062242785s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.065735075s] [INFO ] [alacritty] Cell size: 9 x 20
[0.065748230s] [INFO ] [alacritty] Padding: 0 x 0
[0.065754121s] [INFO ] [alacritty] Width: 800, Height: 600
[0.065898521s] [TRACE] [alacritty] Deriving dim colors from normal colors
[0.065925602s] [INFO ] [alacritty] PTY dimensions: 30 x 88
[0.068552839s] [INFO ] [alacritty] Initialisation complete
[0.068615556s] [DEBUG] [alacritty_terminal] Term::resize dimensions unchanged
[0.070050097s] [DEBUG] [alacritty] [gl_render] Buffer detailed info: Buffer object 2 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (1), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (2), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (3), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (4), and GL_ARRAY_BUFFER_ARB, usage hint is GL_STREAM_DRAW) will use VIDEO memory as the source for buffer object operations.
[0.071092652s] [TRACE] [alacritty_terminal] Setting attribute: Bold
[0.071133499s] [TRACE] [alacritty_terminal] Setting attribute: Reverse
[0.071267299s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.071279182s] [TRACE] [alacritty_terminal] Setting attribute: Bold
[0.071287588s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.071316592s] [TRACE] [alacritty_terminal] Carriage return
[0.071326641s] [TRACE] [alacritty_terminal] Carriage return
[0.071471713s] [TRACE] [alacritty_terminal] Carriage return
[0.071487593s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.071499876s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.071508502s] [TRACE] [alacritty_terminal] Setting attribute: CancelUnderline
[0.071517739s] [TRACE] [alacritty_terminal] Clearing screen: Below
[0.071545611s] [TRACE] [alacritty_terminal] Clearing line: Right
[0.071560018s] [TRACE] [alacritty_terminal] Setting mode: BracketedPaste
[0.085649190s] [DEBUG] [alacritty_terminal] New num_cols is 213 and num_lines is 51
[0.091413260s] [TRACE] [alacritty_terminal] Carriage return
[0.091438066s] [TRACE] [alacritty_terminal] Carriage return
[0.091450830s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.091468063s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.091478973s] [TRACE] [alacritty_terminal] Setting attribute: CancelUnderline
[0.091489332s] [TRACE] [alacritty_terminal] Clearing screen: Below
[0.092212368s] [INFO ] [alacritty] Padding: 0 x 0
[0.092229751s] [INFO ] [alacritty] Width: 1920, Height: 1023
[1.181836518s] [TRACE] [alacritty_terminal] Unsetting mode: BracketedPaste
[1.181865272s] [TRACE] [alacritty_terminal] Carriage return
[1.181878246s] [TRACE] [alacritty_terminal] Carriage return
[1.181889107s] [TRACE] [alacritty_terminal] Linefeed
warning: queue 0x7fb69c000cc0 destroyed while proxies still attached:
  zwp_primary_selection_offer_v1@4278190081 still attached
  wl_data_offer@4278190080 still attached
  zwp_primary_selection_device_v1@24 still attached
  zwp_primary_selection_device_manager_v1@20 still attached
  wl_data_device@23 still attached
  wl_seat@22 still attached
  wl_data_device_manager@21 still attached
  wl_registry@19 still attached
[1.202307728s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-62851.log"
zsh: segmentation fault (core dumped)  ./alacritty -vvv &> log

Coredump

Process 62851 (alacritty) of user 1000 dumped core.

    Stack trace of thread 62851:
    #0  0x00007fb6a93a3415 n/a (libwayland-client.so + 0x8415)
    #1  0x00007fb6a93a3573 n/a (libwayland-client.so + 0x8573)
    #2  0x00007fb6a93a5132 wl_proxy_marshal_array_flags (libwayland-client.so + 0xa132)
    #3  0x00007fb6a93a5bda wl_proxy_marshal_flags (libwayland-client.so + 0xabda)
    #4  0x00007fb6a8afc50b n/a (libnvidia-egl-wayland.so.1 + 0x850b)
    #5  0x00007fb6a8aff36f n/a (libnvidia-egl-wayland.so.1 + 0xb36f)
    #6  0x00007fb6a82acdd0 n/a (libEGL_nvidia.so.0 + 0xacdd0)
    #7  0x00007fb6a82a2c20 n/a (libEGL_nvidia.so.0 + 0xa2c20)
    #8  0x00007fb6a8fbecc6 n/a (libc.so.6 + 0x40cc6)
    #9  0x00007fb6a8fbee10 exit (libc.so.6 + 0x40e10)
    #10 0x00007fb6a8fa5cd7 n/a (libc.so.6 + 0x27cd7)
    #11 0x00007fb6a8fa5d8a __libc_start_main (libc.so.6 + 0x27d8a)
    #12 0x000055db9a4faa65 _start (alacritty + 0x133a65)

    Stack trace of thread 62859:
    #0  0x00007fb6a9080f6f __poll (libc.so.6 + 0x102f6f)
    #1  0x00007fb6a253616f n/a (libnvidia-eglcore.so.535.113.01 + 0x153616f)
    #2  0x00007fb6a2534ada n/a (libnvidia-eglcore.so.535.113.01 + 0x1534ada)
    #3  0x00007fb6a900a9eb n/a (libc.so.6 + 0x8c9eb)
    #4  0x00007fb6a908e7cc n/a (libc.so.6 + 0x1107cc)
    ELF object binary architecture: AMD x86-64

Log (#7220, fixed) (kchibisov@6372d41)

Created log file at "/tmp/Alacritty-65882.log"
[0.000011391s] [INFO ] [alacritty] Welcome to Alacritty
[0.000062407s] [INFO ] [alacritty] Version 0.13.0-dev (6372d411)
[0.000073638s] [INFO ] [alacritty] Running on Wayland
[0.000302397s] [INFO ] [alacritty_config_derive] No config file found; using default
[0.101245599s] [INFO ] [alacritty] Using EGL 1.5
[0.101310250s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2 | GLES3)
                                     srgb_capable: true
[0.110170306s] [INFO ] [alacritty] Window scale factor: 1
[0.125600552s] [DEBUG] [alacritty] Loading "monospace" font
[0.136910122s] [TRACE] [crossfont] Number of fonts is 9
[0.136957160s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Regular.ttf", index=0
[0.137061305s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.137530465s] [TRACE] [crossfont] Number of fonts is 9
[0.137563327s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Bold.ttf", index=0
[0.137635091s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.138094623s] [TRACE] [crossfont] Number of fonts is 10
[0.138125110s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Italic.ttf", index=0
[0.138191404s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.138676584s] [TRACE] [crossfont] Number of fonts is 9
[0.138708654s] [TRACE] [crossfont] Got font path="/home/brighton/.local/share/fonts/TTF/MesloLGS-NF-Bold-Italic.ttf", index=0
[0.138790969s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.166011857s] [INFO ] [alacritty] Running on NVIDIA GeForce RTX 2070/PCIe/SSE2
[0.166036854s] [INFO ] [alacritty] OpenGL version 3.3.0 NVIDIA 535.113.01, shader_version 3.30 NVIDIA via Cg compiler
[0.166054527s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.223771475s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.223807473s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.227262813s] [INFO ] [alacritty] Cell size: 9 x 20
[0.227275737s] [INFO ] [alacritty] Padding: 0 x 0
[0.227281698s] [INFO ] [alacritty] Width: 800, Height: 600
[0.228704416s] [TRACE] [alacritty] Deriving dim colors from normal colors
[0.228734884s] [INFO ] [alacritty] PTY dimensions: 30 x 88
[0.232287757s] [INFO ] [alacritty] Initialisation complete
[0.232348811s] [DEBUG] [alacritty_terminal] Term::resize dimensions unchanged
[0.233617190s] [DEBUG] [alacritty] [gl_render] Buffer detailed info: Buffer object 2 (bound to GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (0), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (1), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (2), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (3), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB (4), and GL_ARRAY_BUFFER_ARB, usage hint is GL_STREAM_DRAW) will use VIDEO memory as the source for buffer object operations.
[0.234703156s] [TRACE] [alacritty_terminal] Setting attribute: Bold
[0.234742540s] [TRACE] [alacritty_terminal] Setting attribute: Reverse
[0.234775101s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.234786623s] [TRACE] [alacritty_terminal] Setting attribute: Bold
[0.234795048s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.234824293s] [TRACE] [alacritty_terminal] Carriage return
[0.234834292s] [TRACE] [alacritty_terminal] Carriage return
[0.235099179s] [TRACE] [alacritty_terminal] Carriage return
[0.235115289s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.235126961s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.235135677s] [TRACE] [alacritty_terminal] Setting attribute: CancelUnderline
[0.235144484s] [TRACE] [alacritty_terminal] Clearing screen: Below
[0.235174210s] [TRACE] [alacritty_terminal] Clearing line: Right
[0.235188406s] [TRACE] [alacritty_terminal] Setting mode: BracketedPaste
[0.249624168s] [DEBUG] [alacritty_terminal] New num_cols is 213 and num_lines is 51
[0.255084047s] [TRACE] [alacritty_terminal] Carriage return
[0.255106619s] [TRACE] [alacritty_terminal] Carriage return
[0.255118441s] [TRACE] [alacritty_terminal] Setting attribute: Reset
[0.255133810s] [TRACE] [alacritty_terminal] Setting attribute: CancelReverse
[0.255144210s] [TRACE] [alacritty_terminal] Setting attribute: CancelUnderline
[0.255153908s] [TRACE] [alacritty_terminal] Clearing screen: Below
[0.256300067s] [INFO ] [alacritty] Padding: 0 x 0
[0.256313773s] [INFO ] [alacritty] Width: 1920, Height: 1023
[1.739647468s] [TRACE] [alacritty_terminal] Unsetting mode: BracketedPaste
[1.739694325s] [TRACE] [alacritty_terminal] Carriage return
[1.739708432s] [TRACE] [alacritty_terminal] Carriage return
[1.739719403s] [TRACE] [alacritty_terminal] Linefeed
[1.751512418s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-65882.log"

xiaogaozi added a commit to xiaogaozi/alacritty that referenced this issue May 24, 2024
* Bump development version to 0.13.0-dev

This is only an update to the development version and does not represent
a stable release.

* Update INSTALL.md Ubuntu instructions

* Add missing `ToggleMaximized` docs in the config

* Add `window.resize_increments` config option

Given how bugged the resize increments are on X11, it's better to
disable it by default.

* Relax horizontal scrolling

Apply horizontal scrolling when the angle between the axis X
and (x, y) vector is lower than 25 degrees.

Fixes alacritty#6711.

* Fix bracketed paste with EOT payload

This works around an issue in many (all?) shells where the bracketed
paste logic would only strip out `\r` but interpret EOT (`\x03`) as a
termination of the bracketed paste.

* Send D&D input through paste action

Treating D&D like paste allows using D&D to input text into areas other
than the PTY, like the search bar.

* Fix busy rendering when the same warning persists

When the same warning is thrown on the each rendering iteration, it'll
force alacritty to always render.

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Bump winit to 0.28.2

This also bumps copypasta and sctk-adwaita.

Fixes alacritty#6744.
Fixes alacritty#6702.
Fixes alacritty#6696.
Fixes alacritty#2741.

* Bump x11-clipboard to v0.7.1

Fixes alacritty#6760.

* Use `thin` instead of `fat` LTO

The performance between `thin` and `fat` is in the margin of error,
however `thin` LTO is way faster to build.

* Improve fish completions installation instructions

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>

* Bump winit to 0.28.3

Fix macOS leak when closing the window.

* Fix `;` character in URI OSC 8 payload

The special character `;` can be not URL-encoded, thus it'll add
extra parameter in the payload. Handle it joining extra parameters
with the `;` as a separator.

* Bump CHANGELOG development version to 0.13.0-dev

This is only an update to the development version and does not represent
a stable release.

The original bump to 0.13.0-dev was made in 9cf2c89, but did not make
any changes to the changelog. This adds a 0.13.0-dev changelog entry to
master so new changes are properly added to the correct place.

* Fix selection rotation on the last line

This fixes an issue with terminal resizes when the selection is on the
last line. Alacritty would fail to rotate lines and keep the selection
in the same line index whenever the terminal line count was grown or
shrunk.

This issue occurred due to the range passed to the selection's rotate
function still being based on the old terminal size, which caused the
initial or target state of the rotation to be outside of the terminal
bounds.

Closes alacritty#6698.

* Add missing terminfo capabilities

This adds capabilities for focus in/out (XF, kxIN, kxOUT) and bracketed
paste (BD, BE, PE, PS).

* Reset char suppression for every key binding

Previously the character suppression was only reset whenever a key was
released. However this did not take key repetition into account.

Now every key down also resets the character suppression. This should
work since the `ReceivedCharacter` is always received immediately after
the `KeyboardInput` without the chance of a racing condition where
another keyboard event interrupts the two.

* Use paste for ESC action and IME commit

Route string terminal input through 'ActionContext::paste'
instead of char by char write improving performance by
utilizing bracketed paste mode when it's reasonable.

* Allow mode-exclusive bindings in any mode

This patch enables binding chains that go beyond mode changes by
allowing bindings to be defined for modes they do not usually have an
effect in.

* Omit urgency hint focused window

* Bump winit to 0.28.4

Fixes alacritty#6817.

* Add `ALACRITTY_EXTRA_LOG_TARGETS` env variable

This should help with troubleshooting the dependency crates like winit.

* Bump winit to 0.28.5

The 0.28.4 was yanked.

* Fix very long startup time on some Wayland systems

This is not a real fix for the issue given that dbus method sctk-adwaita
is using will being called anyway. The proper fix will be available
with the winit's 0.29.0 release.

Right now the delay reduced from around 20 seconds to 100ms on a
systems with broken xdg-desktop-portal setup.

* Bump `actions/checkout` to v3

Fix Node 12 deprecation warnings in action runs.

* Update glutin to 0.30.8 and winit to 0.28.6

Fixes alacritty#6920.
Fixes alacritty#6824.

* Fix upload from CI on windows

* Update bitflags to 2.2.1

* Update xdg and dirs crate

The recent version on xdg crate moved to home crate which is used
by cargo. Thus to query for home directory we can use the home
dependency instead which is smaller.

* Update clap to v4.2.7

Fixes alacritty#6879.
Fixes alacritty#6874.

* Update patch dependencies

* Improve renderer debuggability

Make the renderer more debuggable by adding extra logging and using
`GL_KHR_debug` when running with the debug log level.

* Add version 0.12.1 to CHANGELOG

* Switch to VTE's built-in ansi feature

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Fix 216-color cube generation

This fixes a regression introduced in cb7ad5b which swapped the green
and blue values when constructing the 216-color RGB cube.

Fixes alacritty#6951.

* Fix hyperlink preview for 2 lines terminal (alacritty#6953)

The intention was to show it, however it was hidden due to wrong
comparisson check.

* Move manpages to scdoc

This rewrites the existing manpages to use the `scdoc` format, making it
simpler to read and edit the manpages without intricate roff knowledge.

Some minor changes to the manpages were made in the process, mostly
focusing on correcting some of the wording. The list of maintainers has
also changed to ensure people not involved in the project anymore aren't
unnecessarily contacted for support.

* Fix Makefile manpage generation

Signed-off-by: Dennis Maier <d.maier94@web.de>
Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Fix crash on ScaleFactorChange on Windows

Windows is known to send zero sizes from winit in Risezed and now
in ScaleFactorChanged events. They were handled in Resized, but
not in ScaleFactorChanged.

Fixes alacritty#6949.

* Bump dependencies

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Add resolver to workspace manifest

This explicitly specifies resolver "2" in the root manifest, to fix a
warning introduced in a recent nightly release.

* Switch to TOML configuration format

This switches Alacritty's default configuration format from yaml to
toml. While yaml is still supported, it is done by converting it to toml
and should be removed entirely in the future.

All existing features were persisted based on my testing. Behavior
should not change much, though `--option` might have slightly different
behavior since the entire line is not interpreted as one line of toml.

A new `alacritty migrate` subcommand has been added which allows
automatic migration from yaml to toml. This also could be used as a
facility to automatically fix configuration file changes in the future.

Closes alacritty#6592.

* Change the way we refer to IRC chat

* Fix warnings for config imports

Closes alacritty#6996.

* Add option to persist hints after selection

Closes alacritty#6976.

* Fix `alacritty msg config` toml replacement

This fixes a regression introduced in bd49067 which broke the override
of configuration file variables using `alacritty msg config`.

To fix this the `replace` functionality was rewritten to behave more
like the `serde_utils::merge` where entire values are inserted into the
existing structure rather than separating the keys from the values.

Fixes: bd49067 (Switch to TOML configuration format)

* Fix freeze with some drivers when using GLX

Fixes alacritty#6972.

* Fix parsing of integer font sizes

Config file conversion broke parsing of the font size value if it's
written as an integer, since TOML integers are always signed.

* Add errors for deserializing with unknown fields

Currently there are still some places where `Deserialize` is used rather
than `ConfigDeserialize`, which means that the built-in warning for
unused fields is not emitted automatically.

To ensure users don't have invalid configurations, the
`#[serde(deny_unknown_fields)]` annotation has been added to these
structs, making it a hard error when an unknown field is present.

* Fix the crash when shrinking scrolled terminal

display_offset was adjusted unconditionally, thus it could go
beyound the history limits, so clamp it to history like we do
in grow_colums.

Fixes alacritty#6862.

* Add support for loading conpty.dll

Co-Authored-By: @fredizzimo
Co-Authored-By: @Grueslayer

* Update wix on the release CI

Fixes alacritty#6939.

* Add TOML migration recommendation to warning

This adds a little recommendation to use `alacritty migrate` to
automatically transition configuration files from YAML to TOML.

* Remove mouse double_click/triple_click options

Fixes alacritty#6962.

* Change the default colorscheme

The new colorscheme is base16 classic dark with the bright colors
generated with oklab toolkits. The base16 classic dark is less washed
out and represents the current maintainers preference. The motivation
to change it was subjective, though it does look like generic dark
theme.

On a side note, this colorscheme was used for alacritty.org web page for
a long time, however it used different foreground color.

* Add manpage links to "see also" section

* Add version 0.12.2 to CHANGELOG

This is only an update to the development version and does not represent
a stable release.

* Add a note in README about older versions

Unfortunately it's not clear to everyone that they are looking at the
development documentation.

* Fix legacy bindings taking precedence over new ones

They were compared by len, but it's was wrong from the start, since
a user provided binding could remove more than one builtin binding,
so it was impossible for users to use their own bindings.

The most reliable way to do so is to use `Option`, given that we fill
default during deserialization.

Fixes alacritty#7050.

* Update binding sections in config manpage

* Create man5 directory along with man1

* Update to the new winit keyboard API

The main highlight of this update is that alacritty will now use new
keyboard API from the winit, which resolves a lot of issues around
key bindings, such as ability to bind dead keys. It also fixes long
standing issues with the virtual key code bindings and make bindings
in general more predictable. It also makes our default Vi key bindings
fully working.

Given that alacritty was using `VirtualKey` directly in the bindings
from the winit, and winit simply removed the enum, we've added internal
conversions to minimize the fallout, but new way to specify the bindings
should be more intuitive.

Other part of this update fixes some forward compatibility bugs with the
Wayland backend, given that wayland-rs 0.30 is fully forward compatible.
The update also fixes weird Maximized startup issues on GNOME Wayland,
however they were present on any sane compositor.

Fixes alacritty#6842.
Fixes alacritty#6455.
Fixes alacritty#6184.
Fixes alacritty#5684.
Fixes alacritty#3574.
Fixes alacritty#3460.
Fixes alacritty#1336.
Fixes alacritty#892.
Fixes alacritty#458.
Fixes alacritty#55.

* Fix configuration link typo

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Fix `window.option_as_alt=Both`

Fixes alacritty#7077.

* Unset `XDG_ACTIVATION_TOKEN` in alacritty_terminal

This variable is what being used for Wayland's activation stuff.

* Raise double click threshold to 400ms

This should improve the situation with some touchpads. GTK4 is also
using the same value.

* Prefer logical key for named keys

Some keyboard layouts have named logical keys via shift combinations
of some sorts. So prefer them.

Fixes alacritty#7076.

* Mention all the actions in the man page

A lot of actions were left without a notice, so the only way to figure
out some of them was to browse source code. An example of such
actions were `Maximize` and `Minimize`, since we don't have a binding
for them, so they were left even in alacritty-bindings(5).

Explicitly list all the bindings we have. The search bindings were
also not accurately restricted, since we allow them to be executed
inside regardless of mode.

* Use lowercase latters in bindings for h/m/l

They were using uppercase latters, however our config expects everything
as lowercase, because we're using `key_without_modifiers` +
`ModifiersState`.

* Remove unnecessary mutable references

* Fix license syntax

This patch updates the license field to follow the SPDX 2.1 license
expression standard.

* Use bracketed paste only for multi-char IME input

Some IME setups do only `commit` single char input, like fcitx5 when
doing ru input.

* Fix manpage docs for shell section

Closes alacritty#7087.

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>

* Fix keys like `+` not working on neo layouts

The key_without_modifier removes all the modifiers including the
multiple shift levels, which is not desired. In alacritty we
just wanted to treat uppercase and lowercase latters the same,
which we can with the help of builtin functions.

* Mention `Forward`/`Back` mouse buttons in man page

They were mentioned only in the changelog, but forgotten in the man
page.

* Add `terminal` config section to control OSCs 

Some environments demand certain OSC sequences to be disabled or
some escape sequence could require handling which is out of scope
of alacritty, but could be done by external script (OSC 777).

Added section for now just handles the `OSC 52` sequence and changes
its default to be `OnlyCopy`, which is handy for remote copy, but
`Paste` is redundant because normal `Paste` hotkey could be used as
well.

Fixes alacritty#3386.

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Skip whitespaces for wide chars in preedit

While we skip the spacers for the wide characters in the grid due to
them having a proper flags, the draw_string method was generating the
cells with incorrect flags leading to wide chars being cut off.

* Make URL_REGEX more strict

* Use ahash instead of fnv and regular hash function

After evaluation of the ahash with the data alacritty uses it was
discovered that it's 1.5-2x times faster when getting the already
hashed values, which is the primary cases for alacritty's renderer.

Given that ahash is generally faster, all the HashSet and HashMap's
inside the alacritty were changed to use it as a hasher function.

* Ignore scrolling multiplier on touchscreens

* Apply transparent background colors to "UI" cells

* Copy global IPC options for new windows

This patch stores all options set for the Window ID `-1` and
automatically applies them to new windows after their creation.

This in theory makes it possible to have a fully dynamic "default
config" without having to reapply it for every new window.

Closes alacritty#7128.

* Fix decorations_theme_variant spelling in manpage

* Remove winit dependency from alacritty_config

* Update regex-automata to v0.3.6

This seems like a sensible first step before looking into alacritty#7097.

* Fix crash with anchored searches

While this does **not** enable the use of anchors (`^`) in user regexes,
it does prevent Alacritty from crashing when attempting to do so.

* Change `window.padding` from u8 to u16

Fixes alacritty#6900.

* Quote `None` consistently inside the man page

`None` must be inside the `"`, since it's a string value.

* Add examples to more sections

Some sections were provided without a default, so provide an example for
them.

* Update winit to 0.29.1-beta

Make use of new winit frame throttling mechanism used in RedrawRequested,
which removes the need for having Wayland queue to ask for the frame
callbacks.

Fixes alacritty#7011.

* Add bindings for macOS tabs

This doesn't represnet the movement to add tabs on any other platform,
unless winit could add a similar API for them.

* Support startup notify on Wayland/X11

Activate a window to indicate that we want initial focus when the
system uses startup notifications.

Fixes alacritty#6931.

* Add `prefer_egl` debug option

Some systems have rendering issues when using GLX rather than EGL. While this is
usually due to a driver bug, it is helpful to provide a workaround for this by
allowing people to prefer EGL over GLX.

This patch adds the new `debug.prefer_egl` option to provide this workaround.

Closes alacritty#7056.

* Remove obsolete ansicode.txt file

The wiki contains a list of links to ANSI references:
https://github.com/alacritty/alacritty/wiki/ANSI-References

* Test man-pages compilation on the CI

* Add missing position config docs

* Fix regex memory usage

This fixes an issue where regexes with a large number of possible states
would consume excessive memory, since the entire DFA was compiled ahead
of time.

To solve this, the DFA is now built at runtime using `regex-automata`'s
hybrid DFA.

There are however still some checks performed ahead of time, causing
errors with obscenely large regexes (`[0-9A-Za-z]{999999999}`), which
shouldn't cause any issues.

A regex which is large, but not large enough to fail the NFA
construction (like `[0-9A-Za-z]{999999}`) will cause a long search of
the entire grid, but will complete and show the match.

Closes alacritty#7097.

* Underline hint matches during selection

This patch underlines the full regex hint match while the keyboard hint
selection is in process.

While it would be possible to color the entire match, this would only
introduce unnecessary configuration options and be too noisy. The
underline matches the mouse highlighting and has a less drastic visual
impact.

Closes alacritty#6178.

* Bump VTE to 0.12.0

Fixes alacritty#6845.

* Update the escape_support.md for sync updates

Remove the DCS sync updates escape sequence since it's no longer
supported.

Fixes: 47d5007 (Bump VTE to 0.12.0)

* Port from mio to polling

This patch replaces the mio crate with the polling. Now that
smol-rs/polling#96 has been merged, we should be at full feature parity
with mio v0.6 now.

Fixes alacritty#7104.
Fixes alacritty#6486.

* Update dependencies

This patch applies all breaking and non-breaking dependency updates
and bumps MSRV to 1.70.0.

* Fix PTY being closed on creation

The PTY got closed because `OwnedFd` automatically closed it.

Fixes: 59c63d3 (Update dependencies)

* Fix regex matches ending on multiline

This fixes an issue where the reverse search for the regex start would
truncate a character when ending on a newline, since it was omitting the
EOI check in that case.

This also fixes a separate issue which caused regexes which capture
empty strings (e.g.: `.*`) to always report a match.

This is a regression introduced in 73276b6.

* Fix regex patterns allowing for empty strings

This patch changes the mode we search for patterns which allow an empty
string, by anchoring all searches. As a result we will match the longest
possible match when multiple patterns are present (like `;*|rust`),
instead of using the leftmost pattern only.

This is only possible with empty matches since our parser is reset on
every byte anyway, so anchoring the search makes no difference.

Fixes alacritty#7276.

* Use openpty-rustix instead of nix

Follow upstream libraries and use rustix to reduce the amount of
dependencies in the future.

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Fix `window.decorations_theme_variant` reload

The live reload handling wasn't introduced when the option got added.

Fixes alacritty#7295.

* Add inline vi mode search

This patch adds inline search to vi mode using `f`/`F` and `t`/`T` as
default bindings. The behavior matches that of vim.

Fixes alacritty#7203.

* Bump rustix to 0.38.20

* Update winit to 0.29.2 and copypasta to 0.10.0

Fixes alacritty#7236.
Fixes alacritty#7201.
Fixes alacritty#7146.
Fixes alacritty#6848.
Fixes alacritty#3601.
Fixes alacritty#3108.
Fixes alacritty#2453.

* Fix crash due to wrong drop order of clipboard

Fixes alacritty#7309.

* Prefer exact matches for bindings in mouse mode

Only consider bindings without Shift if there are no actions defined for the
actual mouse event.

Closes alacritty#7292.

* Fix typos

* Add version 0.12.3 to CHANGELOG

This is only an update to the development version and does not represent
a stable release.

* Avoid maximizing window when creating new tab

This patch ignores the startup mode when creating a new tab on macOS to
avoid maximizing an existing window.

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Fix clippy warnings

* Add `window.blur` config option

Fixes alacritty#972.

* Add man 5 pages to upload_asset.sh

They are compiled, but not being uploaded.

* Bump glutin to 0.31.1

This fixes a crash on startup with macOS Sonoma.

* Fix crash when leaving search after resize

This fixes a crash which could occur when leaving search with a visible
match after shrinking the terminal height to be lower than the original
line the focused match was in.

Closes alacritty#7054.

* Bump ahash to 0.8.6

* Remove `alacritty_config` from alacritty_terminal

There's no need to force alacritty's user configuration on
other users of the crate, thus provide the options actually used
by alacritty_terminal itself.

* Fix cursor being hidden after reaching timeout

The timeout and blink events could be delivered at the same time,
so canceling blinking won't work and we'll still have an event.

* Use builtin font to draw powerline symbols

In addition to box drawing it was decided to also draw powerline
symbols, since those are quite common and rather simple to draw with
present box drawing infra.

* Unify CLI config override mechanisms

This patch changes the way the `-o` config option works when specified
at startup to function the same way as the IPC mechanism.

While this should technically perform the exact same way, it should
hopefully make it a little easier to understand how CLI config
replacement works.

* Add `--option` argument to `create-window`

This patch adds a new CLI parameter to the `create-window` subcommand,
matching the existing `--option` parameter when creating a new Alacritty
instance.

This parameter allows setting up the initial window configuration from
the CLI without having to call `alacritty msg config`, making sure that
all options are set appropriately right from the start.

Closes alacritty#6238.

* Change default `bell.animation` to `Linear`

The default animation feels really choppy, but it's just how its
function looks.

* Fix visual bell getting stuck on macOS

Fixes alacritty#7325.

* Fix message bar damage

Fixes alacritty#7224.

* Fix Sync capability in terminfo

Alacritty has supported mode 2026 for synchornized updates for a few
months, but the terminfo entry still used the old DCS sequence
originally supported by iTerm2. Since many other terminal emulators and
applications seem to be standardizing around 2026, change the terminfo
entry to use SM instead of DCS.

* Fix Vi cursor not being dirty when scrolling

* Simplify powerline drawing algorithm

Iterate over points in line instead of drawing it right away
and then finding it in the buffer.

Fixes: 4a26667 (Use builtin font to draw powerline symbols)

* Add error handling for OpenGL connection details

* Update VTE to 0.13.0

* Add support for DECRPM/DECRQM

* Damage only terminal inside `alacritty_terminal`

The damage tracking was including selection and vi_cursor which were
rendering viewport related, however all the damage tracking inside
the `alacritty_terminal` was _terminal viewport_ related, meaning that
it should be affected by `display_offset`.

Refactor the damage tracking so `alacritty_terminal` is only tracking
actual terminal updates and properly applying display offset to them,
while `alacritty` pulls this damage into its own UI damage state.

Fixes alacritty#7111.

* Create only one branch per major release

Having a separate branch for each release makes it harder to maintain
without an actual benefit, since every release from the major version
is linear, so creating branches doesn't make any sense.

They also collapse with the tag names leading to ambiguous refs.

* Make sections the same case in man pages

* Fix SelectLastTab in alacritty-bindings(5)

* Make man pages look consistent

Part of the man pages were using _value_, other part were using just
value, thus make everything as _value_.

Also properly dot terminate and add spacing through out the man pages.

* Explicitly use `=` in alacritty(5)

This should help with understanding how to write TOML
without reading too much into specification.

* Improve section to TOML section refs

This should give more hints where to put things.

* Add example for [window] section in alacritty(5)

This should give a hint on how to generally tweak things.

* Drop repo link in *SEE ALSO* man sections

The alacritty documentation is fully present inside the man pages, the
repo provides nothing extra other than a way to report issues, which
lives in its own section anyway.

* Fix default for [[hints.enabled]] in man pages

The default was incomplete, since `command` was missing.

* Add migrate to alacritty(1)

* Damage entire window on font size change

Font size could change without changing the cell dimensions, like
becoming slightly higher/wider.

Fixes: 40160c5 (Damage only terminal inside `alacritty_terminal`)

* Fix IME popup positioning

When setting cursor area, the popup will be placed either above or
below not obscuring the supplied region, however we were still
offsetting line with `+1` putting the cursor at the bottom of the line,
and given that area is from the top-left corner, the wrong area
was marked for not being obscured.

It was also discovered that some compositors, like GNOME, position
IME in the bottom right corner of the supplied region, which is wrong,
but it renders IME popup not very useful, since it's far away from
the place it should be, thus try to not obscure just a few characters
near the cursor.

Given that X11 doesn't support area setting, it uses the old logic
with offsetting.

Co-developed-by: lilydjwg <lilydjwg@gmail.com>
Signed-off-by: lilydjwg <lilydjwg@gmail.com>

* Bump dependencies

Update dependencies with `cargo update` as well as do explicit update
of winit, crossfont, and regex-automata.

* Make AA stronger for undercurl

This improves undercurl rendering preserving its original thickness.
This also makes it look not out-of place when places next to other
lines.

* Document macOS shortcuts for search

* Adjust default Vi's SearchBackwards binding

We have the same policy with Shift for numbers.

* Fix DECRPM reporting

The DECRQM uses `p` to query, but the reply uses `y`.

Fixes alacritty#7397.

* Optimize undercurl shader

This removes the if and lowers amount of operations.

* Fallback to underline shader when dotted fails

Some hardware is just bad.

Fixes alacritty#7404.

* Don't use `::*` for enum variants in bindings

* Fix chars usage inside the mouse bindings

Fixes alacritty#7413.

* Implement kitty's keyboard protocol

The protocol enables robust key reporting for the applications, so
they could bind more keys and the user won't have collisions with
the normal control keys.

Links: https://sw.kovidgoyal.net/kitty/keyboard-protocol
Fixes alacritty#6378.

* Update to crossfont 0.6.0

* Fix trigger of normal bindings in mouse mode

We should ensure that the `Shift` is actually pressed when trying to
prefer regular bindings instead of the ones if we had Shift applied.

Fixes: 500b696 (Prefer exact matches for bindings in mouse mode)
Fixes alacritty#7415.

* Don't emit text for NamedKey without text repr

When the key doesn't have textual representation we shouldn't emit
the text for them, since they are processed via bindings.

Also, fix the logic to handle named keys with disambiguate without
special modes/modifiers.

Fixes alacritty#7423.

* Fix message bar not damaged when the same size

The regression was added due to `y` coordinate in OpenGL differs to
`y` inside the damage rectangles.

Fixes: 40160c5 (Damage only terminal inside `alacritty_terminal`)

* Bump crossfont to 0.7.0

* Alacritty version 0.13.0-rc1

* Add link to rendered config docs

This adds a link to alacritty.org's rendered configuration file
documentation.

* Fix the order of `ClearSelection` in Vi mode

Fixes alacritty#7438.

* Account for option_as_alt when doing kitty protocol

By default `Alt` is not a real `Alt` on macOS, so we shouldn't treat
it as a modifier.

Fixes alacritty#7443.

* Bump winit to 0.29.5

Fixes alacritty#7449.

* Keep IME always enabled on X11

Fixes alacritty#7195.

* Alacritty version 0.13.0-rc2

* Apply modifiers before presses in kitty protocol

While this doesn't handle releases with multiple identical modifiers
pressed, the release can't work reliable anyway, since one modifier
could be pressed before focusing the window, thus tracking modifiers
based on the keysym values won't work as it was suggested by kitty
author.

Links: kovidgoyal/kitty#6913

* Bump winit to 0.29.7

This also bumps other dependencies along the way.

Fixes alacritty#2886.

* Alacritty version 0.13.0

* Mark SimpleFullscreen as macOS only startup mode

* Derive `Clone` for `EventLoopSender`

* Fix `alacritty migrate` with nonexistent imports

Fixes alacritty#7473.

* Remove direct dependency on once_cell

With MSRV 1.70, std now contains the necessary parts.

* Use pre-composed key for `Alt` bindings on macOS

Fixes alacritty#7475.

* Fix inability to bind `Alt+Control` on Windows

Fixes alacritty#7506.

* Passthrough potential errors for `EventLoopSender`

* Don't substitute `\n` in char bindings

This broke unintentionally due to routing paste-like input
via paste function.

Fixes alacritty#7476.

* Send associated text for shifted numbers with kitty

Also fix the wrong ordering of base and shifted keys.

Fixes alacritty#7492.

* Powerline glyphs being cut for narrow fonts

Fixes alacritty#7470.

* Remove note about versions pre 0.13.0

* Bump winit to 0.29.8

Fixes alacritty#7514.
Fixes alacritty#7502.
Fixes alacritty#7494.
Fixes alacritty#7474.
Fixes alacritty#7472.

* Fix number-based mouse bindings

The toml migration introduced a regression which stopped numbered key
binding's from working. This patch implements the required number type
to make things work again.

Fixes alacritty#7527.

* Fix replacing optional fields

This fixes an issue with the default `SerdeReplace` implementation where
it would never recurse through options but always replace the entire
option with the new value.

Closes alacritty#7518.

* Add vi search paste bindings

Closes alacritty#7511.

* Ignore null values in `alacritty migrate`

This should help with broken YAML configurations by throwing nulls
away, which are not representable in toml.

* Bump winit to 0.29.9

Fixes alacritty#7559.
Fixes alacritty#7533.

* Fix serde tests without default features

* Alacritty version 0.13.1-rc1

* Fix manpage string escapes

Co-authored-by: Christian Duerr <contact@christianduerr.com>

* Alacritty version 0.13.1

* Reduce allocations during keyboard input

* Fix `debug.renderer="gles2pure"` documentation

Patch 5685ce8 changed the allowed values of the `debug.renderer` enum,
prohibiting the usage of `_` in the `Gles2Pure` variant. This patch
updates the documentation to correct for that.

Co-authored-by: Kirill Chibisov <contact@kchibisov.com>

* Fix inline search expanding across newlines

Closes alacritty#7587.

* Fix env variable overrides through CLI

This fixes an issue where all CLI environment variables would replace
existing configuration file variables instead of merging the two maps
together.

Fixes alacritty#7618.

* Fix typo in config docs

Closes alacritty#7647.

* Allow specifying all config keys on all platforms

Closes alacritty#7592.

* Use builtin font to draw sextants

Sextants are similar to quadrants and should align with them and
other box drawing, thus use builtin font to align them properly.

Part-of: alacritty#7422.

* Fix invalid bounds in selection range conversion

* Don't report associated text only for C0/C1

This has a side effect that we'll have text reported for Alt+Shift+T
and similar, but only C0/C1 should be excluded and Alt+Shift+T is
emitting neither, thus regular `T` will be reported.

Fixes alacritty#7657.

* Move CHANGELOG entry for sextants to proper section

* Don't use kitty sequences outside protocol

Originally kitty defined that functional keys, which are not encoded
by default, like `Pause` should be encoded with `CSI u`. However
the specification was clarified and now it says that terminal
may ignore that part. Given that Alacritty tries to follow xterm/urxvt
when it comes to bindings, CSI u bindings are not send for consistency
reasons.

This also brings back F13-F20 bindings used by Alacritty in 0.12.3, as
well as explicitly defines `NumpadEnter` like it was before.

Closes alacritty#7623.

* Document `command` field in bindings

Closes alacritty#7594.

* Fix unnecessary explicit panic in PTY 

Closes alacritty#7680.

* Fix hang on startup with some Wayland compositors

Fixes alacritty#7665.

* Fix hang on startup with some Wayland compositors

Fixes alacritty#7665.

* Add default `Home`/`End` bindings for Vi mode

* Remove extra TIOCSWINSZ ioctl on startup

The openpty call already performs it, thus no need to call it one more
with the exact same size since it confuses some applications.

* Fix row indexing with inclusive ranges

* Use dynamic MSRV for oldstable CI

Instead of manually specifying the oldstable version in all our CI
scripts, it is now pulled from the `Cargo.toml` which simplifies the
update process.

The contributing guide has also been updated to not include the explicit
version and its wording has been loosened a bit to correctly represent
current maintenance practices.

* Bump MSRV to 1.72.0

* Fix clippy warnings

* Fix regional scrolling leaking into history

This fixes an issue where a scrolling region that does not start at the
top of the screen would still rotate lines into history when scrolling
the content "upwards".

* Fix typo in config docs

* Bump winit to 0.29.11

Fixes alacritty#7633.
Fixes alacritty#7613.
Fixes alacritty#7607.
Fixes alacritty#7571.
Fixes alacritty#7549.

* Fix feature = "cargo-clippy" deprecation

* Check alternative cursor icon names on Wayland

* Add alias support to `SerdeReplace`

* Bump winit to 0.29.12

The 0.29.11 was yanked.

* Fix build failure on NetBSD

x11-clipboard was unconditionally using eventfd which is not present
on NetBSD.

Links: quininer/x11-clipboard#48

* Fix log typos

* Bump winit to 0.29.14

Fixes alacritty#7806.

* Expose more process info on Windows

* Send exit code events on child process exit

Fixes alacritty#7753.

* Set PTY's pixel size on startup

117719b removed the extra call for TIOCSWINSZ, however the initial
`openpty` call itself did not set the pixel size, which caused issues
with some clients.

* Fix hint `Select` action for hyperlink escape

This fixes an issue where the `Select` action for hyperlink escape text
would select the entire line, instead of selecting only the hyperlink
itself.

It also changes the way hyperlinks with the same ID are highlighted,
removing the restriction of being on consecutive lines and instead
highlighting all visible cells that correspond to the matching
hyperlink.

Closes alacritty#7766.

* Bump winit to 0.29.15

* Bump dependencies

This bumps all dependencies that can be updated without introducing a
build failure.

* Drop MSRV to 1.70.0

* Allow setting terminal env vars via PTY options

Closes alacritty#7778.

* Alacritty version 0.13.2-rc1

* Fix kitty encoding used for char input without text

On Windows some key combinations for regular text input, like Ctrl+1
don't have any text attached, so they were generating the kitty escape
sequence even when they shouldn't.

* Fix msi installer build

This works around an issue where wix was pulling pre-release extensions
and thus breaking compatibility with our used wix version.

* Alacritty version 0.13.2

* Fix build

---------

Signed-off-by: Dennis Maier <d.maier94@web.de>
Signed-off-by: lilydjwg <lilydjwg@gmail.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: Nathan Lilienthal <nathan@nixpulvis.com>
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Co-authored-by: CRATO LABS <127831631+cratolabs@users.noreply.github.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Co-authored-by: Anhad Singh <62820092+Andy-Python-Programmer@users.noreply.github.com>
Co-authored-by: maierd <d.maier94@web.de>
Co-authored-by: Pavel Roskin <1317472+proski@users.noreply.github.com>
Co-authored-by: Sonu Bardai <67749330+SonuBardai@users.noreply.github.com>
Co-authored-by: Yug Shende <yugshende@gwu.edu>
Co-authored-by: Nick Reilingh <nreiling@bard.edu>
Co-authored-by: Andrea Frigido <frisoft@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: tv <tv@krebsco.de>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Arhum Jain <75106472+ArhumJain@users.noreply.github.com>
Co-authored-by: Rolf Sievert <26115145+RolfSievert@users.noreply.github.com>
Co-authored-by: Simone Ragusa <simoneragusa@duck.com>
Co-authored-by: John Nunley <jtnunley01@gmail.com>
Co-authored-by: Kyle Willmon <kylewillmon@gmail.com>
Co-authored-by: Julian Braha <julianbraha@gmail.com>
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-authored-by: Cédric Van Rompay <cedric.vanrompay@gmail.com>
Co-authored-by: Hyper <HyperHamster@users.noreply.github.com>
Co-authored-by: Philip Dubé <serprex@users.noreply.github.com>
Co-authored-by: Lars Francke <lars.francke@stackable.tech>
Co-authored-by: Omar Magdy <99906646+omagdy7@users.noreply.github.com>
Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: WuerfelDev <WuerfelDev@users.noreply.github.com>
Co-authored-by: Popa Ioan Alexandru <49609151+ALEX11BR@users.noreply.github.com>
Co-authored-by: Mohammad AlSaleh <CE.Mohammad.Alsaleh@gmail.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Alexandru Placinta <placintaalexandru1@gmail.com>
Co-authored-by: Yadi Abdalhalim <36752216+Ydot19@users.noreply.github.com>
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
Co-authored-by: Friz64 <friz64@protonmail.com>
Co-authored-by: huajin tong <137764712+thirdkeyword@users.noreply.github.com>
Co-authored-by: Small White <364772080@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants