Hi - > > > But since the user won't see the URL generated they might not notice > > > what is really going on. They will just see that something wasn't > > > found, won't they? > > > > Yes, so the only benefit would be the generation of a different error > > message for impossible buildids. > > But if there are multiple server URLs it might not be clear which/where > the error came from.
(My comment was about detecting even number of chars in the hex code.) > Since all this is done through a very simple web > api I think it is useful for the user to get informed about what the > actual request URL was that failed. [...] > If we go with the client connection context idea for the API we could > add an extra function that would tell you the last URL tried maybe? Yeah, maybe. They are tried in parallel. We could also hook up to libcurl's own progress-notification callbacks. > > > Do you know how other libraries that use libcurl deal with this? > > > > I looked over some other libcurl users in fedora. Some don't worry > > about the issue at all, relying on implicit initialization, which is > > only safe if single-threaded. Others (libvirtd) do an explicitly > > invoked initialization function, which is also only safe if invoked > > from a single-threaded context. > > > > I think actually our way here, running the init function from the > > shared library constructor, is about the best possible. As long as > > the ld.so process is done as normal, it should be fine. Programs that > > use the elfutils trick of manual dlopen'ing libdebuginfod.so should do > > so only if they are single-threaded. > > But they cannot really control that... Since they might not know (and > really shouldn't care) that libdw lazily tries to dlopen > libdebuginfod.so which then pulls in libcurl and calls that global init > function... > > Could we do try to do the dlopen and global curl initialization from > libdw _init, or a ctor, to make sure it is done as early as possible? Doing a redundant initialization later is not a problem; there is a counter in there. The problematic case would be - a multithreaded application - loading debuginfod.so multiply concurrently somehow - and calling the solib ctor concurrently somehow - and all of this concurrently enough to defeat libcurl's init-counter IMHO, not worth worrying about. Someday libcurl will do the right thing (tm) and plop this initialization into their solib ctor. > > > I was more thinking zero == infinity (no timeout). > > > > An unset environment variable should do that. > > Are you sure? If DEBUGINFOD_TIMEOUT isn't set, then it seems it > defaults to 5 seconds: > > /* Timeout for debuginfods, in seconds. > This env var must be set for debuginfod-client to run. */ > static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR; > static int server_timeout = 5; > [...] > > if (getenv(server_timeout_envvar)) > server_timeout = atoi (getenv(server_timeout_envvar)); OK, hm, we could make an -empty- but set environment variable mean 'infinity'. Then again, a user can also say =99999. - FChE