On Tue, Feb 17, 2026 at 8:47 AM Michael Trapp <[email protected]> wrote:
>
> The current archive_exception doesn't report the filename of a broken archive,
> but this information is needed to identify the affected archive.
>
> Fix this by adding a new archive_exception to get the following log message:
>
> libarchive error: _FILENAME_ cannot extract file: Truncated tar archive ...
>
> Signed-off-by: Michael Trapp <[email protected]>
Thanks Michael, I've merged this patch.
Aaron
> ---
> debuginfod/debuginfod.cxx | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
> index 9796d312..049570ae 100644
> --- a/debuginfod/debuginfod.cxx
> +++ b/debuginfod/debuginfod.cxx
> @@ -844,6 +844,11 @@ struct archive_exception: public reportable_exception
> reportable_exception(string("libarchive error: ") + msg + ": " +
> string(archive_error_string(a) ?: "?")) {
> inc_metric("error_count","libarchive",msg + ": " +
> string(archive_error_string(a) ?: "?"));
> }
> + archive_exception(struct archive* a, const string& fname, const string&
> msg):
> + reportable_exception(string("libarchive error: ") + fname + string(" ")
> + msg + ": " +
> + string(archive_error_string(a) ?: "?")) {
> + inc_metric("error_count","libarchive",msg + ": " +
> string(archive_error_string(a) ?: "?"));
> + }
> };
>
>
> @@ -3027,7 +3032,7 @@ handle_buildid_r_match (bool internal_req_p,
> {
> close (fd);
> unlink (tmppath);
> - throw archive_exception(a, "cannot extract file");
> + throw archive_exception(a, b_source0, "cannot extract file");
> }
>
> // Set the mtime so the fdcache file mtimes, even prefetched ones,
> @@ -4702,7 +4707,7 @@ archive_classify (const string& rps, string&
> archive_extension, int64_t archivei
> rc = archive_read_data_into_fd (a, fd);
> if (rc != ARCHIVE_OK) {
> close (fd);
> - throw archive_exception(a, "cannot extract file");
> + throw archive_exception(a, rps, "cannot extract file");
> }
>
> // finally ... time to run elf_classify on this bad boy and update
> the database
> --
> 2.50.1 (Apple Git-155)
>