rfc patch PR32760: find-debuginfo for static libraries

Frank Ch. Eigler fche@redhat.com
Mon Mar 10 21:53:32 GMT 2025


Hi, Mark -

> Indeed :{ There are only minimal checks in the debugedit repo. [...]

Will add something.

> The main issue is that find-debuginfo still has some dependencies on
> being called from rpm.
> https://sourceware.org/bugzilla/show_bug.cgi?id=27637

Yeah but it's just a couple of env vars; a test can fake that.


> > -# Copyright (C) 2002-2021 rpm and debugedit contributors
> > +# Copyright (C) 2002-2025 rpm and debugedit contributors
> 
> Although technically correct it isn't super informative. So feel free
> to add your own (or your company) copyright statement here.

OK.


> > +If -a is given, then static libraries will be ignored.  Otherwise,
> > +they receive only with source-path rewriting and collection.  They are
> > +not stripped, since they have no persistent build-ids to accommodate
> > +eventual reunification.

> Is this the right default? I would have expected -a to enable
> processing of archives, not disable it.

I thought about this, but thought default-on is better.  The
static-archive debuginfo currently passing through find-debugedit is
broken (in the sense that the source directory names are not
rewritten).  This change fixes that, and should do so safely.
And then the rest of the rpmbuild ecosystem can start taking
advantage without any config change.


> > + # plus static libraries
> > + $process_ar && find "$RPM_BUILD_ROOT" -type f -name '*.a' -print |
> > +         file -N -f - | sed -n -e 's/^\(.*\):[         ]*current ar archive.*/\1/p'
> > +) | LC_ALL=C sort |
> >  xargs --no-run-if-empty stat -c '%h %D_%i %n' |
> >  while read nlinks inum f; do
> >    if [ $nlinks -gt 1 ]; then
> 
> How stable is the file output for archives? We have found
> bugs/regressions in the file output in the past. 

I don't know, in the worst case, .a files would be missed by the tool.

> We really should use
> something like eu-classify --elf-archive
> https://bugzilla.redhat.com/show_bug.cgi?id=1609013
> (but that is for another time if you know file works fine over some
> versions as used by distros).

OK, so not for now.  (eu-elfclassify --elf-archive does appear to work
on fedora.)


> Also by convention find-debuginfo only processes files with an
> executable bit set. Should the same hold for .a archives?

No, .a files don't have the executable bit set. :-)


> Would we need to make ar overridable with an environment variable AR,
> like we do for READELF, OBJCOPY and NM to make cross-arch processing
> possible? See commit cc57e72dcf3018ddb06f4e503c969e904b9a4d27 ("find-
> debuginfo: Allow overriding binutils tools").

Sure.


> [...]
> No error processing? The rest of do_file returns an error when
> processing fails. So this really should at least return 0. But better
> to also add error processing in do_ar_file and propagate the error
> here.

OK.


- FChE



More information about the Debugedit mailing list