[OB PATCH] debuginfod-client: Ensure only negative error codes returned.
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 deletions(-) diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 680720ff..8fb65133 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,8 @@ +2022-09-28 Aaron Merey + + * debuginfod-client.c (debuginfod_query_server): Switch sign of some + error codes from positive to negative. + 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..2a14d9d9 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -1085,7 +1085,7 @@ debuginfod_query_server (debuginfod_client *c, c->winning_headers = NULL; if ( maxtime > 0 && clock_gettime(CLOCK_MONOTONIC_RAW, &start_time) == -1) { - rc = errno; + rc = -errno; goto out2; } long delta = 0; @@ -1096,7 +1096,7 @@ debuginfod_query_server (debuginfod_client *c, { if (clock_gettime(CLOCK_MONOTONIC_RAW, &cur_time) == -1) { - rc = errno; + rc = -errno; goto out2; } delta = cur_time.tv_sec - start_time.tv_sec; -- 2.37.3
Re: [PATCH] debuginfod: Support queries for ELF/DWARF sections.
Hi, Aaron - 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 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. [...] How would a client know which one to use? Does it provide power or benefit to force them to choose (or iterate?). Is there a scenario where the content could be different between the two (if both existed)? If that decisionmaking is not warranted to put upon the shoulders of the client, the server could just be asked for a section name "as if from an unstripped executable", and let it find that in the executable or debuginfo, whereever. > [...] 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). [...] Even that is not too bad, considering that the alternative would be having to download that 2.5GB file. I recall you saying that on some distros, gdb-index sections are always there anyway, so we wouldn't have to rush to implement this feature. - FChE
Re: [PATCH] debuginfod: Support queries for ELF/DWARF sections.
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 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. [...] > > How would a client know which one to use? Does it provide power or > benefit to force them to choose (or iterate?). Is there a scenario > where the content could be different between the two (if both > existed)? > > If that decisionmaking is not warranted to put upon the shoulders of > the client, the server could just be asked for a section name "as if > from an unstripped executable", and let it find that in the executable > or debuginfo, whereever. Good point, the server/client should figure this out internally. On IRC we also discussed the possible usefulness of client-side emulation of section queries in case a server isn't built with _find_section support. Will update the patch to include these details. > > [...] 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). [...] > > Even that is not too bad, considering that the alternative would be > having to download that 2.5GB file. I recall you saying that on some > distros, gdb-index sections are always there anyway, so we wouldn't > have to rush to implement this feature. I did a quick experiment checking the debuginfo for the libraries used by gdb, firefox and qemu-kvm on F36. Out of the 265 files I checked only 1 (libicudata.so.69.1 debuginfo) didn't contain a .gdb_index because it strangely does not contain any .debug_* sections at all. Aaron