fastfetch-cli / fastfetch

A maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
11k stars 425 forks source link

bug: segfault on Ubuntu (lunar) #477

Closed Rexogamer closed 1 year ago

Rexogamer commented 1 year ago

General description of bug:

When I try to run the script, it makes it 4 lines in before pausing, then segfaulting: image

Often helpful questions:

Output of fastfetch --version:

fastfetch 1.11.3 (x86_64)

Output of fastfetch --load-config devinfo:

rexo@rexo-i5593-ubuntu:~$ fastfetch --load-config devinfo
                            ....               rexo@rexo-i5593-ubuntu
              .',:clooo:  .:looooo:.           ----------------------
           .;looooooooc  .oooooooooo'          OS: Ubuntu 23.04 x86_64
        .;looooool:,''.  :ooooooooooc          Host: Inspiron 5593
       ;looool;.         'oooooooooo,          Kernel: 6.2.0-1003-oracle
      ;clool'             .cooooooc.  ,,       Uptime: 6 hours, 38 mins
         ...                ......  .:oo,      Packages: 2033 (dpkg), 12 (flatpak), 19 (snap)
  .;clol:,.                        .loooo'     Shell: bash 5.2.15
Segmentation fault (core dumped)    'ooool    
rexo@rexo-i5593-ubuntu:~$            loooo.    
'ooooooooool                         coooo.    
 ,loooooooc.                        .loooo.    
   .,;;;'.                          ;ooooc    
       ...                         ,ooool.    
    .cooooc.              ..',,'.  .cooo.    
      ;ooooo:.           ;oooooooc.  :l.    
       .coooooc,..      coooooooooo.    
         .:ooooooolc:. .ooooooooooo'    
           .':loooooo;  ,oooooooooc    
               ..';::c'  .;loooo:'    
                             .    

Output of fastfetch --load-config devinfo-verbose:

rexo@rexo-i5593-ubuntu:~$ fastfetch --load-config devinfo-verbose
                            ....               rexo@rexo-i5593-ubuntu
              .',:clooo:  .:looooo:.           ----------------------
           .;looooooooc  .oooooooooo'          OS: System: Linux; Name: Ubuntu; Pretty name: Ubuntu 23.04; ID: ubuntu; ID like: debian; Variant: ; Variant ID: ; Version: 23.04 (Lunar Lobster); Version ID: 23.04; Version codename: lunar; Build ID: ; Architecture: x86_64
        .;looooool:,''.  :ooooooooooc          Host: Family: product_family: Inspiron; product_name: Inspiron 5593; product_version: ; product_sku: 097C; sys_vendor: Dell Inc.
       ;looool;.         'oooooooooo,          Bios: 1.26
      ;clool'             .cooooooc.  ,,       Board: 035VMP
         ...                ......  .:oo,      Chassis: 10
  .;clol:,.                        .loooo'     Kernel: Sysname: Linux; Release: 6.2.0-1003-oracle; Version: #3-Ubuntu SMP Thu Apr  6 10:02:34 UTC 2023
 :ooooooooo,                        'ooool     Uptime: Days: 0; Hours: 6; Minutes: 39; Seconds: 59
'ooooooooooo.                        loooo.    Processes: Count: 1306
'ooooooooool                         coooo.    Packages: All: 2064; pacman: 0; pacman branch: ; dpkg: 2033; rpm: 0; emerge: 0; eopkg: 0; xbps: 0; apk: 0; flatpak-system: 0; flatpak-user: 0; snap: 0; brew: 0; brew-cask: 12; port: 0; scoop: 19; choco: 0
 ,loooooooc.                        .loooo.    Shell: Process name: bash; Process path: bash; Process exe: bash; Process version: 5.2.15; User path: /bin/bash; User exe: bash; User version: 5.2.15
Segmentation fault (core dumped)    ;ooooc    
rexo@rexo-i5593-ubuntu:~$          ,ooool.    
    .cooooc.              ..',,'.  .cooo.    
      ;ooooo:.           ;oooooooc.  :l.    
       .coooooc,..      coooooooooo.    
         .:ooooooolc:. .ooooooooooo'    
           .':loooooo;  ,oooooooooc    
               ..';::c'  .;loooo:'    
                             .    

Output of fastfetch --list-features:

threads
libpci
vulkan
wayland
xcb-randr
xcb
xrandr
x11
gio
dconf
dbus
imagemagick6
zlib
xfconf
sqlite3
rpm
egl
glx
osmesa
opencl
libpulse
libnm
Rexogamer commented 1 year ago

The core dump is too big to upload directly to GitHub, but you can find it on GDrive here

CarterLi commented 1 year ago

I'm not able to use the core dump file. Can you get the stack trace using gdb?

$ gdb /path/to/fastfetch
$ run
$ bt

I think we need to update the issue template

CarterLi commented 1 year ago

It seems that it was module Packages segfault. What package managers did you use?

It was module Display segfault.

Rexogamer commented 1 year ago

Do you still need the gdb trace? If so, I tried to get it but it said there weren't any debugging symbols 🤔

CarterLi commented 1 year ago

Yes, I do. Please download and install the latest dev build and try again

https://github.com/fastfetch-cli/fastfetch/actions/runs/5302263868

Rexogamer commented 1 year ago

Hope this helps:

(gdb) bt
#0  0x0000043800000780 in ?? ()
#1  0x00007ffff7f898b6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#2  0x00007ffff7f8634d in ffi_call_int (cif=cif@entry=0x7ffff7bfe610, fn=<optimised out>, rvalue=<optimised out>, avalue=<optimised out>, closure=closure@entry=0x0)
    at ../src/x86/ffi64.c:673
#3  0x00007ffff7f88f33 in ffi_call (cif=cif@entry=0x7ffff7bfe610, fn=<optimised out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffff7bfe6e0) at ../src/x86/ffi64.c:710
#4  0x00007ffff7f93b20 in wl_closure_invoke (closure=closure@entry=0x7ffff0008160, target=<optimised out>, target@entry=0x7ffff0008270, opcode=opcode@entry=4, data=<optimised out>, 
    flags=<optimised out>) at ../src/connection.c:1025
#5  0x00007ffff7f942c3 in dispatch_event (display=display@entry=0x7ffff0002330, queue=<optimised out>, queue=<optimised out>) at ../src/wayland-client.c:1595
#6  0x00007ffff7f944bc in dispatch_queue (queue=0x7ffff0002400, display=0x7ffff0002330) at ../src/wayland-client.c:1741
#7  wl_display_dispatch_queue_pending (display=display@entry=0x7ffff0002330, queue=queue@entry=0x7ffff0002400) at ../src/wayland-client.c:1983
#8  0x00007ffff7f95e43 in wl_display_dispatch_queue (queue=<optimised out>, display=<optimised out>) at ../src/wayland-client.c:1959
#9  0x00007ffff7f96f1f in wl_display_roundtrip_queue (display=0x7ffff0002330, queue=0x7ffff0002400) at ../src/wayland-client.c:1370
#10 0x00005555555838e5 in waylandOutputHandler (version=4, name=4, registry=<optimised out>, wldata=0x7ffff7bfedb0)
    at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/linux/wayland.c:153
#11 waylandGlobalAddListener (data=0x7ffff7bfedb0, registry=<optimised out>, name=4, interface=<optimised out>, version=4)
    at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/linux/wayland.c:217
#12 0x00007ffff7f898b6 in ffi_call_unix64 () at ../src/x86/unix64.S:104
#13 0x00007ffff7f8634d in ffi_call_int (cif=cif@entry=0x7ffff7bfeb10, fn=<optimised out>, rvalue=<optimised out>, avalue=<optimised out>, closure=closure@entry=0x0)
    at ../src/x86/ffi64.c:673
#14 0x00007ffff7f88f33 in ffi_call (cif=cif@entry=0x7ffff7bfeb10, fn=<optimised out>, rvalue=rvalue@entry=0x0, avalue=avalue@entry=0x7ffff7bfebe0) at ../src/x86/ffi64.c:710
#15 0x00007ffff7f93b20 in wl_closure_invoke (closure=closure@entry=0x7ffff00069a0, target=<optimised out>, target@entry=0x7ffff0006510, opcode=opcode@entry=0, data=<optimised out>, 
    flags=<optimised out>) at ../src/connection.c:1025
#16 0x00007ffff7f942c3 in dispatch_event (display=display@entry=0x7ffff0002330, queue=<optimised out>, queue=<optimised out>) at ../src/wayland-client.c:1595
#17 0x00007ffff7f944bc in dispatch_queue (queue=0x7ffff0002400, display=0x7ffff0002330) at ../src/wayland-client.c:1741
#18 wl_display_dispatch_queue_pending (display=0x7ffff0002330, queue=0x7ffff0002400) at ../src/wayland-client.c:1983
#19 0x0000555555583d3f in detectWayland (instance=instance@entry=0x7fffffffce20, result=result@entry=0x5555555e2dc0 <result>)
    at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/linux/wayland.c:260
#20 0x0000555555583dfc in ffdsConnectWayland (instance=instance@entry=0x7fffffffce20, result=result@entry=0x5555555e2dc0 <result>)
    at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/linux/wayland.c:281
#21 0x00005555555835a7 in ffConnectDisplayServerImpl (ds=ds@entry=0x5555555e2dc0 <result>, instance=instance@entry=0x7fffffffce20)
    at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/linux/displayserver_linux.c:64
#22 0x00005555555660a3 in ffConnectDisplayServer (instance=0x7fffffffce20) at /home/runner/work/fastfetch/fastfetch/src/detection/displayserver/displayserver.c:37
#23 0x000055555555ff9d in ffConnectDisplayServerThreadMain (data=<optimised out>) at /home/runner/work/fastfetch/fastfetch/src/common/init.c:152
#24 0x00007ffff7c8f18a in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:444
#25 0x00007ffff7d1dbd0 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
CarterLi commented 1 year ago

It's really helpful! Thanks.

@LinusDierheimer Can you help with that?

CarterLi commented 1 year ago

Got tested on a physical machine, and reproduced the crash issue with the deb package built by Github-CI

image

But I can't reproduce it when building from source

image

I suppose the issue comes from wl_output_listener

https://github.com/fastfetch-cli/fastfetch/blob/466477429d0d0a48823d311b49d0f118047f4a79/src/detection/displayserver/linux/wayland.c#L128-L142

We build Ubuntu (deb) packages on Ubuntu 20.04, which uses an old wayland-dev package that doesn't support wl_output_listener::name or wl_output_listener::description.

image

Therefore wl_output_listener is a smaller data structure on Ubuntu 20.04. It is actually an ABI break change of libwayland

I can somehow make some hacks to work around this issue, but building binaries on old Linux systems is honestly a bad idea

@LinusDierheimer Thoughts?

LinusDierheimer commented 1 year ago

I don't want to build on a newer system, Ubuntu 20.04 is still widly used and should be supported. How does libwayland handle it if we provide the newer definition of the struct by our selfs and always use that?

building binaries on old Linux systems is honestly a bad idea

In the worst case we update the ci to provide a different deb package for each version

CarterLi commented 1 year ago

In the worst case we update the ci to provide a different deb package for each version

Yeah, that's what I want to suggest.

CarterLi commented 1 year ago

@Rexogamer Please confirm if the latest dev build works for you

Rexogamer commented 1 year ago

Can confirm that the latest dev build works :tada: image

CarterLi commented 1 year ago

Thanks for reporting