[PATCH] debuginfod: DEBUGINFOD_URLS should accept scheme-free urls
Check scheme instead of effective url so that user may abbreviate DEBUGINFOD_URL. Add one test for scheme free http url. Notice that libcurl does not provide an almighty scheme free url support, /path/to/something without FILE:// can not be recognized in most circumstances, therefore for the neatness of our code structure, DEBUGINFOD_ URL of scheme "FILE" must be input as URI. Signed-off-by: Alice Zhang --- debuginfod/debuginfod-client.c | 33 - tests/run-debuginfod-find.sh | 6 ++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c index c2aa4e10..15e2db26 100644 --- a/debuginfod/debuginfod-client.c +++ b/debuginfod/debuginfod-client.c @@ -722,7 +722,6 @@ debuginfod_query_server (debuginfod_client *c, else snprintf(data[i].url, PATH_MAX, "%s%s/%s/%s", server_url, slashbuildid, build_id_bytes, type); - curl_easy_setopt(data[i].handle, CURLOPT_URL, data[i].url); curl_easy_setopt(data[i].handle, CURLOPT_WRITEFUNCTION, @@ -870,26 +869,50 @@ debuginfod_query_server (debuginfod_client *c, char *effective_url = NULL; long resp_code = 500; CURLcode ok1 = curl_easy_getinfo (target_handle, - CURLINFO_EFFECTIVE_URL, - &effective_url); +CURLINFO_EFFECTIVE_URL, +&effective_url); CURLcode ok2 = curl_easy_getinfo (target_handle, CURLINFO_RESPONSE_CODE, &resp_code); if(ok1 == CURLE_OK && ok2 == CURLE_OK && effective_url) { - if (strncmp (effective_url, "http", 4) == 0) + if (strncasecmp (effective_url, "HTTP", 4) == 0) if (resp_code == 200) { verified_handle = msg->easy_handle; break; } - if (strncmp (effective_url, "file", 4) == 0) + if (strncasecmp (effective_url, "FILE", 4) == 0) if (resp_code == 0) { verified_handle = msg->easy_handle; break; } } + /* - libcurl since 7.52.0 version start to support CURLINFO_SCHEME; + * - before 7.61.0, effective_url would give us a url with upper + * case SCHEME added in the front; + * - effective_url between 7.61 and 7.69 can be lack of scheme if the + * original url doesn't include one; + * - since version 7.69 effective_url will be provide a scheme in lower + * case.*/ + #if LIBCURL_VERSION_NUM >= 0x073d00 /* 7.61.0 */ + #if LIBCURL_VERSION_NUM <= 0x074500 /* 7.69.0 */ + char *scheme = NULL; + CURLcode ok3 = curl_easy_getinfo (target_handle, +CURLINFO_SCHEME, +&scheme); + if(ok3 == CURLE_OK && scheme) +{ + if (strncmp (scheme, "HTTP", 4) == 0) +if (resp_code == 200) + { +verified_handle = msg->easy_handle; +break; + } +} + #endif + #endif } } } diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh index f0c77c51..730bb0e1 100755 --- a/tests/run-debuginfod-find.sh +++ b/tests/run-debuginfod-find.sh @@ -413,6 +413,12 @@ testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && fal export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID +# test again with scheme free url +export DEBUGINFOD_URLS=127.0.0.1:$PORT1 +rm -rf $DEBUGINFOD_CACHE_PATH +testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && false || true +export DEBUGINFOD_URLS=127.0.0.1:$PORT2 +testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID # test parallel queries in client export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache3 -- 2.25.4
[Bug debuginfod/25509] Break a cyclic dependency by core packages
https://sourceware.org/bugzilla/show_bug.cgi?id=25509 --- Comment #19 from Mark Wielaard --- (In reply to Eli Schwartz from comment #13) > I think we'd prefer to have the ability to build libdebuginfod without the > server. I believe you get that with --enable-libdebuginfod --disable-debuginfod, but maybe I don't understand your use case correctly. I tried to explain more fully in comment #17. Maybe you can try out the patch and let me know if it helps your use case or, if not, what would make things easier for you? --- Comment #20 from Eli Schwartz --- That should be fine, I think. > At least for Arch Linux, curl is part of the base system while libmicrohttpd > is not. Actually truth be told, by now we moved libmicrohttpd to core, which solves our immediate problem there. But having --enable-libdebuginfod --disable-debuginfod would let us remove it again, which might be beneficial. So it's still IMHO a good-to-have. :) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug debuginfod/25509] Break a cyclic dependency by core packages
https://sourceware.org/bugzilla/show_bug.cgi?id=25509 --- Comment #21 from Eli Schwartz --- (In reply to Mark Wielaard from comment #17) > I admit that having the combination --enable-libdebuginfod=dummy and > --enable-libdebuginfod is somewhat redundant/non-sensical, but it helps with > (build time) testing. Other testing matrix would imho be as complicated > (you'll get extra install flags or need to setup compile time or runtime > environment variables). Yeah, I just had a thought that you could avoid doing one configure/build/test with --enable-libdebuginfod=dummy and another with --enable-libdebuginfod. If the buildsystem logic to have test-time env vars testing both feels too clumsy and you'd rather just build twice in your test matrix, then of course you are the boss. :D -- You are receiving this mail because: You are on the CC list for the bug.
[Bug debuginfod/25509] Break a cyclic dependency by core packages
https://sourceware.org/bugzilla/show_bug.cgi?id=25509 Mark Wielaard changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #22 from Mark Wielaard --- Thanks for all the comments. Pushed to master now. commit f7f0cdc59a13780938ae3f578955737a75e60ea9 Author: Mark Wielaard Date: Fri Jun 19 19:41:08 2020 +0200 debuginfod: Add --disable-libdebuginfod and --enable-libdebuginfod=dummy. Make it possible to build just the debuginfod client or to create a dummy libdebuginfod that doesn't link against libcurl. The dummy library can be used for bootstrapping. For testing purposes you can also build debuginfod against the dummy libdebuginfod but then the debuginfod server will not be able to do delegation. Signed-off-by: Mark Wielaard -- You are receiving this mail because: You are on the CC list for the bug.
[Bug tools/26043] eu-addr2line debuginfo-path option with relative path doesn't find file:line information
https://sourceware.org/bugzilla/show_bug.cgi?id=26043 --- Comment #9 from devel.origin at gmail dot com --- Other option is just to change the manpage. Those who write this kind of scripts are probably reading it. Adding a realpath/readling to a script is a one-time job for them. -- You are receiving this mail because: You are on the CC list for the bug.