Warning, /eic-spack/spack_repo/eic/packages/elfutils/elfutils-debuginfod-relative-source.patch is written in an unsupported language. File is not indexed.
0001 diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
0002 index f7d1256..7da53ae 100644
0003 --- a/debuginfod/debuginfod-client.c
0004 +++ b/debuginfod/debuginfod-client.c
0005 @@ -1891,7 +1891,11 @@ debuginfod_query_server_by_buildid (debuginfod_client *c,
0006 {
0007 if (vfd >= 0)
0008 dprintf (vfd, "checking filename\n");
0009 - if (filename[0] != '/') // must start with /
0010 + /* Spack: also accept "./"-relative filenames, as produced when
0011 + -ffile-prefix-map maps compile-time paths to a relative ./build
0012 + root rather than an absolute one. See filename_offset below for
0013 + the corresponding request-URL construction. */
0014 + if (filename[0] != '/' && !(filename[0] == '.' && filename[1] == '/')) // must start with / or ./
0015 {
0016 rc = -EINVAL;
0017 goto out;
0018 @@ -2150,7 +2154,12 @@ debuginfod_query_server_by_buildid (debuginfod_client *c,
0019 size_t escaped_strlen = 0;
0020 if (filename)
0021 {
0022 - escaped_string = curl_easy_escape(&target_handle, filename+1, 0);
0023 + /* Spack: skip past the leading "/" (absolute) or "./" (relative,
0024 + our addition above) before escaping, so the request URL doesn't
0025 + include a leading path separator or dot-slash. */
0026 + size_t filename_offset = (filename[0] == '/') ? 1 :
0027 + (filename[0] == '.' && filename[1] == '/') ? 2 : 1;
0028 + escaped_string = curl_easy_escape(&target_handle, filename + filename_offset, 0);
0029 if (!escaped_string)
0030 {
0031 rc = -ENOMEM;
0032 @@ -2188,7 +2197,7 @@ debuginfod_query_server_by_buildid (debuginfod_client *c,
0033 data[i].target_handle = &target_handle;
0034 data[i].client = c;
0035
0036 - if (filename) /* must start with / */
0037 + if (filename) /* must start with / or ./ */
0038 {
0039 /* PR28034 escape characters in completed url to %hh format. */
0040 snprintf(data[i].url, PATH_MAX, "%s/%s/%s/%s", server_url,