sminez / penrose

A library for writing an X11 tiling window manager
https://sminez.github.io/penrose/
MIT License
1.24k stars 87 forks source link

Some Unicode codepoints seem to crash the status bar in penrose_ui #313

Open bbarker opened 20 hours ago

bbarker commented 20 hours ago

Describe the bug

I have certain unicode codepoints used for apps in the status bar.

Current problematic codepoints include:

When I restart penrose (pkill penrose) the status bar causes a crashloop in penrose. This can be fixed by either disabling the bar or disabling the above codepoints in the status bar, and killing again. This occurs in both release and debug builds.

The error I get in logs is not a rust error but an X error;

X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  347
  Current serial number in output stream:  409

...

To Reproduce

I haven't experienced this issue on NixOS, only on Pop!_OS (Ubuntu-based). I thought that installing the appropriate nerd font (which I verified was available with fc-list | grep "Hasklug Nerd Font Mono") would fix the issue. But so far, that doesn't seem to be the case.

Steps to reproduce the behavior:

  1. Use the above codepoint(s) in the status bar.

Alternatively

  1. Try my penrose build https://github.com/bbarker/dotpenrose - the readme can be ignored.

Expected behavior

If the glyph is missing, it should render something (nothing?) without crashing.

...

Screenshots

https://cdn.discordapp.com/attachments/1042031424879984640/1294300831293898845/VID_20241011_092959.mp4?ex=671071d5&is=670f2055&hm=19f67d2192c2644be50af2bc713ef3512c574fddaaca5bef89e47552d6a67e35&

Discord thread

https://discord.com/channels/1042031165349040148/1294330952654520350

Versions & OS Details

$ uname -a
Linux pop-os-thelio-major 6.9.3-76060903-generic #202405300957~1726766035~22.04~4092a0e SMP PREEMPT_DYNAMIC Thu S x86_64 x86_64 x86_64 GNU/Linux

$ grep penrose Cargo.toml
name = "dotpenrose"
  "crates/penrose_bbarker_contrib"
penrose = { version = "0.3.6", features = ["keysyms", "serde"] }
penrose_ui = { version = "0.3.6" }
penrose_bbarker_contrib = { version = "0.1.2", path = "crates/penrose_bbarker_contrib" }

$ glxinfo | head
name of display: :1
display: :1  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context,
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
    GLX_ARB_multisample, GLX_EXT_buffer_age,

Additional context

sminez commented 2 hours ago

Hi @bbarker, I've tried cloning and running your penrose WM under Ubuntu 24.04 which is what I run on my machine. As you can see from the video below everything seems to work fine, even without having Hasklug Nerd Font Mono installed. Given that you only see this under Pop!_OS and only when restarting the window manager (not on first start) I suspect that this isn't going to be an issue with penrose and that it is more likely something to do with Pop!_OS or rather your current setup under Pop!_OS.

That's not to say that I don't think there's a chance that there are some X11 bugs in the penrose UI status bar code, but I'd expect them to trigger somewhat consistently on different set ups as the X11 code in there is really quite minimal. So anything that is wrong should be obviously wrong in all cases, not subtly wrong like this. The process fully exiting and then crashing on startup with BadLength (poly request too large or internal Xlib length error) smells like there being some left over state on the X server potentially? But that is just a wild guess at a possible cause.

Hunting around online for this particular error message brought me to a couple of different articles / issues that all suggest the same fix of installing the unifont package:

Failing that, I know you mentioned that you didn't have this issue on NixOS and I can't reproduce it on stock Ubuntu. Do you have any other setups you could try this on to see if you can trigger the behvaiour outside of Pop!_OS?

https://github.com/user-attachments/assets/819afe41-fecd-40c8-89d3-105117cefc88