1 2022-05-09 Mark Wielaard <mark@klomp.org>
3 * debuginfod-client.c (debuginfod_config_cache): Always open with
4 O_CREATE first, then use fstat, only write the cache_config_default_s
5 value if st_size == 0, otherwise read value from file.
7 2022-05-09 Mark Wielaard <mark@klomp.org>
9 * debuginfod.cxx (conninfo): Always provide servname to getnameinfo.
11 2022-05-09 Mark Wielaard <mark@klomp.org>
13 * debuginfod-client.c (debuginfod_query_server): Add
14 curl_easy_setopt_ck macro, use it for all curl_easy_setopt calls.
16 2022-05-09 Mark Wielaard <mark@klomp.org>
18 * debuginfod-client.c (debuginfod_write_callback): Check result
21 2022-05-05 Mark Wielaard <mark@klomp.org>
23 * debuginfod.cxx (main): Define use_epoll. Set to MHD_USE_EPOLL
24 based on MHD_VERSION. Don't use MHD_USE_THREAD_PER_CONNECTION
27 2022-05-05 Mark Wielaard <mark@klomp.org>
29 * debuginfod.cxx (main): Define mhd_flags. Use mhd_flags for
30 MHD_start_daemon. Try again with MHD_USE_DUAL_STACK removed if
31 that fails. Update clog to say either IPV4 or IPV4 and IPV6.
32 stop either ithe d46 or d4 daemonr.
34 2022-05-09 Noah Sanci <nsanci@redhat.com>
36 * debuginfod.cxx (main): Set nonzero defaults for fdcache.
38 2022-05-04 Frank Ch. Eigler <fche@redhat.com>
39 Mark Wielaard <mark@klomp.org>
41 * debuginfod-client.c (debuginfod_query_server): Correct fd leak
42 for cache negative-hit unlink case.
43 (debuginfod_config_cache, debuginfod_init_cache): Correct
45 * debuginfod-find.c (main): Ditto.
47 2022-04-22 Mark Wielaard <mark@klomp.org>
49 * Makefile.am (libdebuginfod): Add -lpthread.
50 (libdebuginfod_so_LDLIBS): Likewise.
51 * debuginfod-client.c (init_control): New static pthread_once_t.
52 (libcurl_init): New static function.
53 (debuginfod_begin): Use ptrace_once to call libcurl_init.
54 (libdebuginfod_ctor): Removed.
55 (libdebuginfod_dtor): Likewise.
57 2022-04-24 Mark Wielaard <mark@klomp.org>
59 * debuginfod.cxx (main): Add MHD_USE_ITC to MHD_start_daemon flags.
61 2022-04-13 Aaron Merey <amerey@redhat.com>
63 * debuginfod-client.c (debuginfod_query_server):
64 Drop st_mode check. Add st_size > 0 check.
65 Save target_mtime before calling
66 debuginfod_config_cache. unlink target_cache_path
67 on EACCESS. Create target_cache_path with DEFFILEMODE.
69 2022-04-03 Frank Ch. Eigler <fche@redhat.com>
71 * debuginfod.cxx (main): Use single dual-stack daemon setup,
72 rather than duplicate ipv4 and ipv6.
73 (conninfo, handle_buildid): Represent ipv4-mapped ipv6 addresses
74 in their native ipv4 form for logging and X-F-F: purposes.
75 * debuginfod-client.c (debuginfod_add_http_header): Tolerate
76 colons in http header values.
78 2022-04-03 Frank Ch. Eigler <fche@redhat.com>
80 * debuginfod.cxx (main): Use MHD_USE_EPOLL for libmicrohttpd, to
81 encourage more round-robin dispatch of incoming connections.
83 2021-12-09 Alexander Kanavin <alex@linutronix.de>
85 * debuginfod-client.c (cache_clean_default_interval_s): Change type to
87 (cache_miss_default_s): Likewise.
88 (cache_default_max_unused_age_s): Likewise.
90 2021-12-09 Mark Wielaard <mark@klomp.org>
92 * debuginfod.cxx (database_stats_report): Don't format clog
93 using 'right' and 'setw(20)'.
95 2021-12-08 Frank Ch. Eigler <fche@redhat.com>
97 * debuginfod.cxx (connection_pool): New global.
98 (parse_opt): Parse & check -C option to set it.
99 (error_cb): New callback for libmicrohttpd error counting.
100 (main): Activate MHD_OPTION_THREAD_POOL_SIZE if appropriate.
103 2021-12-04 Mark Wielaard <mark@klomp.org>
105 * debuginfod.cxx (main): Call debuginfod_pool_groom before exit.
107 2021-12-08 Mark Wielaard <mark@klomp.org>
109 * debuginfod.cxx (add_mhd_response_header): New function.
110 (reportable_exception::mhd_send_response): Call
111 MHD_add_response_header.
112 (add_mhd_last_modified): Likewise.
113 (handle_buildid_f_match): Likewise.
114 (handle_buildid_r_match): Likewise.
115 (handle_metrics): Likewise. And check MHD_Response was actually
117 (handle_root): Likewise.
119 2021-12-08 Frank Ch. Eigler <fche@redhat.com>
121 * debuginfod.cxx (intern): Call set_metrics() holding the fdcache mutex.
123 2021-12-04 Mark Wielaard <mark@klomp.org>
125 * debuginfod-client.c (debuginfod_query_server): Free winning_headers.
126 Reset response_data_size when clearing response_data.
128 2021-12-01 Mark Wielaard <mark@klomp.org>
130 * debuginfod-client.c (debuginfod_query_server): Free tmp_url on
131 realloc error. curl_free escaped_string on error. Fix error out
132 goto on curl_easy_init failure. Only cleanup data[i] handle and
133 response_data if it was initialized.
135 2021-12-01 Mark Wielaard <mark@klomp.org>
137 * debuginfod-client.c (timestamp): Use gmtime_r instead of gmtime.
138 (add_mhd_last_modified): Likewise.
140 2021-11-10 Érico N. Rolim <erico.erc@gmail.com>
142 * debuginfod.cxx: include "system.h" under 'extern "C"' block.
144 2021-11-05 Frank Ch. Eigler <fche@redhat.com>
147 * debuginfod.cxx (parse_opt): Add "--passive" flag. Complain
148 about inconsistent flags.
149 (main): In passive mode, suppress scan/groom/traverse threads and
150 other read-write database ops.
152 2021-11-04 Frank Ch. Eigler <fche@redhat.com>
155 * debuginfod.cxx (groom): Rework into separate decision/action
156 phases. Add new metrics to monitor progress. Limit indefinite
157 operation times to avoid starving rescan.
159 2021-10-23 Frank Ch. Eigler <fche@redhat.com>
162 * debuginfod-client.c (debuginfod_query_server): Correct
163 negative-hit cache check sequence for root user.
165 2021-10-15 Mark Wielaard <mark@klomp.org>
167 * debuginfod-client.c (debuginfod_query_server): Set
170 2021-10-06 Di Chen <dichen@redhat.com>
173 * debuginfod.cxx (inc_metrics, add_metrics): Add two-tag variants.
174 (handler_cb): Call it with artifacttype for http_responses_* metrics.
175 (handle_buildid): Sanitize artifacttype if necessary.
176 (dwarf_extract_source_path): Pass sanitizable string param.
178 2021-09-17 Noah Sanci <nsanci@redhat.com>
180 * debuginfod-client.c (debuginfod_query_server): curl_multi_perform
181 now occurs before checking if response headers have arrived.
183 2021-09-14 Frank Ch. Eigler <fche@redhat.com>
186 * debuginfod.cxx (waitq::fronters): New field.
187 (waitq::wait_idle): Respect it.
188 (waitq::done_front): New function.
189 (thread_main_scanner): Call it to match wait_front().
191 2021-09-12 Mark Wielaard <mark@klomp.org>
193 * debuginfod.cxx (libarchive_fdcache::lookup): Add endl after
195 2021-09-13 Noah Sanci <nsanci@redhat.com>
197 * debuginfod-client.c (debuginfod_query_server): Removed constant
198 operations from a loop. curl_free memory.
200 2021-09-06 Dmitry V. Levin <ldv@altlinux.org>
202 * debuginfod-client.c (debuginfod_begin): Remove cast of calloc return
205 2021-08-28 Mark Wielaard <mjw@redhat.com>
207 * debuginfod.cxx (parse_opt): Turn the -d arg ":memory:" into
208 "file::memory:?cache=shared" for the db_path.
210 2021-08-20 Di Chen <dichen@redhat.com>
212 * debuginfod.cxx (options): Add ARGP_KEY_FORWARDED_TTL_LIMIT.
213 (forwarded_ttl_limit): New static unsigned.
214 (parse_opt): Handle ARGP_KEY_FORWARDED_TTL_LIMIT.
215 (handle_buildid): Check forwarded_ttl_limit.
216 (main): Log forwarded ttl limit.
218 2021-08-20 Saleem Abdulrasool <abdulras@google.com>
220 * debuginfod.cxx: Remove error.h include.
222 2021-08-19 Frank Ch. Eigler <fche@redhat.com>
225 * debuginfod.cxx (handler_cb): Fix after_you unique_set key
226 to the entire incoming URL.
228 2021-08-02 Noah Sanci <nsanci@redhat.com>
231 * debuginfod-client.c (struct debuginfod_client): New field
233 (struct handle_data): New field response_data, response_data_size.
234 (header_callback): Store received headers in response_data.
235 (debuginfod_query_server): Activate CURLOPT_HEADERFUNCTION.
236 Save winning response_data.
237 (debuginfod_end): free client winning headers.
238 * debuginfod.cxx (handle_buildid_f_match): remove X-DEBUGINFOD-FILE
239 path. Add X-DEBUGINFOD-FILE and X-DEBUGINFOD-SIZE headers.
240 (handle_buildid_r_match): remove X-DEBUGINFOD-FILE path. Add
241 X-DEBUGINFOD-FILE, X-DEBUGINFOD-SIZE
242 headers, and X-ARCHIVE headers.
244 2021-07-26 Noah Sanci <nsanci@redhat.com>
247 * debuginfod-client.c (globals): added default_maxsize and
249 (debuginfod_query_server): Added DEBUGINFOD_MAXSIZE and
250 DEBUGINFOD_MAXTIME envvar processing.
251 * debuginfod.cxx (handler_cb): If the requested file exceeds
252 maxsize return code 406.
253 * debuginfod.h.in: Added DEBUGINFOD_MAXSIZE_ENV_VAR and
254 DEBUGINFOD_MAXTIME_ENV_VAR.
256 2021-07-16 Noah Sanci <nsanci@redhat.com>
259 * debuginfod-client.c (debuginfod_query_server): % escape filename
260 so the completed url is processed properly.
262 2021-06-28 Noah Sanci <nsanci@redhat.com>
265 * debuginfod.cxx (options): Added --fdcache-prefetch-fds/mbs options.
266 (set_metric): Added a condition for fdcache_mintmp to ensure no
267 negative percentages or percentages larger than 100% are given.
268 (globals): Added fdcache_prefetch_mbs/fdcache_prefetch_fds.
269 (set_metrics): Differentiate between lru and prefetch metrics.
270 (intern): Added prefetch functionality for nuking preexisting copies
271 and incrementing prefetch metrics.
272 (lookup): Search prefetch cache and increment associated metrics. Upon
273 finding in the prefetch cache move the element to the lru cache.
274 (limit): Arguments updated. Update size of prefetch cache.
275 (main): Log prefetch and cache fds/mbs
277 2021-07-06 Alice Zhang <alizhang@redhat.com>
280 * debuginfod-client.c (debuginfod_query_server): Retry failed queries
281 if error code is not ENOENT.
282 * debuginfod.h.in: Introduce DEBUGINFOD_RETRY_LIMIT_ENV_VAR.
284 2021-07-01 Noah Sanci <nsanci@redhat.com>
287 * debuginfod.cxx (options): Add --regex-groom, -r option.
288 (regex_groom): New static bool defaults to false.
289 (parse_opt): Handle 'r' option by setting regex_groom to true.
290 (groom): Introduce and use reg_include and reg_exclude.
292 2021-07-09 Noah Sanci <nsanci@redhat.com>
295 * debuginfod-client.c (debuginfod_query_server): As full-length
296 urls are generated with standardized formats, ignore duplicates.
297 Created out1 and changed out2 error gotos. Updated url creation print
299 (globals): Removed url_delim_char, as it was no longer used.
301 2021-06-18 Mark Wielaard <mark@klomp.org>
303 * debuginfod-client.c (debuginfod_begin): Don't use client if
306 2021-06-03 Frank Ch. Eigler <fche@redhat.com>
309 * debuginfod.cxx (unique_set, unique_set_reserver): New classes.
310 (handler_cb): Use them to implement "after-you" queueing.
312 2021-05-14 Frank Ch. Eigler <fche@redhat.com>
315 * debuginfod-client.c (debuginfod_client): Retain only
316 long-lived multi handle from PR27701 work.
317 (debuginfo_begin,debuginfod_end): ctor/dtor for surviving field only.
318 (debuginfod_query_server): Rework to reuse multi handle only.
320 2021-04-19 Martin Liska <mliska@suse.cz>
322 * debuginfod-client.c (debuginfod_query_server): Use startswith.
323 (debuginfod_add_http_header): Likewise.
324 * debuginfod.cxx: Likewise.
326 2021-05-04 Alice Zhang <alizhang@redhat.com>
328 * debuginfod-client.c (cache_miss_default_s): New static time_t,
329 defaults to 600 (10 minutes).
330 (cache_miss_filename): New static char pointer.
331 (debuginfod_config_cache): New static function.
332 (debuginfod_clean_cache): Use debuginfod_config_cache for
333 interval_path and max_unused_path.
334 (debuginfod_query_server): Check whether target_cache_path exists
335 as negative cache file and create target_cache_path when the server
336 returns ENOENT. Check cache_miss_path fir cache miss time.
338 2021-04-26 Frank Ch. Eigler <fche@redhat.com>
341 * debuginfod-client.c (debuginfod_query_server): Chmod 0400 files
342 delivered into the cache to prevent accidental modification.
344 2021-04-26 Frank Ch. Eigler <fche@redhat.com>
347 * debuginfod-client.c (debuginfod_clean_cache): For directory
348 rmdir, check mtime first.
349 (debuginfod_query_server): Try mkdir / mkstemp up to twice,
352 2021-04-23 Frank Ch. Eigler <fche@redhat.com>
355 * debuginfod-client.c (struct debuginfod_client): Add long-lived
356 CURL easy and multi handles.
357 (debuginfo_begin,debuginfod_end): ctor/dtor for these.
358 (debuginfod_query_server): Rework to reuse easy & multi handles.
359 (*_envvar): Just use the DEBUGINFOD_*_ENV_VAR directly instead.
361 * debuginfod.cxx (dc_pool): New pile of reusable debuginfod_client
362 objects for upstream federation connections.
363 (debuginfod_pool_{begin,end,groom}): New functions.
364 (handle_buildid): Use them.
365 (handler_cb): Fix keep-alive given libmicrohttpd convention of multiple
368 2021-04-15 Frank Ch. Eigler <fche@redhat.com>
370 * debuginfod.cxx (groom): Only update database stats once.
372 2021-04-15 Frank Ch. Eigler <fche@redhat.com>
374 * debuginfod.cxx (elf_classify): Recognize symtab-only stripped files
375 like fedora's libicudata as debuginfo files.
377 2021-03-30 Frank Ch. Eigler <fche@redhat.com>
379 * debuginfod.cxx (main): Set child thread names.
381 2021-03-07 Timm Bäder <tbaeder@redhat.com>
383 * debuginfod-client.c (debuginfod_query_server): Tweak
384 double/long clamping arithmetic to avoid UB and warnings.
386 2021-02-25 Frank Ch. Eigler <fche@redhat.com>
388 * debuginfod.cxx (handler_cb): Filter webapi for bad
389 artifacttype keywords early for metric hygiene.
391 2021-02-14 Frank Ch. Eigler <fche@redhat.com>
393 * debuginfod.cxx (main -U): Use bsdtar unconditionally. Also map
394 the debian-compatible .ipk (openembedded distro family) to same.
396 2021-02-04 Frank Ch. Eigler <fche@redhat.com>
398 PR27092 low-memory handling
399 * debuginfod.cxx (fdcache_mintmp): New parameter, with cmd-line option.
400 (parse_opt): Parse it.
402 (statfs_free_enough_p): New function.
403 (libarchive_fdcache::*): Call it to trigger emergency fdcache flush.
404 (thread_main_scanner): Call it to report filesystem fullness metrics.
406 (set/add_metric): Take double rather than int64_t values.
407 (archive_exception): Propagate suberror to metric label.
408 (main): Detect pthread creation fatal errors properly.
410 2021-02-02 Frank Ch. Eigler <fche@redhat.com>
413 * debuginfod.cxx (dbq): New read-only database connection for queries
415 (signal_handler): Interrupt it.
416 (main): Open / close it.
417 (handle_buildid): Use it for webapi queries only.
418 (database_stats_report): Make more interruptible. Report sqlite3
419 operation times to the prometheus metrics.
420 (groom): Make more interruptible.
421 (thread_main_fts_source_paths, thread_main_groom): Ensure
422 state/progress metrics are fresh even in case of exceptions.
424 2020-12-20 Dmitry V. Levin <ldv@altlinux.org>
426 * .gitignore: New file.
428 2020-12-12 Dmitry V. Levin <ldv@altlinux.org>
430 * debuginfod-client.c (debuginfod_query_server): Fix spelling typos in
432 * debuginfod.cxx: Likewise.
433 (parse_opt): Fix spelling typos in error diagnostics.
435 2020-12-08 Dmitry V. Levin <ldv@altlinux.org>
437 * Makefile.am [LIBDEBUGINFOD]: Create libdebuginfod.so.1 first, turn
438 libdebuginfod.so into symlink.
440 2020-11-30 Dmitry V. Levin <ldv@altlinux.org>
442 * Makefile.am (libdebuginfod.so): Replace $@.$(VERSION) with
443 $(LIBDEBUGINFOD_SONAME).
444 (install, uninstall, MOSTLYCLEANFILES): Replace
445 libdebuginfod.so.$(VERSION) with $(LIBDEBUGINFOD_SONAME).
447 * debuginfod.h: Rename to ...
448 * debuginfod.h.in ... this.
449 (DEBUGINFOD_SONAME): New macro.
451 2020-11-30 Dmitry V. Levin <ldv@altlinux.org>
453 * Makefile.am (libdebuginfod.so$(EXEEXT)): Drop $(EXEEXT) suffix.
455 2020-11-25 Frank Ch. Eigler <fche@redhat.com>
457 * debuginfod.cxx (step_ok_done): Correct typo in prom metric label.
459 2020-11-25 Frank Ch. Eigler <fche@redhat.com>
461 * debuginfod.cxx (tmp_ms_metric): Switch from gettimeofday to
462 clock_gettime(CLOCK_MONOTONIC) for time-interval measurements.
463 (handler_cb, scan_source_paths, groom): Ditto.
465 2020-11-23 Frank Ch. Eigler <fche@redhat.com>
467 * debuginfod.cxx (tmp_ms_metric): New class for RAII timing metrics.
468 (sqlite_ps::reset, step*): Call it to track sqlite3 performance.
469 (sqlite_exception ctor): Increment sqlite3 error_count.
471 2020-11-23 Mark Wielaard <mark@klomp.org>
473 * debuginfod-client.c (debuginfod_query_server): Initialize
474 struct handle_data errbuf to the empty string.
476 2020-11-11 Mark Wielaard <mark@klomp.org>
478 * debuginfod-client.c (debuginfod_set_verbose_fd): New function.
479 (struct debuginfod_client): Add verbose_fd.
480 (struct handle_data): Add errbuf.
481 (debuginfod_query_server): Produce verbose output when
482 debuginfod_client verbose_fd is set. Only clear old data and set
483 default_headers when any work is done. Always goto out when setting
484 rc to an error value. Use CURLOPT_ERRORBUFFER to get more error
485 output when verbose output is requested.
486 * debuginfod.h (DEBUGINFOD_VERBOSE_ENV_VAR): New.
487 (debuginfod_set_verbose_fd): Added.
488 * debuginfod-find.c (parse_opt): Set debuginfod_set_verbose_fd on -v.
489 * bdebuginfod.map (ELFUTILS_0.183): New section, add
490 debuginfod_set_verbose_fd.
492 2020-11-21 Mark Wielaard <mark@klomp.org>
494 * debuginfod.cxx (handle_root): New function.
495 (handler_cb): Handle "/" and report url1 in webapi error.
497 2020-11-11 Mark Wielaard <mark@klomp.org>
499 * debuginfod-find.c (progressfn): Use clock_gettime to print Progress
500 at most 5 times a second.
502 2020-11-19 Frank Ch. Eigler <fche@redhat.com>
504 * debuginfod.cxx (tmp_inc_metric): New class.
505 (handler_cb): Use it to track webapi operations.
507 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
509 * debuginfod-client.c (debuginfod_init_cache): Use ACCESSPERMS for
510 mkdir, DEFFILEMODE for open with O_CREAT.
512 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
514 * debuginfod.cxx: include libintl.h.
516 2020-11-01 Érico N. Rolim <erico.erc@gmail.com>
518 * Makefile.am (debuginfod_LDADD): Add argp_LDADD and fts_LIBS.
519 (debuginfod_find_LDADD): Likewise.
520 (libdebuginfod_so_LDLIBS): Add fts_LIBS.
522 2020-10-31 Frank Ch. Eigler <fche@redhat.com>
524 * debuginfod.cxx (scan_source_file, scan_archive_file): Add new scanned_bytes_total,
525 scanned_files_total metrics.
526 (archive_classify): Exit early if interrupted.
527 (scan_source_paths): Perform realpath/regex checks only on FTS_F files.
530 2020-10-30 Frank Ch. Eigler <fche@redhat.com>
533 * debuginfod.cxx (thread_main_scanner): Ensure control doesn't
534 leave infinite loop until program exit, even if SIGUSR2.
535 (scan_source_paths): Have traverser clean scanq on
536 SIGUSR2. Emit additional traversed_total metrics.
537 (groom): Emit additional groomed_total metrics.
538 (thread_main_groom): Restore previous thread_work_total
541 2020-10-29 Frank Ch. Eigler <fche@redhat.com>
544 * debuginfod.cxx (forced_*_count): Make these global.
545 (runq::clear): New function.
546 (thread_main_scanner): Check for pending SIGUSR2; interrupt.
547 (scan_source_paths): Check for pending SIGUSR2; interrupt.
548 (groom): Report prometheus stats before groom also. Check for
549 pending SIGUSR1; interrupt. Increment thread_work_total for
550 each file scanned, not the entire cycle.
552 2020-10-29 Frank Ch. Eigler <fche@redhat.com>
555 * debuginfod.cxx (handle_buildid_*_match): Throw exceptions for
556 more lower level libc errors.
557 (handle_buildid_match): Catch & report exceptions but return 0
558 for continued iteration in the caller.
560 2020-10-25 Mark Wielaard <mark@klomp.org>
562 * debuginfod-client.c (debuginfod_query_server): Translate
563 CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.
565 2020-10-20 Frank Ch. Eigler <fche@redhat.com>
567 PR26756: more prometheus metrics
568 * debuginfod.cxx (*_exception): Add counters for error occurrences.
569 (fdcache::*): Add counters for fdcache operations and status.
570 (fdcache::set_metric): New fn for overall stat counts.
571 (fdcache::limit): ... allow metric-less use from dtors.
573 2020-10-20 Frank Ch. Eigler <fche@redhat.com>
575 * debuginfod.cxx (handle_buildid*): Add a parameter for detecting
576 internally-originated lookups for dwz resolution.
578 2020-09-18 Frank Ch. Eigler <fche@redhat.com>
580 * debuginfod.cxx (scan_source_file, archive_classify): Store only
581 canonicalized file names in sdef & sref records in the database.
583 2020-09-08 Mark Wielaard <mark@klomp.org>
585 * Makefile.am (BUILD_STATIC): Include libcurl_LIBS in libdebuginfod
586 when NOT DUMMY_LIBDEBUGINFOD.
588 2020-09-16 Mark Wielaard <mark@klomp.org>
590 * debuginfod-find.c: Fix license block comment.
592 2020-09-15 Mark Wielaard <mark@klomp.org>
594 * debuginfod-find.c (main): Use dwelf_elf_begin.
596 2020-07-03 Alice Zhang <alizhang@redhat.com>
598 * debuginfod-client.c (debuginfod_query_server): Use strncasecmp
599 to compare effective_url. Try CURLINFO_SCHEME as fallback.
601 2020-06-19 Mark Wielaard <mark@klomp.org>
603 * Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and
605 (debuginfod_LDADD): Remove libcurl.
606 (libdebuginfod): When static and DUMMY_LIBDEBUGINFO remove libcurl.
607 (noinst_LIBRARIES): Guard with LIBDEBUGINFOD.
608 (AM_CPPFLAGS): Add -Wno-unused-parameter when DUMMY_LIBDEBUGINFOD.
609 (pkginclude_headers): Guard with LIBDEBUGINFOD
610 (libdebuginfod_so_LIBS): Likewise.
611 (+libdebuginfod_so_LDLIBS): Likewise.
613 (uninstall): Likewise.
614 * debuginfod-client.c: Include dummy functions when
616 * debuginfod.cxx: Remove curl.h include.
618 2020-06-16 Mark Wielaard <mark@klomp.org>
620 * debuginfod-client.c (debuginfod_query_server): Check malloc.
621 Move curl_multi_init call before handle_data malloc call.
623 2020-06-16 Mark Wielaard <mark@klomp.org>
625 * debuginfod-client.c (debuginfod_query_server): Replace sizeof
626 build_id_bytes check with strlen build_id check.
628 2020-06-16 Mark Wielaard <mark@klomp.org>
630 * debuginfod-client.c (debuginfod_query_server): Increase suffix
631 array and prepare having to escape 1 character with 2.
633 2020-06-16 Mark Wielaard <mark@klomp.org>
635 * debuginfod-client.c (debuginfod_clean_cache): Handle failing
636 fopen (interval_path).
638 2020-03-29 Mark Wielaard <mark@klomp.org>
640 * debuginfod-client.c (debuginfod_add_http_header): Check header
641 contains precisely one colon that isn't the first or last char.
643 2020-03-29 Frank Ch. Eigler <fche@redhat.com>
645 * debuginfod-client.c (struct debuginfod_client): Add a flag field
646 for progressfn printing.
647 (default_progressfn): Set it if printing \rsomething.
648 (debuginfod_end): Terminate with \n if flag set, i.e., only if the
649 default_progressfn was actually called.
651 2020-03-27 Mark Wielaard <mark@klomp.org>
653 * debuginfod.cxx (parse_opt): Check port is not zero.
655 2020-03-28 Frank Ch. Eigler <fche@redhat.com>
657 * debuginfod.cxx (handle_buildid_r_match): During archive
658 extraction / fdcache prefetching, set the mtime of each
661 2020-03-27 Frank Ch. Eigler <fche@redhat.com>
663 * debuginfod-find.c (main): Extract buildid from /binary/ if
664 given instead of hex string.
665 * Makefile.am: Add elfutils library prereqs for debuginfod-find.
667 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
669 * debuginfod.h, libdebuginfod.map: New functions for _add_url_header.
670 * debuginfod-client.c (struct debuginfod_client): Add headers fields.
671 (debuginfod_add_http_header): New client api to add outgoing headers.
672 (add_default_headers): Renamed from add_extra_headers, skip if flag.
673 (debuginfod_query_server): Pass accumulated headers to libcurl.
674 (debuginfod_end): Clean accumulated headers.
675 (debuginfod_find_*): Add default headers at this point.
676 * debuginfod.cxx (handle_buildid): Add conn pointer. Use it to relay
677 incoming UA and XFF headers to federated upstream debuginfods.
679 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
681 * debuginfod.cxx (handler_cb): Export two families of metrics for
682 prometheus traffic analysis: response times and data amounts.
684 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
686 * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
687 after all if access(3)-able, fallback to bsdtar.
689 2020-03-25 Frank Ch. Eigler <fche@redhat.com>
691 * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
692 the .deb & .ddeb extensions, instead of dpkg-deb.
694 2020-03-26 Frank Ch. Eigler <fche@redhat.com>
696 * debuginfod-client.c (debuginfod_query_server): Don't
697 set CURLOPT_PATH_AS_IS on old curl. Mostly harmless.
699 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
701 * debuginfod-client.c (debuginfod_query_server): Set
702 CURLOPT_PATH_AS_IS, to propagate file names verbatim.
703 * debuginfod.cxx (canon_pathname): Implement RFC3986
704 style pathname canonicalization.
705 (handle_buildid): Canonicalize incoming webapi source
706 paths, accept either one.
707 (scan_source_file, archive_classify): Store both
708 original and canonicalized dwarf-source file names.
710 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
712 * debuginfod.cxx (handle_buildid): In case of federated fallback
713 queries, handle errors analogously to local ENOENT/404.
714 (handle_metrics): Return a size-of-response value.
715 (handler_cb): Add code to time entire application-side processing
716 stage + response sizes + http codes, so as to emit a complete
717 httpd-flavoured log line for each webapi request.
719 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
721 * debuginfod-client.c (debuginfod_query_server): Print the
722 default_progressfn terminating \n message only if that progressfn
725 2020-03-24 Frank Ch. Eigler <fche@redhat.com>
727 * debuginfod-find.c (main): Correct /source full-pathness check for
728 "debuginfod-find -v source deadbeef /pathname" case.
730 2020-03-22 Frank Ch. Eigler <fche@redhat.com>
732 * debuginfod-client.c (struct debuginfod_client): Add url field.
733 (struct handle_data): Add client field as backpointer.
734 (debuginfod_write_callback): Compute & save URL.
735 (default_progressfn): Print front pieces of the URL.
736 (debuginfod_query_server): Clear URL and cleanup after progressfn.
737 * debuginfod-find.c (main): Print URL at transfer conclusion.
739 2020-03-22 Frank Ch. Eigler <fche@redhat.com>
741 * debuginfod.h, libdebuginfod.map: New functions for _get/set_user().
742 * debuginfod-client.c: Implement them.
743 * debuginfod-find.c: Include a token call just for testing them.
745 2020-03-03 Aaron Merey <amerey@redhat.com>
747 * debuginfod-client.c (debuginfod_query_server): Update
748 cache_path even when new default path already exists.
750 2020-02-27 Aaron Merey <amerey@redhat.com>
752 * debuginfod-client.c (xalloc_str): New macro. Call
753 asprintf with error checking.
754 (debuginfod_query_server): Use XDG_CACHE_HOME as a default
755 cache location if it is set. Replace snprintf with xalloc_str.
757 2020-02-26 Konrad Kleine <kkleine@redhat.com>
759 * debuginfod-client.c (debuginfod_query_server): Handle curl's
760 response code correctly when DEBUGINFOD_URLS begin with file://
762 2020-02-25 Frank Ch. Eigler <fche@redhat.com>
764 * debuginfod.cxx (parse_opt): Treat -R as if -Z.rpm .
766 2020-02-25 Frank Ch. Eigler <fche@redhat.com>
768 * debuginfod.cxx (fdcache_prefetch): New parameter.
769 (parse_opt): Parse it.
771 (fdcache::fd_size_mb): Change to double for accuracy.
772 (fdcache::probe): New function.
773 (fdcache::intern): New option to intern at end of LRU.
774 (fdcache::lookup): Clean fdcache.
775 (handle_buildid_r_match): Implement multi-stage archive
776 parsing, with optional prefetching of extracted contents
779 2020-02-19 Aaron Merey <amerey@redhat.com>
781 * debuginfod-client.c (debuginfod_clean_cache): Restrict
782 cleanup to client-pattern files.
784 2020-02-05 Frank Ch. Eigler <fche@redhat.com>
786 * debuginfod.cxx (argp options): Add -Z option.
787 (canonicalized_archive_entry_pathname): New function for
788 distro-agnostic file name matching/storage.
790 2020-01-22 Frank Ch. Eigler <fche@redhat.com>
792 * debuginfod.cxx (dwarf_extract_source_paths): Don't print
793 "skipping hat" messages at verbosity <=3, too noisy.
795 2020-01-19 Frank Ch. Eigler <fche@redhat.com>
797 * debuginfod.cxx (scanq): Rework to let groomer/fts threads
798 synchronize with an empty workqueue, and lock out workqueue
800 (thread_groom): Adopt new scanq idle APIs to lock out scanners.
801 (thread_main_fts_source_paths): Adopt new scanq idler API to
802 avoid being restarted while scanners haven't even finished yet.
803 (thread_main_*): Increment thread_work_total metric only after
804 a work cycle is completed, not when it begins.
806 2020-01-18 Frank Ch. Eigler <fche@redhat.com>
808 * debuginfod.cxx (thread_main_scanner): Handle empty source_paths[].
810 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
812 * debuginfod.cxx (libarchive_fdcache): New class/facility to own a
813 cache of temporary files that were previously extracted from an
814 archive. If only it could store just unlinked fd's instead of
816 (handle_buildid_r_match): Use it to answer dwz/altdebug and webapi
819 (main): Initialize the cache control parameters from heuristics.
820 Use a consistent tmpdir for these and tmp files elsewhere.
822 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
824 * debuginfod.cxx (conninfo): Print User-Agent and X-Forwarded-For
825 request headers, after mild safety-censorship (for easier machine
828 2020-01-11 Frank Ch. Eigler <fche@redhat.com>
830 * debuginfod.cxx: Rework threading model.
831 (workq): New class for concurrent work-queue.
832 (semaphore): Removed class, now unused.
833 (scan_source_file_path): Rework into ...
834 (scan_source_file): New function.
835 (thread_main_scan_source_file_path): Nuke.
836 (scan_source_archive_path): Rework into ...
837 (scan_archive_file): New function.
838 (thread_main_scanner): New function for scanner threads.
839 (thread_main_fts_source_paths): New function for traversal thread.
840 (scan_source_paths): ... doing this.
841 (thread_groom): Tweak metrics for consistency.
842 (main): Start 1 traversal and N scanner threads if needed.
844 2019-01-02 Mark Wielaard <mark@klomp.org>
846 * debuginfod.cxx (default_connect_timeout): Removed.
847 (default_transfer_timeout): Removed.
848 (default_timeout): New. Default to 90 seconds.
849 (debuginfod_query_server): Parse server_timeout_envvar as one number.
850 Set as CURLOPT_LOW_SPEED_TIME, with CURL_OPT_LOW_SPEED_LIMITE as 100K.
852 2020-01-09 Frank Ch. Eigler <fche@redhat.com>
854 * debuginfod-client.c (add_extra_headers): New function,
855 based on mjw's draft.
856 (debuginfod_query_server): Call it.
858 2019-12-22 Frank Ch. Eigler <fche@redhat.com>
860 * debuginfod.cxx (*_rpm_*): Rename to *_archive_* throughout.
861 (scan_archives): New read-mostly global to identify archive
862 file extensions and corresponding extractor commands.
863 (parse_opt): Handle new -U flag.
865 2019-12-19 Frank Ch. Eigler <fche@redhat.com>
867 * debuginfod-client.c (default_progressfn): New function.
868 (debuginfod_begin): Use it if $DEBUGINFOD_PROGRESS set.
869 (server_timeout): Bump to 30 seconds.
870 (debuginfod_query_server): Call progressfn -after- rather than
871 before curl ops, to make it likely that a successful transfer
872 results in final a=b call. Tweak cleanup sequence.
873 * debuginfod.h: Document $DEBUGINFOD_PROGRESS name.
875 2019-12-09 Mark Wielaard <mark@klomp.org>
877 * debuginfod-client.c (debuginfod_query_server): Check
878 server_urls_envvar early.
880 2019-12-03 Mark Wielaard <mark@klomp.org>
882 * debuginfod-client.c (debuginfod_query_server): Use separate
883 local variables for CURLcode curl_res and CURLMcode curlm_res.
885 2019-11-26 Mark Wielaard <mark@klomp.org>
887 * Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
890 2019-11-25 Frank Ch. Eigler <fche@redhat.com>
892 * debuginfod.cxx (groom): Add a sqlite3_db_release_memory()
893 at the end of periodic grooming to try to shrink the process.
895 2019-11-24 Mark Wielaard <mark@klomp.org>
897 * debuginfod.cxx (test_webapi_sleep): Removed.
898 (handler_cb): Don't check test_webapi_sleep and sleep.
899 (main): Don't set test_webapi_sleep.
901 2019-11-24 Mark Wielaard <mark@klomp.org>
903 * debuginfod.cxx (add_metric): New function.
904 (scan_source_file_path): Record metrics for
905 found_executable_total, found_debuginfo_total and
906 found_sourcerefs_total.
907 (scan_source_rpm_path): Likewise.
909 2019-11-07 Frank Ch. Eigler <fche@redhat.com>
911 * debuginfod.cxx: Add /metrics endpoint. Add numerous
912 calls to new functions inc_metric/set_metric to populate
913 threadsafe map containing stats. Add http content-type
914 response headers throughout.
915 (thread_main_*): Simplify counter/timer flow.
916 (main): Reorder web service shutdown to leave http running
918 * debuginfod.8: Document it, add security caution.
920 2019-11-06 Frank Ch. Eigler <fche@redhat.com>
922 * debuginfod.cxx: Add new -L (symlink-following) mode.
923 * debuginfod.8: Document it.
925 2019-11-04 Frank Ch. Eigler <fche@redhat.com>
927 * debuginfo-client.c (debuginfod_set_progressfn): New function
928 for progress/interrupt callback.
929 (debuginfod_clean_cache, debuginfod_query_server): Call it.
930 * debuginfo.h: Declare it.
931 * debuginfod_set_progressfn.3, *_find_debuginfo.3: Document it.
932 * Makefile.am: Install it.
933 * libdebuginfod.map: Export it all under ELFUTILS_0.178 symversion.
935 * debuginfod-find.c: Add -v option to activate progress cb.
936 * debuginfod-find.1: Document it.
937 * debuginfod.cxx: Add $DEBUGINFOD_TEST_WEBAPI_SLEEP env var
938 to insert sleep in webapi callbacks, to help manual testing.
940 2019-10-28 Frank Ch. Eigler <fche@redhat.com>
942 * debuginfod.cxx: New file: debuginfod server.
943 * debuginfod.8: New file: man page.
944 * Makefile.am: Build it.
946 2019-10-28 Aaron Merey <amerey@redhat.com>
948 * debuginfod-client.c: New file: debuginfod client library.
949 * debuginfod.h: New file: header for same.
950 * libdebuginfod.map: New file: govern its solib exports.
951 * debuginfod-find.c: New file: command line frontend.
952 * debuginfod-find.1, debuginfod_find_source.3,
953 debuginfod_find_executable.3, debuginfod_find_debuginfo.3: