Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 904142 - gui-wm/hyprland-0.22.0 strips symbols from Crash Report
Summary: gui-wm/hyprland-0.22.0 strips symbols from Crash Report
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Julien
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-10 19:09 UTC by ignamartinoli
Modified: 2023-11-26 01:09 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/usr/bin/Hyprland output (output,23.33 KB, text/plain)
2023-04-11 05:22 UTC, ignamartinoli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ignamartinoli 2023-04-10 19:09:16 UTC
While reporting an issue for gui-wm/hyprland-0.22.0 upstream (https://github.com/hyprwm/Hyprland/issues/2016), I noticed that the Crash Report has all its symbols stripped.

It's the first time I stumble with something like this, so I'm not really sure which files I need to share to track this down.
Comment 1 ignamartinoli 2023-04-10 19:19:41 UTC
The maintainer @vaxerski suggested:

"make sure -rdynamic is passed to ld and that there is no symbol stripping process anywhere"
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-10 19:23:05 UTC
Please see https://wiki.gentoo.org/wiki/Debugging#Per-package.
Comment 3 ignamartinoli 2023-04-10 20:03:06 UTC
Thanks Sam as always to point me to the right direction.

I tried following the steps:

1. I installed debugedit and gdb

2. I pasted to /etc/portage/env/debugsyms the snippet

CFLAGS="${CFLAGS} -ggdb3"
CXXFLAGS="${CXXFLAGS} -ggdb3"
# nostrip is disabled here because it negates splitdebug
FEATURES="${FEATURES} splitdebug compressdebug -nostrip"

3. I wrote to /etc/portage/package.env/hyprland the line

gui-wm/hyprland debugsyms.

4. I run emerge --ask --oneshot gui-wm/hyprland

I then proceeded to provoke the crash.

After inspecting, the report still shows stripped symbols. Is there anything I forgot to do?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-10 20:12:30 UTC
You're very welcome :)

Could you try commenting out/removing the package.env entry and run: FEATURES="nostrip installsources" CFLAGS="-O2 -ggdb3" CXXFLAGS="-O2 -ggdb3" emerge -v1 gui-wm/hyprland?

This bypasses all of the fancy separate debugging info stuff we normally do and keeps it all in the binaries themselves.

If that command works, we can transform it into an env file for you then.
Comment 5 ignamartinoli 2023-04-11 01:13:17 UTC
I recompiled with that command, but I still get stripped symbols when I provoke a crash
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-11 04:07:08 UTC
(In reply to ignamartinoli from comment #5)
> I recompiled with that command, but I still get stripped symbols when I
> provoke a crash

Can you run file /usr/bin/hyprland or whatever the path to the binary is, and show me the output?
Comment 7 ignamartinoli 2023-04-11 05:22:25 UTC
Created attachment 859830 [details]
/usr/bin/Hyprland output
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-11 05:23:44 UTC
(In reply to ignamartinoli from comment #7)
> Created attachment 859830 [details]
> /usr/bin/Hyprland output

can you show me `file /usr/bin/Hyprland` too? (file is a command too, it's a bit confusing)
Comment 9 ignamartinoli 2023-04-11 18:30:32 UTC
I added the output as an attachment
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-11 18:32:19 UTC
(In reply to ignamartinoli from comment #9)
> I added the output as an attachment

That's the output of Hyprland, not the file command run on Hyprland
Comment 11 ignamartinoli 2023-04-11 18:37:17 UTC
Aaaah sorry, I got confused, here is the output


sicro@sicro ~ $ file /usr/bin/Hyprland
/usr/bin/Hyprland: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped


It says that it's not stripped, but today I made it crash again and the Crash Report Backtrace was


	#0 | Hyprland(+0x113758) [0x556273e65758]
		??
		??:0
	#1 | Hyprland(+0x57179) [0x556273da9179]
		??
		??:0
	#2 | /lib64/libc.so.6(+0x38a00) [0x7fb16de73a00]
		??
		??:0
	#3 | Hyprland(+0x59a83) [0x556273daba83]
		??
		??:0
	#4 | Hyprland(+0x1281a0) [0x556273e7a1a0]
		??
		??:0
	#5 | Hyprland(+0x90d9a) [0x556273de2d9a]
		??
		??:0
	#6 | Hyprland(+0x9b32c) [0x556273ded32c]
		??
		??:0
	#7 | /usr/lib64/libwayland-server.so.0(wl_signal_emit_mutable+0x7c) [0x7fb16e773b1c]
		??
		??:0
	#8 | Hyprland(+0x147a58) [0x556273e99a58]
		??
		??:0
	#9 | /usr/lib64/libdrm.so.2(drmHandleEvent+0xf7) [0x7fb16e74fc17]
		??
		??:0
	#10 | Hyprland(+0x149a69) [0x556273e9ba69]
		??
		??:0
	#11 | /usr/lib64/libwayland-server.so.0(wl_event_loop_dispatch+0xd2) [0x7fb16e775b22]
		??
		??:0
	#12 | /usr/lib64/libwayland-server.so.0(wl_display_run+0x25) [0x7fb16e773555]
		??
		??:0
	#13 | Hyprland(+0x487c6) [0x556273d9a7c6]
		??
		??:0
	#14 | /lib64/libc.so.6(+0x238ca) [0x7fb16de5e8ca]
		??
		??:0
	#15 | /lib64/libc.so.6(__libc_start_main+0x85) [0x7fb16de5e985]
		??
		??:0
	#16 | Hyprland(+0x4bed1) [0x556273d9ded1]
		??
		??:0
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-12 07:48:40 UTC
pfff. I feel borderline stumped. I think it might be easier if we try debug this on IRC interactively?
Comment 13 ignamartinoli 2023-04-12 15:23:01 UTC
Alright, never used IRC but I can try.
Can you send me the link?
Comment 14 Julien 2023-04-12 16:59:21 UTC
Note that the latest version of Hyprland is 0.24.1. I updated the ebuild in GURU recently, but it hasn't been merged in master yet, so only 0.22.0 is available for now.

I'm sure upstream will ask you to reproduce on the latest release so it might be pertinent try this bug again on 0.24.1 once it's available.
Comment 15 Julien 2023-04-13 13:54:55 UTC
The latest version 0.24.1 is now published in GURU, so you can update to it
Comment 16 Julien 2023-04-14 01:51:23 UTC
If you can reproduce the bug on 0.24.1, can you try to put the following in /etc/portage/env/hyprland.conf:

CFLAGS="${CFLAGS} -ggdb3"
CXXFLAGS="${CXXFLAGS} -ggdb3"
LDFLAGS="${LDFLAGS} -rdynamic"
FEATURES="-splitdebug -compressdebug nostrip"

You may have to create the `env` directory if it doesn't exist
Once that file is created put the following in /etc/portage/package.env:

gui-wm/hyprland hyprland.conf

After that, rebuild hyprland, and (hopefully) your stack trace should contain symbols
Comment 17 ignamartinoli 2023-04-14 03:55:59 UTC
The upgrade throws an error.

I checked myself the build log, the error is provoked because there is no /usr/share/protocols/hyprland-global-shortcuts-v1.xml file.
This is quite similar to a bug I previously filled (https://bugs.gentoo.org/891799).

I would like to create a PR and fix this.
Could you guide me so that in the future I can be more useful to the distro?
(I have zero experience writing patches)

The error is in the line 35 of protocols/mason.build (https://github.com/hyprwm/Hyprland/blob/main/protocols/meson.build#L35).

It should be

  ['/usr/share', 'protocols/hyprland-global-shortcuts-v1.xml']

By working over the patch for the version 0.21.0 (https://github.com/gentoo-mirror/guru/blob/master/gui-wm/hyprland/files/0.21.0-meson.patch), I came up with this:

diff --git a/protocols/meson.build b/protocols/meson.build
index 9d47e0a..d9fc8a6 100644
--- a/protocols/meson.build
+++ b/protocols/meson.build
@@ -29,7 +29,7 @@ protocols = [
   ['pointer-constraints-unstable-v1.xml'],
   ['tablet-unstable-v2.xml'],
   ['idle.xml'],
-  [hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml']
+  ['/usr/share', 'protocols/hyprland-toplevel-export-v1.xml']
# -  [hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
# +  ['/usr/share', 'protocols/hyprland-global-shortcuts-v1.xml']
 ]
 wl_protos_src = []
 wl_protos_headers = []

By adding the two lines that begin with #, would it be enough? Or I should change the numbers after @@ and the index too?
Comment 18 ignamartinoli 2023-04-14 04:03:01 UTC
I did a little bit of homework this time ahahah :D
Comment 19 ignamartinoli 2023-04-14 04:12:14 UTC
Nevermind,

I found the manual entry (https://wiki.gentoo.org/wiki/Creating_a_patch).

This is the patch

diff --git a/protocols/meson.build b/protocols/meson.build
index 458de86..294d9ee 100644
--- a/protocols/meson.build
+++ b/protocols/meson.build
@@ -31,8 +31,8 @@ protocols = [
   ['pointer-constraints-unstable-v1.xml'],
   ['tablet-unstable-v2.xml'],
   ['idle.xml'],
-  [hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
-  [hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
+  ['/usr/share', 'protocols/hyprland-toplevel-export-v1.xml'],
+  ['/usr/share', 'protocols/hyprland-global-shortcuts-v1.xml']
 ]
 wl_protos_src = []
 wl_protos_headers = []

I'm going to test it and if it works I'm going to open a PR.
Comment 20 Julien 2023-04-14 04:14:27 UTC
Ah yes, I remember that bug quite well, it was annoying to fix :D
It seems upstream added a new file that behaves similarly to the previous one, and the bug filed upstream is still not resolved (https://github.com/hyprwm/Hyprland/issues/1207)

Unfortunately I did not catch this change, and I suspect it means many more people will have issues with the upgrade

The patch you are proposing would work.
The proper way to make a patch file is to clone the Hyprland repository, checkout the tag for version in question (v0.24.1), modify the meson.build file as you propose, and use the `git diff` command to generate a patch, eg. `git diff > meson.patch`

However, there is another modification that needs to be done in the ebuild (see line 84, it needs to be done also for the hyprland-global-shortcuts-v1.xml)

Regarding the PR, just to be sure you are talking about GURU and not Hyprland? Because this patch is only needed for Gentoo, so it doesn't need to be sent upstream.

Also, this is out of scope for this bug, so feel free to open a new one.
Comment 21 ignamartinoli 2023-04-14 04:22:08 UTC
Alright, here is the bug link https://bugs.gentoo.org/904299. Let's fix that and then we'll come back here.
Comment 22 ignamartinoli 2023-05-04 19:38:26 UTC
I'm back!

To recap (a terminal snippet is worth 1000 words):


sicro@sicro ~ $ cat /etc/portage/env/hyprland.conf
CFLAGS="${CFLAGS} -ggdb3"
CXXFLAGS="${CXXFLAGS} -ggdb3"
LDFLAGS="${LDFLAGS} -rdynamic"
FEATURES="-splitdebug -compressdebug nostrip"

sicro@sicro ~ $ cat /etc/portage/package.env/hyprland
gui-wm/hyprland hyprland.conf

sicro@sicro ~ $ emerge -1 gui-wm/hyprland

[ebuild   R    ] gui-wm/hyprland-0.24.1-r1

sicro@sicro ~ $ emerge -p dev-util/debugedit sys-devel/gdb

[ebuild   R    ] sys-devel/gdb-13.1.90_p20230429
[ebuild   R    ] dev-util/debugedit-5.0-r1

sicro@sicro ~ $ cat .config/hyprland/hyprland.conf
monitor = eDP-1, preferred, auto, 1
monitor = HDMI-A-1, preferred, auto, 1, mirror, eDP-1


I inserted only useful information from the outputs.

I rebooted and after inserting the HDMI cable to another monitor the crash occurred.

As shown here the crash report got its symbols stripped:


sicro@sicro ~ $ cat .cache/hyprland/hyprlandCrashReport9738.txt
Backtrace:
	#0 | Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0xa6f) [0x5562596183df]
		??
		??:0
	#1 | Hyprland(_Z25handleUnrecoverableSignali+0x3c) [0x55625953f02c]
		??
		??:0
	#2 | /lib64/libc.so.6(+0x38ba0) [0x7f2236710ba0]
		??
		??:0
	#3 | Hyprland(_ZN11CCompositor16getWorkspaceByIDERKi+0x13) [0x556259541fb3]
		??
		??:0
	#4 | Hyprland(_ZN17CHyprMasterLayout18recalculateMonitorERKi+0x40) [0x556259631580]
		??
		??:0
	#5 | Hyprland(_ZN13CHyprRenderer13renderMonitorEP8CMonitor+0x769) [0x5562595cf8a9]
		??
		??:0
	#6 | Hyprland(_Z13handleWrappedP11wl_listenerPv+0x3c) [0x556259584b9c]
		??
		??:0
	#7 | /usr/lib64/libwayland-server.so.0(wl_signal_emit_mutable+0x7c) [0x7f2237186b1c]
		??
		??:0
	#8 | Hyprland(+0x1e17a8) [0x55625965b7a8]
		??
		??:0
	#9 | /usr/lib64/libdrm.so.2(drmHandleEvent+0xf7) [0x7f2237162c17]
		??
		??:0
	#10 | Hyprland(handle_drm_event+0x4c) [0x55625965dc2c]
		??
		??:0
	#11 | /usr/lib64/libwayland-server.so.0(wl_event_loop_dispatch+0xd2) [0x7f2237188b22]
		??
		??:0
	#12 | /usr/lib64/libwayland-server.so.0(wl_display_run+0x25) [0x7f2237186555]
		??
		??:0
	#13 | Hyprland(main+0x428) [0x55625952ca28]
		??
		??:0
	#14 | /lib64/libc.so.6(+0x238ca) [0x7f22366fb8ca]
		??
		??:0
	#15 | /lib64/libc.so.6(__libc_start_main+0x85) [0x7f22366fb985]
		??
		??:0
	#16 | Hyprland(_start+0x21) [0x5562595328c1]
		??
		??:0


Does anybody know if there is something I am missing here?
Comment 23 Alfred Wingate 2023-08-04 17:44:41 UTC
(In reply to ignamartinoli from comment #22)
> I'm back!
> 
> To recap (a terminal snippet is worth 1000 words):
> 
> 
> sicro@sicro ~ $ cat /etc/portage/env/hyprland.conf
> CFLAGS="${CFLAGS} -ggdb3"
> CXXFLAGS="${CXXFLAGS} -ggdb3"
> LDFLAGS="${LDFLAGS} -rdynamic"
> FEATURES="-splitdebug -compressdebug nostrip"
> 
> sicro@sicro ~ $ cat /etc/portage/package.env/hyprland
> gui-wm/hyprland hyprland.conf
> 
> sicro@sicro ~ $ emerge -1 gui-wm/hyprland
> 
> [ebuild   R    ] gui-wm/hyprland-0.24.1-r1
> 
> sicro@sicro ~ $ emerge -p dev-util/debugedit sys-devel/gdb
> 
> [ebuild   R    ] sys-devel/gdb-13.1.90_p20230429
> [ebuild   R    ] dev-util/debugedit-5.0-r1
> 
> sicro@sicro ~ $ cat .config/hyprland/hyprland.conf
> monitor = eDP-1, preferred, auto, 1
> monitor = HDMI-A-1, preferred, auto, 1, mirror, eDP-1
> 
> 
> I inserted only useful information from the outputs.
> 
> I rebooted and after inserting the HDMI cable to another monitor the crash
> occurred.
> 
> As shown here the crash report got its symbols stripped:
> 
> 
> sicro@sicro ~ $ cat .cache/hyprland/hyprlandCrashReport9738.txt
> Backtrace:
> 	#0 | Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0xa6f)
> [0x5562596183df]
> 		??
> 		??:0
> 	#1 | Hyprland(_Z25handleUnrecoverableSignali+0x3c) [0x55625953f02c]
> 		??
> 		??:0
> 	#2 | /lib64/libc.so.6(+0x38ba0) [0x7f2236710ba0]
> 		??
> 		??:0
> 	#3 | Hyprland(_ZN11CCompositor16getWorkspaceByIDERKi+0x13) [0x556259541fb3]
> 		??
> 		??:0
> 	#4 | Hyprland(_ZN17CHyprMasterLayout18recalculateMonitorERKi+0x40)
> [0x556259631580]
> 		??
> 		??:0
> 	#5 | Hyprland(_ZN13CHyprRenderer13renderMonitorEP8CMonitor+0x769)
> [0x5562595cf8a9]
> 		??
> 		??:0
> 	#6 | Hyprland(_Z13handleWrappedP11wl_listenerPv+0x3c) [0x556259584b9c]
> 		??
> 		??:0
> 	#7 | /usr/lib64/libwayland-server.so.0(wl_signal_emit_mutable+0x7c)
> [0x7f2237186b1c]
> 		??
> 		??:0
> 	#8 | Hyprland(+0x1e17a8) [0x55625965b7a8]
> 		??
> 		??:0
> 	#9 | /usr/lib64/libdrm.so.2(drmHandleEvent+0xf7) [0x7f2237162c17]
> 		??
> 		??:0
> 	#10 | Hyprland(handle_drm_event+0x4c) [0x55625965dc2c]
> 		??
> 		??:0
> 	#11 | /usr/lib64/libwayland-server.so.0(wl_event_loop_dispatch+0xd2)
> [0x7f2237188b22]
> 		??
> 		??:0
> 	#12 | /usr/lib64/libwayland-server.so.0(wl_display_run+0x25)
> [0x7f2237186555]
> 		??
> 		??:0
> 	#13 | Hyprland(main+0x428) [0x55625952ca28]
> 		??
> 		??:0
> 	#14 | /lib64/libc.so.6(+0x238ca) [0x7f22366fb8ca]
> 		??
> 		??:0
> 	#15 | /lib64/libc.so.6(__libc_start_main+0x85) [0x7f22366fb985]
> 		??
> 		??:0
> 	#16 | Hyprland(_start+0x21) [0x5562595328c1]
> 		??
> 		??:0
> 
> 
> Does anybody know if there is something I am missing here?

After looking at this for a bit I think the above output is correct. The symbols are included, just mangled and offset. The question marks are from addr2line where Gentoo's default pie comes in.

If you disable pie the crash reporter can resolve the addr2line bits as well.

And here is an example unstripped, LDFLAGS="-no-pie" and debugging info included so CXXFLAGS="-gdwarf". 

Backtrace:
        #0 | ./build/src/Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0x75e) [0x4ed54e]
                _ZN13CrashReporter18createAndSaveCrashEi
                /home/ask/sources/Hyprland/build/../src/debug/CrashReporter.cpp:86
        #1 | ./build/src/Hyprland(_Z25handleUnrecoverableSignali+0x3c) [0x5b4f1c]
                _Z25handleUnrecoverableSignali
                /home/ask/sources/Hyprland/build/../src/Compositor.cpp:35
        #2 | /lib64/libc.so.6(+0x38fa0) [0x7fa4a7b82fa0]
                ??
                ??:0
        #3 | /lib64/libc.so.6(+0x87f9c) [0x7fa4a7bd1f9c]
                ??
                ??:0
        #4 | /lib64/libc.so.6(gsignal+0x12) [0x7fa4a7b82ef2]
                ??
                ??:0
        #5 | /lib64/libc.so.6(abort+0xd3) [0x7fa4a7b6c4ad]
                ??
                ??:0
        #6 | /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6(+0xa7ca3) [0x7fa4a7ea7ca3]
                ??
                ??:0
        #7 | /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6(+0xdd1b6) [0x7fa4a7edd1b6]
                ??
                ??:0
        #8 | /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6(+0xdd221) [0x7fa4a7edd221]
                ??
                ??:0
        #9 | /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6(+0xdd483) [0x7fa4a7edd483]
                ??
                ??:0
        #10 | ./build/src/Hyprland() [0x473842]
                _ZN11CCompositor10initServerEv
                /home/ask/sources/Hyprland/build/../src/Compositor.cpp:125 (discriminator 2)
        #11 | ./build/src/Hyprland(main+0xa70) [0x48e9b0]
                main
                /home/ask/sources/Hyprland/build/../src/main.cpp:100
        #12 | /lib64/libc.so.6(+0x2398a) [0x7fa4a7b6d98a]
                ??
                ??:0
        #13 | /lib64/libc.so.6(__libc_start_main+0x85) [0x7fa4a7b6da45]
                ??
                ??:0
        #14 | ./build/src/Hyprland(_start+0x21) [0x491261]
                _start
                ??:?

Disabling pie isn't optimal so i've played around with it a bit more.

Internally in the code they use the following.
$ addr2line -e build/src/Hyprland -f 0x564c73fb258e
??
??:0


This doesn't mean that the information is unobtainable with pie enabled, just execinfo doesn't give the information in a convenient way. 
$ addr2line -e build/src/Hyprland -f _ZN13CrashReporter18createAndSaveCrashEi+0x75e
_ZN13CrashReporter18createAndSaveCrashEi
/home/ask/sources/Hyprland/build/../src/debug/CrashReporter.cpp:86

Im still looking at this if this could be improved upstream, I can see that NixOS bug reports have the same issues.