[OB PATCH] debuginfod-client.c: Avoid sscanf on mixed-case component of string

2023-03-30 Thread Aaron Merey via Elfutils-devel
Committing as obvious. sscanf is used to get the value of x-debuginfod-size from the http headers. The format string used assumes that the header field name is entirely lower case. However mixed-case field names are possible, resulting in the value not being read. Fix this by removing "x-debugi

[PATCH OB] debuginfod-client.c: Skip empty file creation for cancelled queries

2023-03-17 Thread Aaron Merey via Elfutils-devel
Committing as obvious. Empty files in the client cache are used to indicate that contacted servers could not find a requested resource. Future queries for this resource will not be attempted until the cache_miss_s duration has passed. Currently these empty files are also created when a query is

Re: ☠ Buildbot (Sourceware): elfutils - failed test (failure) (master)

2023-02-07 Thread Aaron Merey via Elfutils-devel
On Tue, Feb 7, 2023 at 9:43 PM builder--- via Elfutils-devel wrote: > > A new failure has been detected on builder elfutils-gentoo-sparc while > building elfutils. > > Full details are available at: > https://builder.sourceware.org/buildbot/#builders/225/builds/10 > > Build state: failed test

[OB PATCH] debuginfod-client.c: Download section even if cached executable didn't contain it.

2023-02-07 Thread Aaron Merey via Elfutils-devel
Committing as obvious. Before attempting to download a section, cache_find_section tries to extract the section from existing files in the cache. If it's determined that the section must not exist, cache_find_section returns -ENOENT to indicate that the download should be skipped. This patch fixe

[COMMITTED] debuginfod-client.c: Don't treat 0 as an error code.

2022-11-07 Thread Aaron Merey via Elfutils-devel
Replace 'fd > 0' with 'fd >= 0' to avoid treating a possible file descriptor as an error code. Signed-off-by: Aaron Merey --- debuginfod/ChangeLog | 5 + debuginfod/debuginfod-client.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/debuginfod/ChangeLog b/d

Re: [COMMITTED] debuginfod_find_section: Always update rc with most recent error code

2022-11-07 Thread Aaron Merey via Elfutils-devel
Hi Mark, On Mon, Nov 7, 2022 at 9:19 AM Mark Wielaard wrote: > >if (rc == -EEXIST) > > { > > - /* The section should be found in the executable. */ > > + /* Either the debuginfo couldn't be found or the section should > > + be in the executable. */ > >fd = debugi

[COMMITTED] debuginfod_find_section: Always update rc with most recent error code

2022-11-04 Thread Aaron Merey via Elfutils-devel
debuginfod_find_section may attempt to download both the debuginfo and executable matching the given build-id. If neither of these files can be found, update rc to ensure that we always return an accurate error code in this case. Signed-off-by: Aaron Merey --- debuginfod/ChangeLog | 5

[PATCH OB] Changelog: Update entries from previous commits.

2022-11-01 Thread Aaron Merey via Elfutils-devel
Pushed as obvious. Update Changelogs with details from commits 04b1a3aa and 054b3bde9. Signed-off-by: Aaron Merey --- debuginfod/ChangeLog | 4 tests/ChangeLog | 5 + 2 files changed, 9 insertions(+) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 92a880f8..50668e6

[PATCH OB] run-debuginfod-section.sh: Avoid zstd-compressed rpms

2022-11-01 Thread Aaron Merey via Elfutils-devel
Pushed as obvious. Only test using rpms without zstd compression. Older versions of libarchive may fail to handle these. Signed-off-by: Aaron Merey --- tests/run-debuginfod-section.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-debuginfod-section.sh b/tests/ru

[PATCH OB] debuginfod-client: Fix out-of-bounds write

2022-11-01 Thread Aaron Merey via Elfutils-devel
Pushed as obvious. Return early from path_escape when '\0' is seen in order to prevent an out-of-bounds write to the dest buffer. Signed-off-by: Aaron Merey --- debuginfod/debuginfod-client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/

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

2022-10-31 Thread Aaron Merey via Elfutils-devel
Hi Mark, Thanks again for the detailed review. I fixed the issues you pointed out. On Sat, Oct 29, 2022 at 8:29 PM Mark Wielaard wrote: > > @@ -1008,6 +1206,9 @@ debuginfod_query_server (debuginfod_client *c, > >            snprintf(data[i].url, PATH_MAX, "%s/%s/%s/%s", server_url, > >        

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

2022-10-27 Thread Aaron Merey via Elfutils-devel
v3 addresses Frank and Mark's v2 feedback. v2 available here: https://sourceware.org/pipermail/elfutils-devel/2022q4/005476.html --- ChangeLog | 4 + NEWS| 2 + debuginfod/ChangeLog| 21 ++ debuginfod/Makefile.am | 2 +-

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

2022-10-26 Thread Aaron Merey via Elfutils-devel
Hi Mark, On Wed, Oct 26, 2022 at 11:06 AM Mark Wielaard wrote: > On Mon, 2022-10-24 at 14:38 -0400, Frank Ch. Eigler via Elfutils-devel > wrote: > > - not sure I understand why the code worries about dots in or not in > > section names. Why not just pass them verbatim throughout the code > >

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

2022-10-26 Thread Aaron Merey via Elfutils-devel
Hi Frank, On Mon, Oct 24, 2022 at 2:38 PM Frank Ch. Eigler wrote: > - use of write(2) to put files onto disk is not quite right; write(2) can > be partial, so you need a loop (or a macro wrapping a loop) Fixed. > - not sure I understand why the code worries about dots in or not in > section

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

2022-10-21 Thread Aaron Merey via Elfutils-devel
I'm resending this patch with a small modification. I added a new field "progressfn_cancel" to debuginfod_client that indicates whether the most recent query was cancelled due to progressfn returning 1. If a server doesn't support section queries and the client begins downloading a debuginfo or e

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

2022-10-20 Thread Aaron Merey via Elfutils-devel
v1 can be found here: https://sourceware.org/pipermail/elfutils-devel/2022q3/005402.html v2 simplifies debuginfod_find_section by automatically checking both debuginfo and executables to extract the target section from. Previously this function included a parameter for specifying whether the secti

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

2022-09-28 Thread Aaron Merey via Elfutils-devel
Hi Frank, On Wed, Sep 28, 2022 at 10:28 AM Frank Ch. Eigler wrote: > On Tue, Sep 27, 2022 at 10:10:52PM -0400, Aaron Merey via Elfutils-devel > wrote: > > > [...] In order to distinguish between debuginfo and executable > > files with the same build-id, this fun

[OB PATCH] debuginfod-client: Ensure only negative error codes returned.

2022-09-28 Thread Aaron Merey via Elfutils-devel
Committing as obvious: Switch a couple error codes from positive to negative so they aren't interpreted as file descriptors by the caller. Signed-off-by: Aaron Merey --- debuginfod/ChangeLog | 5 + debuginfod/debuginfod-client.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deleti

[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

[PATCH] debuginfod: Use auto-sized connection pool when -C is not given with arg

2022-09-02 Thread Aaron Merey via Elfutils-devel
Since commit 4b42d9ad, libmicrohttpd's epoll event loop is used when available in which case we must disable its setting for spawning a thread per request. This contradicts the debuginfod doc's description of '-C', which indicates that if this command line option is not given then the thread pool

Worker threads and MHD_USE_EPOLL

2022-08-29 Thread Aaron Merey via Elfutils-devel
The debuginfod man page states that if the server is run without the --connection-pool option, a new thread will be cloned for every request. However this is not always the case. Since commit e646e363e debuginfod attempts to configure the libmicrohttpd daemon to use epoll for the daemon's internal

Re: [PATCH] Introduce public dwfl_get_debuginfod_client API

2022-07-13 Thread Aaron Merey via Elfutils-devel
On Wed, Jul 13, 2022 at 3:36 PM Milian Wolff wrote: > I got spammed by a flood of mails from buildbot, but from what I can tell the > issues are all unrelated to my patch? Or did I break something? See e.g.: > > [1]: https://builder.sourceware.org/buildbot/#/builders/39/builds/41 These issues are

Re: [PATCH] Introduce public dwfl_get_debuginfod_client API

2022-07-13 Thread Aaron Merey via Elfutils-devel
Hi Milian, There weren't any concerns with the patch so I've gone ahead and merged it as commit a4b1839c3c46. Thanks, Aaron

Re: [PATCH] Introduce public dwfl_get_debuginfod_client API

2022-07-07 Thread Aaron Merey via Elfutils-devel
Thanks. Let's wait for a maintainer to give it the ok before merging. Aaron

Re: [PATCH] Introduce public dwfl_get_debuginfod_client API

2022-07-07 Thread Aaron Merey via Elfutils-devel
On Thu, Jul 7, 2022 at 12:59 PM Milian Wolff wrote: > > On Donnerstag, 7. Juli 2022 18:40:05 CEST Aaron Merey wrote: >> > > Some line breaks may have accidentally snuck into the patch. I had to > > manually remove the line break right after "dwfl_error.c" for git to > > apply the patch without err

Re: [PATCH] Introduce public dwfl_get_debuginfod_client API

2022-07-07 Thread Aaron Merey via Elfutils-devel
Hi Milian, On Thu, Jul 7, 2022 at 10:47 AM Milian Wolff wrote: > > Dwfl can use debuginfod internally, which was so far totally opaque > to the outside. While the functionality is great for users of the > dwfl API, the long wait times induced by downloading of data over > debuginfod lead to compl

[PATCH] debuginfod: ensure X-DEBUGINFOD-SIZE contains file size

2022-04-25 Thread Aaron Merey via Elfutils-devel
Hi Frank, On Fri, Apr 22, 2022 at 7:27 PM Frank Ch. Eigler wrote: > > - add_mhd_response_header (r, "X-DEBUGINFOD-SIZE", > > - to_string(fs.st_size).c_str()); > > > + rc = fstat (fd, &fs); > > + if (rc == 0) > > +add_mhd_res

Re: [PATCH] debuginfod: Use the debuginfod-size response header

2022-04-25 Thread Aaron Merey via Elfutils-devel
On Sun, Apr 24, 2022 at 11:05 AM Mark Wielaard wrote: > Looks good. Pleas commit. Thanks, pushed as: commit 55fee962676fbff60c6b0469305bcb077910d64f Author: Aaron Merey Date: Tue Jan 11 22:07:55 2022 -0500 debuginfod: Use the debuginfod-size response header In some cases the content

Re: [PATCH] debuginfod: Use the debuginfod-size response header

2022-04-22 Thread Aaron Merey via Elfutils-devel
I've updated the patch below with the changes Mark recommended. A couple X-DEBUGINFOD-SIZE tests were added in another patch I recently posted [1] that also fixes a bug when computing this header's value for an archived file. Aaron [1] https://sourceware.org/pipermail/elfutils-devel/2022q2/0049

Re: [PATCH 2/2] debuginfod: ensure X-DEBUGINFOD-SIZE contains file size

2022-04-22 Thread Aaron Merey via Elfutils-devel
Please ignore the "2/2" in the subject line, this patch is not part of a series. Aaron

[PATCH 2/2] debuginfod: ensure X-DEBUGINFOD-SIZE contains file size

2022-04-22 Thread Aaron Merey via Elfutils-devel
For archived files X-DEBUGINFOD-SIZE currently contains the size of the archive instead of the size of the uncompressed file. Fix this. Also add testcases to verify X-DEBUGINFOD-SIZE contains uncompressed file sizes. Signed-off-by: Aaron Merey --- debuginfod/debuginfod.cxx| 11

Re: [PATCH] [PATCH] debuginfod: Use the debuginfod-size response header

2022-04-21 Thread Aaron Merey via Elfutils-devel
On Thu, Mar 31, 2022 at 1:44 PM Mark Wielaard wrote: > Just a question about this part: > > > + /* If Content-Length is -1, try to get the size from > > + X-Debuginfod-Size */ > > + if (dl_size == -1 && c->winning_headers != NULL) > > +{ > > +

Re: [PATCH] PR29022: 000-permissions files cause problems for backups

2022-04-13 Thread Aaron Merey via Elfutils-devel
Hi Mark, Thanks for the review. I fixed the issues you pointed out (good catch re. setting rc before closing fd) and pushed as commit 8b568fdea8 with Tested-by: Milian Wolff added. Milian, thanks again for taking a look at this. Aaron

Re: [PATCH] PR29022: 000-permissions files cause problems for backups

2022-04-08 Thread Aaron Merey via Elfutils-devel
I've revised this patch so that the negative-hit file's mtime is used to calculate time since last download attempt instead of the cache_miss_s file. I've also added a check for old 000-permission files so that they are unlinked immediately if found. Aaron --- PR29022: 000-permissions files cause

Re: caching failed lookups of debuginfo?

2022-04-08 Thread Aaron Merey via Elfutils-devel
Thanks for spotting this Milian. On Fri, Apr 8, 2022 at 6:40 PM Mark Wielaard wrote: > I think we as developers keep clearing the cache to test stuff. But > that means we recreate the cache_miss file every time, so that gets a > new mtime. And if you are just testing for 10 minutes everything lo

Re: caching failed lookups of debuginfo?

2022-04-08 Thread Aaron Merey via Elfutils-devel
Hi Milian, On Fri, Apr 8, 2022 at 5:08 PM Milian Wolff wrote: > I can reproduce it now suddenly with debuginfod-find too: > > ``` > $ > debuginfod-find debuginfo 85766e9d8458b16e9c7ce6e07c712c02b8471dbc > debuginfod_find_debuginfo 85766e9d8458b16e9c7ce6e07c712c02b8471dbc > server urls "https://de

[PATCH] PR29022: 000-permissions files cause problems for backups

2022-04-05 Thread Aaron Merey via Elfutils-devel
000-permission files currently used for negative caching can cause permission problems for some backup software and disk usage checkers. Fix this by using empty files to for negative caching instead. https://sourceware.org/bugzilla/show_bug.cgi?id=29022 Signed-off-by: Aaron Merey --- debuginfo

[PATCH] [PATCH] debuginfod: Use the debuginfod-size response header

2022-01-11 Thread Aaron Merey via Elfutils-devel
In some cases the content-length header may not be available in order to pass to a progressfn. If content-length isn't available then attempt to get the size of the download from the debuginfod-size header instead. It should be mentioned that if a compressed file (ex. gzip) is being transferred,