]> git.ipfire.org Git - thirdparty/elfutils.git/commit
PR32218: debuginfod-client: support very long source file names
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 10 Oct 2024 20:30:19 +0000 (16:30 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Wed, 16 Oct 2024 13:49:35 +0000 (09:49 -0400)
commit6814e0edc112583428114bc20f8d78f864c57128
tree5201ec0283a1994c445157c6fc3091c588df381e
parentb68f34725229b08380a1612899b0537f8f597dad
PR32218: debuginfod-client: support very long source file names

debuginfod clients & servers may sometimes encounter very long source
file names.  Previously, the client would synthesize a path name like
   $CACHEDIR/$BUILDID/source-$PATHNAME
where $PATHNAME was a funky ##-encoded version of the entire source
path name.  See https://sourceware.org/PR32218 for a horror case.
This can get too long to store as a single component of a file system
pathname (e.g. linux/limits.h NAME_MAX), resulting on client-side
errors even after a successful download.

New code switches encoding of the $PATHNAME part to use less escaping,
and a merciless truncation to the tail part of the filename.  (We keep
the tail rather than the head, so that the extension is preserved,
which makes some consumers happier.)  To limit collision damage from
truncation, we add also insert a goofy hash (4-byte DJBX33A) of the
name into the path name.  The result is a relatively short name:

   $CACHEDIR/$BUILDID/source-$HASH-$NAMETAIL

This is a transparent change to clients, who are not to make any
assumptions about cache file naming structure.  However, one existing
test did make such assumptions, so is fixed with some globness.  A new
test is also added, using a pre-baked tarball with a very long srcfile
name.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
debuginfod/debuginfod-client.c
tests/Makefile.am
tests/debuginfod-tars/bighello-sources/bighello.c [new file with mode: 0644]
tests/debuginfod-tars/bighello-sources/bighello.h [new file with mode: 0644]
tests/debuginfod-tars/bighello-sources/moremoremoremoremoremoremoremore [new symlink]
tests/debuginfod-tars/bighello.tar [new file with mode: 0644]
tests/run-debuginfod-longsource.sh [new file with mode: 0755]
tests/run-debuginfod-section.sh