public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] debuginfod: print filename for "cannot open archive" error
@ 2022-08-17  7:12 Martin Liška
  2022-08-17 10:58 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2022-08-17  7:12 UTC (permalink / raw)
  To: elfutils-devel

Report the file that has such a problem so that one can inspect it.

Signed-off-by: Martin Liska <mliska@suse.cz>
---
 debuginfod/debuginfod.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 9245be53..67683354 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1714,7 +1714,7 @@ handle_buildid_r_match (bool internal_req_p,
 
   rc = archive_read_open_FILE (a, fp);
   if (rc != ARCHIVE_OK)
-    throw archive_exception(a, "cannot open archive from pipe");
+    throw archive_exception(a, "cannot open archive " + b_source0 + " from pipe");
 
   // archive traversal is in three stages, no, four stages:
   // 1) skip entries whose names do not match the requested one
@@ -2973,7 +2973,7 @@ archive_classify (const string& rps, string& archive_extension,
 
   rc = archive_read_open_FILE (a, fp);
   if (rc != ARCHIVE_OK)
-    throw archive_exception(a, "cannot open archive from pipe");
+    throw archive_exception(a, "cannot open archive " + rps + " from pipe");
 
   if (verbose > 3)
     obatched(clog) << "libarchive scanning " << rps << endl;
-- 
2.37.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debuginfod: print filename for "cannot open archive" error
  2022-08-17  7:12 [PATCH] debuginfod: print filename for "cannot open archive" error Martin Liška
@ 2022-08-17 10:58 ` Frank Ch. Eigler
  2022-08-17 11:18   ` [PATCH v2] " Martin Liška
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2022-08-17 10:58 UTC (permalink / raw)
  To: Martin Liška; +Cc: elfutils-devel

Hi -

> Report the file that has such a problem so that one can inspect it.
> Signed-off-by: Martin Liska <mliska@suse.cz>

The complication with this type of change is that the exception text
objects also make it into the prometheus metrics.  When file names and
such variables show up, they will bifurcate all the affected error
metrics into families.

Not sure what is the best solution to that.  A separate verbose log
print to explain the specifics of this error?  An extra parameter to
the exception object, which is only logged but not passed to
prometheus metric naming?  Some other way?

- FChE


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] debuginfod: print filename for "cannot open archive" error
  2022-08-17 10:58 ` Frank Ch. Eigler
@ 2022-08-17 11:18   ` Martin Liška
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2022-08-17 11:18 UTC (permalink / raw)
  To: elfutils-devel

Report the file that has such a problem so that one can inspect it.

Signed-off-by: Martin Liska <mliska@suse.cz>
---
 debuginfod/debuginfod.cxx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 9245be53..366a4a09 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1714,7 +1714,10 @@ handle_buildid_r_match (bool internal_req_p,
 
   rc = archive_read_open_FILE (a, fp);
   if (rc != ARCHIVE_OK)
-    throw archive_exception(a, "cannot open archive from pipe");
+    {
+      obatched(clog) << "cannot open archive from pipe " << b_source0 << endl;
+      throw archive_exception(a, "cannot open archive from pipe");
+    }
 
   // archive traversal is in three stages, no, four stages:
   // 1) skip entries whose names do not match the requested one
@@ -2973,7 +2976,10 @@ archive_classify (const string& rps, string& archive_extension,
 
   rc = archive_read_open_FILE (a, fp);
   if (rc != ARCHIVE_OK)
-    throw archive_exception(a, "cannot open archive from pipe");
+    {
+      obatched(clog) << "cannot open archive from pipe " << rps << endl;
+      throw archive_exception(a, "cannot open archive from pipe");
+    }
 
   if (verbose > 3)
     obatched(clog) << "libarchive scanning " << rps << endl;
-- 
2.37.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-17 11:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17  7:12 [PATCH] debuginfod: print filename for "cannot open archive" error Martin Liška
2022-08-17 10:58 ` Frank Ch. Eigler
2022-08-17 11:18   ` [PATCH v2] " Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).