]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod: fix skipping <built-in> source file
authorOmar Sandoval <osandov@fb.com>
Tue, 23 Jul 2024 22:35:37 +0000 (15:35 -0700)
committerAaron Merey <amerey@redhat.com>
Wed, 24 Jul 2024 22:13:40 +0000 (18:13 -0400)
dwarf_extract_source_paths explicitly skips source files that equal
"<built-in>", but dwarf_filesrc may return a path like "dir/<built-in>".
Check for and skip that case, too.

In particular, the test debuginfod RPMs have paths like this.  However,
the test cases didn't catch this because they have a bug, too: they
follow symlinks, which results in double-counting every file.  Fix that,
too.

Signed-off-by: Omar Sandoval <osandov@fb.com>
debuginfod/debuginfod.cxx
tests/run-debuginfod-archive-groom.sh
tests/run-debuginfod-extraction.sh

index 305edde8102139919332edcb4ac282430e694602..92022f3d05d980eaaa7a95dc9325151b0d700894 100644 (file)
@@ -3446,7 +3446,8 @@ dwarf_extract_source_paths (Elf *elf, set<string>& debug_sourcefiles)
           if (hat == NULL)
             continue;
 
-          if (string(hat) == "<built-in>") // gcc intrinsics, don't bother record
+          if (string(hat) == "<built-in>"
+              || string_endswith(hat, "<built-in>")) // gcc intrinsics, don't bother record
             continue;
 
           string waldo;
index e2c394efd2bcd5fe5ed38bcb189aa19a1948e147..0131158ff970e7275d77b33cd15ccf4db5cf3cc1 100755 (executable)
@@ -109,7 +109,7 @@ for i in $newrpms; do
     rpm2cpio ../$i | cpio -ivd;
     cd ..;
 done
-sourcefiles=$(find -name \*\\.debug \
+sourcefiles=$(find -name \*\\.debug -type f \
               | env LD_LIBRARY_PATH=$ldpath xargs \
                 ${abs_top_builddir}/src/readelf --debug-dump=decodedline \
               | grep mtime: | wc --lines)
index da6b25cf89dc4a444a52c67561e5aa6df20de024..f49dc6f6a7f0b29e8e27513aedccdd2907db43d2 100755 (executable)
@@ -94,7 +94,7 @@ for i in $newrpms; do
     rpm2cpio ../$i | cpio -ivd;
     cd ..;
 done
-sourcefiles=$(find -name \*\\.debug \
+sourcefiles=$(find -name \*\\.debug -type f \
               | env LD_LIBRARY_PATH=$ldpath xargs \
                 ${abs_top_builddir}/src/readelf --debug-dump=decodedline \
               | grep mtime: | wc --lines)