Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917287 - FEATURES=splitdebug should follow usrmerge symlinks in /usr/lib/debug/
Summary: FEATURES=splitdebug should follow usrmerge symlinks in /usr/lib/debug/
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - External Interaction (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: usrmerge, usrmerge-fixes
  Show dependency tree
 
Reported: 2023-11-13 09:45 UTC by Maxim Britov
Modified: 2023-12-01 06:10 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Britov 2023-11-13 09:45:41 UTC
For now FEATURE=splitdebug creating old style split bin, sbin, usr/bin, usr/sbin in /usr/lib/debug/

tree -d -n /usr/lib/debug/
/usr/lib/debug/
├── lib64
├── sbin
└── usr
    ├── bin
    ├── lib64
    └── sbin

This confuses tools like gdb/valgrind, etc.

For example gdb /usr/[s]bin/squid can't find symbols.
I have to copy /usr/lib/debug/usr/sbin/squid.debug into /usr/lib/debug/usr/bin/
Then gdb /usr/[s]bin/squid load debug symbols.

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-13 09:49:53 UTC
This came up on the gdb side at https://sourceware.org/bugzilla/show_bug.cgi?id=24143 too...
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-13 10:22:03 UTC
Could you consider filing a bug for Valgrind upstream if there isn't one already, and possibly elfutils if it also suffers from the same problem?

Thank you.
Comment 3 Matt Whitlock 2023-11-13 19:13:27 UTC
What if you create the same symlinks beneath /usr/lib/debug as exist within the top level? Then the package manager will install the split debug files in /usr/lib/debug/usr/bin regardless of whether they were split from binaries intending to be installed in /bin, /sbin, /usr/bin, or /usr/sbin, and debug tools should then find them regardless of whether they're implementing the original or patched lookup behavior.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-13 20:12:19 UTC
That sounds like a good idea. Could I tempt one of you to have a go at implementing it? I'm swamped at the moment.
Comment 5 Matt Whitlock 2023-11-13 20:39:47 UTC
Seems to work...


$ /sbin/fdisk --version
fdisk from util-linux 2.39.2

$ readlink -e /sbin/fdisk
/usr/bin/fdisk

$ readlink -e /usr/lib/debug/sbin/fdisk.debug
/usr/lib/debug/sbin/fdisk.debug

$ gdb /sbin/fdisk </dev/null | tail -n3 | head -n2
Reading symbols from /sbin/fdisk...
(No debugging symbols found in /sbin/fdisk)

$ gdb /usr/bin/fdisk </dev/null | tail -n3 | head -n2
Reading symbols from /usr/bin/fdisk...
(No debugging symbols found in /usr/bin/fdisk)


# cd /usr/lib/debug
# mv --no-clobber {{,s}bin,usr/sbin}/* usr/bin/
# rmdir {,s}bin usr/sbin
# for each in {,s}bin usr/sbin ; do ln -rsfnv usr/bin "${each}" ; done
'bin' -> 'usr/bin'
'sbin' -> 'usr/bin'
'usr/sbin' -> 'bin'


$ readlink -e /usr/lib/debug/sbin/fdisk.debug
/usr/lib/debug/usr/bin/fdisk.debug

$ gdb /sbin/fdisk </dev/null | tail -n3 | head -n2
Reading symbols from /sbin/fdisk...
Reading symbols from /usr/lib/debug//usr/bin/fdisk.debug...

$ gdb /usr/bin/fdisk </dev/null | tail -n3 | head -n2
Reading symbols from /usr/bin/fdisk...
Reading symbols from /usr/lib/debug//usr/bin/fdisk.debug...