[PATCH] debuginfod: print filename for "cannot open archive" error

2022-08-17 Thread Martin Liška
Report the file that has such a problem so that one can inspect it.

Signed-off-by: Martin Liska 
---
 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



[Bug tools/29498] Is it expected that eu-strip strips .note.GNU-stack

2022-08-17 Thread mliska at suse dot cz via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29498

Martin Liska  changed:

   What|Removed |Added

   Last reconfirmed||2022-08-17
 Status|UNCONFIRMED |NEW
 CC||mliska at suse dot cz
 Ever confirmed|0   |1

--- Comment #1 from Martin Liska  ---
It's definitelly not consistent with strip (from binutils) that keeps the
section.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used

2022-08-17 Thread Martin Liška
When dwarf_extract_source_paths is called, it can call handle_buildid
when a rpm file used dwz. Ignore such internal request in
http_requests_total statistics.

Signed-off-by: Martin Liska 
---
 debuginfod/debuginfod.cxx | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 9245be53..89767d97 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1906,7 +1906,7 @@ handle_buildid (MHD_Connection* conn,
 const string& buildid /* unsafe */,
 string& artifacttype /* unsafe, cleanse on exception/return */,
 const string& suffix /* unsafe */,
-int *result_fd)
+int *result_fd, bool update_metrics = true)
 {
   // validate artifacttype
   string atype_code;
@@ -1918,7 +1918,8 @@ handle_buildid (MHD_Connection* conn,
 throw reportable_exception("invalid artifacttype");
   }
 
-  inc_metric("http_requests_total", "type", artifacttype);
+  if (update_metrics)
+inc_metric("http_requests_total", "type", artifacttype);
   
   if (atype_code == "S" && suffix == "")
  throw reportable_exception("invalid source suffix");
@@ -2080,7 +2081,8 @@ and will not query the upstream servers");
 
   if (fd >= 0)
 {
-  inc_metric ("http_responses_total","result","upstream");
+  if (update_metrics)
+   inc_metric ("http_responses_total","result","upstream");
   struct stat s;
   int rc = fstat (fd, &s);
   if (rc == 0)
@@ -2488,7 +2490,7 @@ dwarf_extract_source_paths (Elf *elf, set& 
debug_sourcefiles)
   try
 {
   string artifacttype = "debuginfo";
-  r = handle_buildid (0, buildid, artifacttype, "", &alt_fd);
+  r = handle_buildid (0, buildid, artifacttype, "", &alt_fd, 
false);
 }
   catch (const reportable_exception& e)
 {
-- 
2.37.1



Re: [PATCH] debuginfod: print filename for "cannot open archive" error

2022-08-17 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

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

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



[PATCH v2] debuginfod: print filename for "cannot open archive" error

2022-08-17 Thread Martin Liška
Report the file that has such a problem so that one can inspect it.

Signed-off-by: Martin Liska 
---
 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



Re: [PATCH] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used

2022-08-17 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> When dwarf_extract_source_paths is called, it can call handle_buildid
> when a rpm file used dwz. Ignore such internal request in
> http_requests_total statistics.

Noble goal:

> @@ -1906,7 +1906,7 @@ handle_buildid (MHD_Connection* conn,
>  const string& buildid /* unsafe */,
>  string& artifacttype /* unsafe, cleanse on exception/return 
> */,
>  const string& suffix /* unsafe */,
> -int *result_fd)
> +int *result_fd, bool update_metrics = true)

 but no need for an extra parameter.  When conn==0, we have
an internal request, so can use that as a flag.


- FChE



[PATCH v2] debuginfod: fix http_requests_total{type="debuginfo"} when dwz is used

2022-08-17 Thread Martin Liška
When dwarf_extract_source_paths is called, it can call handle_buildid
when a rpm file used dwz. Ignore such internal request in
http_requests_total statistics.

Signed-off-by: Martin Liska 
---
 debuginfod/debuginfod.cxx | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 9245be53..2bfc8af5 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -1918,7 +1918,8 @@ handle_buildid (MHD_Connection* conn,
 throw reportable_exception("invalid artifacttype");
   }
 
-  inc_metric("http_requests_total", "type", artifacttype);
+  if (conn != 0)
+inc_metric("http_requests_total", "type", artifacttype);
   
   if (atype_code == "S" && suffix == "")
  throw reportable_exception("invalid source suffix");
@@ -2080,7 +2081,8 @@ and will not query the upstream servers");
 
   if (fd >= 0)
 {
-  inc_metric ("http_responses_total","result","upstream");
+  if (conn != 0)
+   inc_metric ("http_responses_total","result","upstream");
   struct stat s;
   int rc = fstat (fd, &s);
   if (rc == 0)
-- 
2.37.1



☝ Buildbot (GNU Toolchain): elfutils - worker not available (master)

2022-08-17 Thread builder--- via Elfutils-devel
A retry build has been detected on builder elfutils-opensusetw-x86_64 while 
building elfutils.

Full details are available at:
https://builder.sourceware.org/buildbot/#builders/88/builds/30

Build state: worker not available
Revision: (unknown)
Worker: bb2-1
Build Reason: (unknown)
Blamelist: Martin Liska 

Steps:

- 0: worker_preparation ( exception )
Logs:
- err.text: 
https://builder.sourceware.org/buildbot/#builders/88/builds/30/steps/0/logs/err_text
- err.html: 
https://builder.sourceware.org/buildbot/#builders/88/builds/30/steps/0/logs/err_html



[PATCH] Add new debuginfod.sysconfig value DEBUGINFOD_EXTRA_ARGS

2022-08-17 Thread Martin Liška
Split DEBUGINFOD_PATHS and put non-path arguments to the newly created
variable called DEBUGINFOD_EXTRA_ARGS.

Signed-off-by: Martin Liska 
---
 config/debuginfod.service   | 2 +-
 config/debuginfod.sysconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/config/debuginfod.service b/config/debuginfod.service
index b64d8cb9..4c7785a9 100644
--- a/config/debuginfod.service
+++ b/config/debuginfod.service
@@ -8,7 +8,7 @@ EnvironmentFile=/etc/sysconfig/debuginfod
 User=debuginfod
 Group=debuginfod
 #CacheDirectory=debuginfod
-ExecStart=/usr/bin/debuginfod -d /var/cache/debuginfod/debuginfod.sqlite -p 
$DEBUGINFOD_PORT $DEBUGINFOD_VERBOSE $DEBUGINFOD_PRAGMAS $DEBUGINFOD_PATHS
+ExecStart=/usr/bin/debuginfod -d /var/cache/debuginfod/debuginfod.sqlite -p 
$DEBUGINFOD_PORT $DEBUGINFOD_VERBOSE $DEBUGINFOD_PRAGMAS $DEBUGINFOD_PATHS 
$DEBUGINFOD_EXTRA_ARGS
 # Stopping can take a long time if scanning of large archives is in progress
 TimeoutStopSec=60
 PrivateTmp=yes
diff --git a/config/debuginfod.sysconfig b/config/debuginfod.sysconfig
index 890a1a25..ae49a5af 100644
--- a/config/debuginfod.sysconfig
+++ b/config/debuginfod.sysconfig
@@ -1,9 +1,10 @@
 #
 DEBUGINFOD_PORT="8002"
+DEBUGINFOD_EXTRA_ARGS="-t43200 -F -R"
 #DEBUGINFOD_VERBOSE="-v"
 
 # some common places to find trustworthy ELF/DWARF files and RPMs
-DEBUGINFOD_PATHS="-t43200 -F -R /usr/lib/debug /usr/bin /usr/libexec /usr/sbin 
/usr/lib /usr/lib64 /var/cache/yum /var/cache/dnf /var/lib/pulp"
+DEBUGINFOD_PATHS="/usr/lib/debug /usr/bin /usr/libexec /usr/sbin /usr/lib 
/usr/lib64 /var/cache/yum /var/cache/dnf /var/lib/pulp"
 
 # prefer reliability/durability over performance
 #DEBUGINFOD_PRAGMAS="-D 'pragma synchronous=full;'"
-- 
2.37.1