[PATCH] Retrive 64bit timestamp from curl_easy_getinfo on _TIME_BITS=64 environment

2022-09-27 Thread 河辺 岳人

On 32bit system compiled with -D_TIME_BITS=64, following tests failed:

FAIL: run-debuginfod-archive-test.sh
FAIL: run-debuginfod-archive-groom.sh
FAIL: run-debuginfod-archive-rename.sh
FAIL: run-debuginfod-federation-sqlite.sh
FAIL: run-debuginfod-federation-metrics.sh
FAIL: run-debuginfod-federation-link.sh

due to tests/debuginfod-subr.sh:archive_test failing on
"test $fileame -ot `pwd`", with LHS file having a bogus timestamp.
LHS is generated by debuginfo-find as a cache file.

I'm not sure the fix is the correct way, but
since -D_TIME_BITS=64 mandates -D_FILE_OFFSET_BITS=64 in glibc,
this does work on glibc environment.

Signed-off-by: Taketo Kabe 
---
 ChangeLog  | 5 +
 debuginfod/debuginfod-client.c | 4 
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 5421f5b8..1f449d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-27  Taketo Kabe  
+
+   * debuginfod/debuginfod-client.c: Correctly get timestamp when
+   compiling with -D_TIME_BITS=64 on 32bit environment.
+
 2022-04-28  Di Chen  

* NEWS: Add readefl -D, --use-dynamic.
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 5e5c140a..28ad04c0 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1392,7 +1392,11 @@ debuginfod_query_server (debuginfod_client *c,

   /* we've got one */
   time_t mtime;
+#if defined(_TIME_BITS) && _TIME_BITS == 64
+  CURLcode curl_res = curl_easy_getinfo(verified_handle, CURLINFO_FILETIME_T, 
(void*) &mtime);
+#else
   CURLcode curl_res = curl_easy_getinfo(verified_handle, CURLINFO_FILETIME, 
(void*) &mtime);
+#endif
   if (curl_res != CURLE_OK)
 mtime = time(NULL); /* fall back to current time */

--
2.31.1



Re: [PATCH] Retrive 64bit timestamp from curl_easy_getinfo on _TIME_BITS=64 environment

2022-09-27 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> I'm not sure the fix is the correct way, but
> since -D_TIME_BITS=64 mandates -D_FILE_OFFSET_BITS=64 in glibc,
> this does work on glibc environment.

Thanks, this looked fine in a quick test, so merged.

- FChE



☺ Buildbot (GNU Toolchain): elfutils - build successful (master)

2022-09-27 Thread builder--- via Elfutils-devel
A restored build has been detected on builder elfutils-fedora-x86_64 while 
building elfutils.

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

Build state: build successful
Revision: 0e1eda6f83694ca65612456562c99c703cf0361f
Worker: bbo1-1
Build Reason: (unknown)
Blamelist: Mark Wielaard , 河辺 岳人 

Steps:

- 0: worker_preparation ( success )

- 1: set package name ( success )

- 2: git checkout ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/2/logs/stdio

- 3: autoreconf ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/3/logs/stdio

- 4: configure ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/4/logs/stdio

- 5: get version ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/5/logs/stdio
- property changes: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/5/logs/property_changes

- 6: make ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/6/logs/stdio
- warnings (3): 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/6/logs/warnings__3_

- 7: make check ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/7/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/7/logs/test-suite_log

- 8: make distcheck ( warnings )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/8/logs/stdio
- test-suite.log: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/8/logs/test-suite_log
- warnings (6): 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/8/logs/warnings__6_

- 9: prep ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/9/logs/stdio

- 10: build bunsen.cpio.gz ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/10/logs/stdio

- 11: fetch bunsen.cpio.gz ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/11/logs/stdio

- 12: unpack bunsen.cpio.gz ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/12/logs/stdio

- 13: pass .bunsen.source.gitname ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/13/logs/stdio

- 14: pass .bunsen.source.gitdescribe ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/14/logs/stdio

- 15: pass .bunsen.source.gitbranch ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/15/logs/stdio

- 16: pass .bunsen.source.gitrepo ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/16/logs/stdio

- 17: upload to bunsen ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/17/logs/stdio

- 18: clean up ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/18/logs/stdio

- 19: make distclean ( success )
Logs:
- stdio: 
https://builder.sourceware.org/buildbot/#builders/59/builds/78/steps/19/logs/stdio



[PATCH] debuginfod: Support queries for ELF/DWARF sections.

2022-09-27 Thread Aaron Merey via Elfutils-devel
This patch adds a new function debuginfod_find_section which queries
debuginfod servers for the binary contents of the specified ELF/DWARF
section in a file matching the given build-id.

In order to distinguish between debuginfo and executable files with the
same build-id, this function includes a bool parameter use_debuginfo.
If true, attempt to retrieve the section from the debuginfo file with
the given build-id. If false, use the executable instead.

If the server can find the section in the parent file, the section's
binary contents are written to a temporary file.  This file is interned
by the server's fdcache as if it was extracted from an archive.

Modify the webapi to include "debuginfo-section" and
"executable-section" artifacttypes.  This helps prevent debuginfod
servers built without _find_section() support from responding with the
entire debuginfo/executable when a section was requested.  The section
name is included in the url like source paths are for _find_source()
queries.

One of the primary use cases for this feature is so that tools can
aquire indecies such as .gdb_index without having to download entire
files.  Although this patch does not implement it, we could generate
.gdb_index on-the-fly if the target file does not contain it.  However
for large debuginfo files generating the index can take a non-trivial
amount of time (ex. about 25 seconds for a 2.5GB debuginfo file).
---
 ChangeLog   |   4 +
 NEWS|   2 +
 debuginfod/ChangeLog|  19 ++
 debuginfod/debuginfod-client.c  |  41 +++-
 debuginfod/debuginfod-find.c|  39 +++-
 debuginfod/debuginfod.cxx   | 388 ++--
 debuginfod/debuginfod.h.in  |   9 +
 debuginfod/libdebuginfod.map|   1 +
 doc/ChangeLog   |   6 +
 doc/Makefile.am |   1 +
 doc/debuginfod_find_debuginfo.3 |  30 ++-
 doc/debuginfod_find_section.3   |   1 +
 tests/ChangeLog |   5 +
 tests/Makefile.am   |   4 +-
 tests/run-debuginfod-section.sh | 124 ++
 15 files changed, 590 insertions(+), 84 deletions(-)
 create mode 100644 doc/debuginfod_find_section.3
 create mode 100755 tests/run-debuginfod-section.sh

diff --git a/ChangeLog b/ChangeLog
index 1f449d60..a1e37f88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-09-27  Aaron Merey  
+
+   * NEWS: Add debuginfod_find_section.
+
 2022-09-27  Taketo Kabe  
 
* debuginfod/debuginfod-client.c: Correctly get timestamp when
diff --git a/NEWS b/NEWS
index 156f78df..974ce920 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ readelf: Add -D, --use-dynamic option.
 
 debuginfod: Add --disable-source-scan option.
 
+debuginfod-client: Add new function debuginfod_find_section.
+
 libdwfl: Add new function dwfl_get_debuginfod_client.
  Add new function dwfl_frame_reg.
 
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 680720ff..49bdf250 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,22 @@
+2022-09-27  Aaron Merey  
+
+   * debuginfod-client.c (debuginfod_find_section): New function.
+   (debuginfod_query_server): Add support for section queries.
+   * debuginfod-find.c (main): Add support for section queries.
+   * debuginfod.cxx (extract_section_to_fd): New function.
+   (handle_buildid_f_match): Add section parameter.  When non-empty,
+   try to create response from section contents.
+   (handle_buildid_r_match): Add section parameter.  When non-empty,
+   try to create response from section contents.
+   (handle_buildid_match): Add section parameter. Pass to
+   handle_buildid_{f,r}_match.
+   (handle_buildid): Handle section name when artifacttype is set to
+   "debuginfo-section" or "executable-section".  Query upstream servers
+   via debuginfod_find_section when necessary.
+   (debuginfod.h.in): Include stdbool.h. Add declaration for
+   debuginfod_find_section.
+   (libdebuginfod.map): Add debuginfod_find_section.
+
 2022-09-08  Frank Ch. Eigler  
 
* debuginfod-client.c (debuginfod_query_server): Clear
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 28ad04c0..9795f6b1 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -55,6 +55,9 @@ int debuginfod_find_executable (debuginfod_client *c, const 
unsigned char *b,
 int s, char **p) { return -ENOSYS; }
 int debuginfod_find_source (debuginfod_client *c, const unsigned char *b,
 int s, const char *f, char **p)  { return -ENOSYS; 
}
+int debuginfod_find_section (debuginfod_client *c, const unsigned char *b,
+int s, const char *scn, bool u,
+char **p)  { return -ENOSYS; }
 void debuginfod_set_progressfn(debuginfod_client *c,
   debuginfod_progressfn_t fn) { }
 void debuginfod_se