1 2020-11-23 Mark Wielaard <mark@klomp.org>
3 * debuginfod-client.c (debuginfod_query_server): Initialize
4 struct handle_data errbuf to the empty string.
6 2020-11-11 Mark Wielaard <mark@klomp.org>
8 * debuginfod-client.c (debuginfod_set_verbose_fd): New function.
9 (struct debuginfod_client): Add verbose_fd.
10 (struct handle_data): Add errbuf.
11 (debuginfod_query_server): Produce verbose output when
12 debuginfod_client verbose_fd is set. Only clear old data and set
13 default_headers when any work is done. Always goto out when setting
14 rc to an error value. Use CURLOPT_ERRORBUFFER to get more error
15 output when verbose output is requested.
16 * debuginfod.h (DEBUGINFOD_VERBOSE_ENV_VAR): New.
17 (debuginfod_set_verbose_fd): Added.
18 * debuginfod-find.c (parse_opt): Set debuginfod_set_verbose_fd on -v.
19 * bdebuginfod.map (ELFUTILS_0.183): New section, add
20 debuginfod_set_verbose_fd.
22 2020-11-21 Mark Wielaard <mark@klomp.org>
24 * debuginfod.cxx (handle_root): New function.
25 (handler_cb): Handle "/" and report url1 in webapi error.
27 2020-11-11 Mark Wielaard <mark@klomp.org>
29 * debuginfod-find.c (progressfn): Use clock_gettime to print Progress
30 at most 5 times a second.
32 2020-11-19 Frank Ch. Eigler <fche@redhat.com>
34 * debuginfod.cxx (tmp_inc_metric): New class.
35 (handler_cb): Use it to track webapi operations.
37 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
39 * debuginfod-client.c (debuginfod_init_cache): Use ACCESSPERMS for
40 mkdir, DEFFILEMODE for open with O_CREAT.
42 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
44 * debuginfod.cxx: include libintl.h.
46 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
48 * Makefile.am (debuginfod_LDADD): Add argp_LDADD and fts_LIBS.
49 (debuginfod_find_LDADD): Likewise.
50 (libdebuginfod_so_LDLIBS): Add fts_LIBS.
52 2020-10-31 Frank Ch. Eigler <fche@redhat.com>
54 * debuginfod.cxx (scan_source_file, scan_archive_file): Add new scanned_bytes_total,
55 scanned_files_total metrics.
56 (archive_classify): Exit early if interrupted.
57 (scan_source_paths): Perform realpath/regex checks only on FTS_F files.
60 2020-10-30 Frank Ch. Eigler <fche@redhat.com>
63 * debuginfod.cxx (thread_main_scanner): Ensure control doesn't
64 leave infinite loop until program exit, even if SIGUSR2.
65 (scan_source_paths): Have traverser clean scanq on
66 SIGUSR2. Emit additional traversed_total metrics.
67 (groom): Emit additional groomed_total metrics.
68 (thread_main_groom): Restore previous thread_work_total
71 2020-10-29 Frank Ch. Eigler <fche@redhat.com>
74 * debuginfod.cxx (forced_*_count): Make these global.
75 (runq::clear): New function.
76 (thread_main_scanner): Check for pending SIGUSR2; interrupt.
77 (scan_source_paths): Check for pending SIGUSR2; interrupt.
78 (groom): Report prometheus stats before groom also. Check for
79 pending SIGUSR1; interrupt. Increment thread_work_total for
80 each file scanned, not the entire cycle.
82 2020-10-29 Frank Ch. Eigler <fche@redhat.com>
85 * debuginfod.cxx (handle_buildid_*_match): Throw exceptions for
86 more lower level libc errors.
87 (handle_buildid_match): Catch & report exceptions but return 0
88 for continued iteration in the caller.
90 2020-10-25 Mark Wielaard <mark@klomp.org>
92 * debuginfod-client.c (debuginfod_query_server): Translate
93 CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.
95 2020-10-20 Frank Ch. Eigler <fche@redhat.com>
97 PR26756: more prometheus metrics
98 * debuginfod.cxx (*_exception): Add counters for error occurrences.
99 (fdcache::*): Add counters for fdcache operations and status.
100 (fdcache::set_metric): New fn for overall stat counts.
101 (fdcache::limit): ... allow metric-less use from dtors.
103 2020-10-20 Frank Ch. Eigler <fche@redhat.com>
105 * debuginfod.cxx (handle_buildid*): Add a parameter for detecting
106 internally-originated lookups for dwz resolution.
108 2020-09-18 Frank Ch. Eigler <fche@redhat.com>
110 * debuginfod.cxx (scan_source_file, archive_classify): Store only
111 canonicalized file names in sdef & sref records in the database.
113 2020-09-08 Mark Wielaard <mark@klomp.org>
115 * Makefile.am (BUILD_STATIC): Include libcurl_LIBS in libdebuginfod
116 when NOT DUMMY_LIBDEBUGINFOD.
118 2020-09-16 Mark Wielaard <mark@klomp.org>
120 * debuginfod-find.c: Fix license block comment.
122 2020-09-15 Mark Wielaard <mark@klomp.org>
124 * debuginfod-find.c (main): Use dwelf_elf_begin.
126 2020-07-03 Alice Zhang <alizhang@redhat.com>
128 * debuginfod-client.c (debuginfod_query_server): Use strncasecmp
129 to compare effective_url. Try CURLINFO_SCHEME as fallback.
131 2020-06-19 Mark Wielaard <mark@klomp.org>
133 * Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and
135 (debuginfod_LDADD): Remove libcurl.
136 (libdebuginfod): When static and DUMMY_LIBDEBUGINFO remove libcurl.
137 (noinst_LIBRARIES): Guard with LIBDEBUGINFOD.
138 (AM_CPPFLAGS): Add -Wno-unused-parameter when DUMMY_LIBDEBUGINFOD.
139 (pkginclude_headers): Guard with LIBDEBUGINFOD
140 (libdebuginfod_so_LIBS): Likewise.
141 (+libdebuginfod_so_LDLIBS): Likewise.
143 (uninstall): Likewise.
144 * debuginfod-client.c: Include dummy functions when
146 * debuginfod.cxx: Remove curl.h include.
148 2020-06-16 Mark Wielaard <mark@klomp.org>
150 * debuginfod-client.c (debuginfod_query_server): Check malloc.
151 Move curl_multi_init call before handle_data malloc call.
153 2020-06-16 Mark Wielaard <mark@klomp.org>
155 * debuginfod-client.c (debuginfod_query_server): Replace sizeof
156 build_id_bytes check with strlen build_id check.
158 2020-06-16 Mark Wielaard <mark@klomp.org>
160 * debuginfod-client.c (debuginfod_query_server): Increase suffix
161 array and prepare having to escape 1 character with 2.
163 2020-06-16 Mark Wielaard <mark@klomp.org>
165 * debuginfod-client.c (debuginfod_clean_cache): Handle failing
166 fopen (interval_path).
168 2020-03-29 Mark Wielaard <mark@klomp.org>
170 * debuginfod-client.c (debuginfod_add_http_header): Check header
171 contains precisely one colon that isn't the first or last char.
173 2020-03-29 Frank Ch. Eigler <fche@redhat.com>
175 * debuginfod-client.c (struct debuginfod_client): Add a flag field
176 for progressfn printing.
177 (default_progressfn): Set it if printing \rsomething.
178 (debuginfod_end): Terminate with \n if flag set, i.e., only if the
179 default_progressfn was actually called.
181 2020-03-27 Mark Wielaard <mark@klomp.org>
183 * debuginfod.cxx (parse_opt): Check port is not zero.
185 2020-03-28 Frank Ch. Eigler <fche@redhat.com>
187 * debuginfod.cxx (handle_buildid_r_match): During archive
188 extraction / fdcache prefetching, set the mtime of each
191 2020-03-27 Frank Ch. Eigler <fche@redhat.com>
193 * debuginfod-find.c (main): Extract buildid from /binary/ if
194 given instead of hex string.
195 * Makefile.am: Add elfutils library prereqs for debuginfod-find.
197 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
199 * debuginfod.h, libdebuginfod.map: New functions for _add_url_header.
200 * debuginfod-client.c (struct debuginfod_client): Add headers fields.
201 (debuginfod_add_http_header): New client api to add outgoing headers.
202 (add_default_headers): Renamed from add_extra_headers, skip if flag.
203 (debuginfod_query_server): Pass accumulated headers to libcurl.
204 (debuginfod_end): Clean accumulated headers.
205 (debuginfod_find_*): Add default headers at this point.
206 * debuginfod.cxx (handle_buildid): Add conn pointer. Use it to relay
207 incoming UA and XFF headers to federated upstream debuginfods.
209 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
211 * debuginfod.cxx (handler_cb): Export two families of metrics for
212 prometheus traffic analysis: response times and data amounts.
214 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
216 * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
217 after all if access(3)-able, fallback to bsdtar.
219 2020-03-25 Frank Ch. Eigler <fche@redhat.com>
221 * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
222 the .deb & .ddeb extensions, instead of dpkg-deb.
224 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
226 * debuginfod-client.c (debuginfod_query_server): Don't
227 set CURLOPT_PATH_AS_IS on old curl. Mostly harmless.
229 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
231 * debuginfod-client.c (debuginfod_query_server): Set
232 CURLOPT_PATH_AS_IS, to propagate file names verbatim.
233 * debuginfod.cxx (canon_pathname): Implement RFC3986
234 style pathname canonicalization.
235 (handle_buildid): Canonicalize incoming webapi source
236 paths, accept either one.
237 (scan_source_file, archive_classify): Store both
238 original and canonicalized dwarf-source file names.
240 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
242 * debuginfod.cxx (handle_buildid): In case of federated fallback
243 queries, handle errors analogously to local ENOENT/404.
244 (handle_metrics): Return a size-of-response value.
245 (handler_cb): Add code to time entire application-side processing
246 stage + response sizes + http codes, so as to emit a complete
247 httpd-flavoured log line for each webapi request.
249 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
251 * debuginfod-client.c (debuginfod_query_server): Print the
252 default_progressfn terminating \n message only if that progressfn
255 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
257 * debuginfod-find.c (main): Correct /source full-pathness check for
258 "debuginfod-find -v source deadbeef /pathname" case.
260 2020-03-22 Frank Ch. Eigler <fche@redhat.com>
262 * debuginfod-client.c (struct debuginfod_client): Add url field.
263 (struct handle_data): Add client field as backpointer.
264 (debuginfod_write_callback): Compute & save URL.
265 (default_progressfn): Print front pieces of the URL.
266 (debuginfod_query_server): Clear URL and cleanup after progressfn.
267 * debuginfod-find.c (main): Print URL at transfer conclusion.
269 2020-03-22 Frank Ch. Eigler <fche@redhat.com>
271 * debuginfod.h, libdebuginfod.map: New functions for _get/set_user().
272 * debuginfod-client.c: Implement them.
273 * debuginfod-find.c: Include a token call just for testing them.
275 2020-03-03 Aaron Merey <amerey@redhat.com>
277 * debuginfod-client.c (debuginfod_query_server): Update
278 cache_path even when new default path already exists.
280 2020-02-27 Aaron Merey <amerey@redhat.com>
282 * debuginfod-client.c (xalloc_str): New macro. Call
283 asprintf with error checking.
284 (debuginfod_query_server): Use XDG_CACHE_HOME as a default
285 cache location if it is set. Replace snprintf with xalloc_str.
287 2020-02-26 Konrad Kleine <kkleine@redhat.com>
289 * debuginfod-client.c (debuginfod_query_server): Handle curl's
290 response code correctly when DEBUGINFOD_URLS begin with file://
292 2020-02-25 Frank Ch. Eigler <fche@redhat.com>
294 * debuginfod.cxx (parse_opt): Treat -R as if -Z.rpm .
296 2020-02-25 Frank Ch. Eigler <fche@redhat.com>
298 * debuginfod.cxx (fdcache_prefetch): New parameter.
299 (parse_opt): Parse it.
301 (fdcache::fd_size_mb): Change to double for accuracy.
302 (fdcache::probe): New function.
303 (fdcache::intern): New option to intern at end of LRU.
304 (fdcache::lookup): Clean fdcache.
305 (handle_buildid_r_match): Implement multi-stage archive
306 parsing, with optional prefetching of extracted contents
309 2020-02-19 Aaron Merey <amerey@redhat.com>
311 * debuginfod-client.c (debuginfod_clean_cache): Restrict
312 cleanup to client-pattern files.
314 2020-02-05 Frank Ch. Eigler <fche@redhat.com>
316 * debuginfod.cxx (argp options): Add -Z option.
317 (canonicalized_archive_entry_pathname): New function for
318 distro-agnostic file name matching/storage.
320 2020-01-22 Frank Ch. Eigler <fche@redhat.com>
322 * debuginfod.cxx (dwarf_extract_source_paths): Don't print
323 "skipping hat" messages at verbosity <=3, too noisy.
325 2020-01-19 Frank Ch. Eigler <fche@redhat.com>
327 * debuginfod.cxx (scanq): Rework to let groomer/fts threads
328 synchronize with an empty workqueue, and lock out workqueue
330 (thread_groom): Adopt new scanq idle APIs to lock out scanners.
331 (thread_main_fts_source_paths): Adopt new scanq idler API to
332 avoid being restarted while scanners haven't even finished yet.
333 (thread_main_*): Increment thread_work_total metric only after
334 a work cycle is completed, not when it begins.
336 2020-01-18 Frank Ch. Eigler <fche@redhat.com>
338 * debuginfod.cxx (thread_main_scanner): Handle empty source_paths[].
340 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
342 * debuginfod.cxx (libarchive_fdcache): New class/facility to own a
343 cache of temporary files that were previously extracted from an
344 archive. If only it could store just unlinked fd's instead of
346 (handle_buildid_r_match): Use it to answer dwz/altdebug and webapi
349 (main): Initialize the cache control parameters from heuristics.
350 Use a consistent tmpdir for these and tmp files elsewhere.
352 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
354 * debuginfod.cxx (conninfo): Print User-Agent and X-Forwarded-For
355 request headers, after mild safety-censorship (for easier machine
358 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
360 * debuginfod.cxx: Rework threading model.
361 (workq): New class for concurrent work-queue.
362 (semaphore): Removed class, now unused.
363 (scan_source_file_path): Rework into ...
364 (scan_source_file): New function.
365 (thread_main_scan_source_file_path): Nuke.
366 (scan_source_archive_path): Rework into ...
367 (scan_archive_file): New function.
368 (thread_main_scanner): New function for scanner threads.
369 (thread_main_fts_source_paths): New function for traversal thread.
370 (scan_source_paths): ... doing this.
371 (thread_groom): Tweak metrics for consistency.
372 (main): Start 1 traversal and N scanner threads if needed.
374 2019-01-02 Mark Wielaard <mark@klomp.org>
376 * debuginfod.cxx (default_connect_timeout): Removed.
377 (default_transfer_timeout): Removed.
378 (default_timeout): New. Default to 90 seconds.
379 (debuginfod_query_server): Parse server_timeout_envvar as one number.
380 Set as CURLOPT_LOW_SPEED_TIME, with CURL_OPT_LOW_SPEED_LIMITE as 100K.
382 2020-01-09 Frank Ch. Eigler <fche@redhat.com>
384 * debuginfod-client.c (add_extra_headers): New function,
385 based on mjw's draft.
386 (debuginfod_query_server): Call it.
388 2019-12-22 Frank Ch. Eigler <fche@redhat.com>
390 * debuginfod.cxx (*_rpm_*): Rename to *_archive_* throughout.
391 (scan_archives): New read-mostly global to identify archive
392 file extensions and corresponding extractor commands.
393 (parse_opt): Handle new -U flag.
395 2019-12-19 Frank Ch. Eigler <fche@redhat.com>
397 * debuginfod-client.c (default_progressfn): New function.
398 (debuginfod_begin): Use it if $DEBUGINFOD_PROGRESS set.
399 (server_timeout): Bump to 30 seconds.
400 (debuginfod_query_server): Call progressfn -after- rather than
401 before curl ops, to make it likely that a successful transfer
402 results in final a=b call. Tweak cleanup sequence.
403 * debuginfod.h: Document $DEBUGINFOD_PROGRESS name.
405 2019-12-09 Mark Wielaard <mark@klomp.org>
407 * debuginfod-client.c (debuginfod_query_server): Check
408 server_urls_envvar early.
410 2019-12-03 Mark Wielaard <mark@klomp.org>
412 * debuginfod-client.c (debuginfod_query_server): Use separate
413 local variables for CURLcode curl_res and CURLMcode curlm_res.
415 2019-11-26 Mark Wielaard <mark@klomp.org>
417 * Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
420 2019-11-25 Frank Ch. Eigler <fche@redhat.com>
422 * debuginfod.cxx (groom): Add a sqlite3_db_release_memory()
423 at the end of periodic grooming to try to shrink the process.
425 2019-11-24 Mark Wielaard <mark@klomp.org>
427 * debuginfod.cxx (test_webapi_sleep): Removed.
428 (handler_cb): Don't check test_webapi_sleep and sleep.
429 (main): Don't set test_webapi_sleep.
431 2019-11-24 Mark Wielaard <mark@klomp.org>
433 * debuginfod.cxx (add_metric): New function.
434 (scan_source_file_path): Record metrics for
435 found_executable_total, found_debuginfo_total and
436 found_sourcerefs_total.
437 (scan_source_rpm_path): Likewise.
439 2019-11-07 Frank Ch. Eigler <fche@redhat.com>
441 * debuginfod.cxx: Add /metrics endpoint. Add numerous
442 calls to new functions inc_metric/set_metric to populate
443 threadsafe map containing stats. Add http content-type
444 response headers throughout.
445 (thread_main_*): Simplify counter/timer flow.
446 (main): Reorder web service shutdown to leave http running
448 * debuginfod.8: Document it, add security caution.
450 2019-11-06 Frank Ch. Eigler <fche@redhat.com>
452 * debuginfod.cxx: Add new -L (symlink-following) mode.
453 * debuginfod.8: Document it.
455 2019-11-04 Frank Ch. Eigler <fche@redhat.com>
457 * debuginfo-client.c (debuginfod_set_progressfn): New function
458 for progress/interrupt callback.
459 (debuginfod_clean_cache, debuginfod_query_server): Call it.
460 * debuginfo.h: Declare it.
461 * debuginfod_set_progressfn.3, *_find_debuginfo.3: Document it.
462 * Makefile.am: Install it.
463 * libdebuginfod.map: Export it all under ELFUTILS_0.178 symversion.
465 * debuginfod-find.c: Add -v option to activate progress cb.
466 * debuginfod-find.1: Document it.
467 * debuginfod.cxx: Add $DEBUGINFOD_TEST_WEBAPI_SLEEP env var
468 to insert sleep in webapi callbacks, to help manual testing.
470 2019-10-28 Frank Ch. Eigler <fche@redhat.com>
472 * debuginfod.cxx: New file: debuginfod server.
473 * debuginfod.8: New file: man page.
474 * Makefile.am: Build it.
476 2019-10-28 Aaron Merey <amerey@redhat.com>
478 * debuginfod-client.c: New file: debuginfod client library.
479 * debuginfod.h: New file: header for same.
480 * libdebuginfod.map: New file: govern its solib exports.
481 * debuginfod-find.c: New file: command line frontend.
482 * debuginfod-find.1, debuginfod_find_source.3,
483 debuginfod_find_executable.3, debuginfod_find_debuginfo.3: