26c1a076b37e5e17022e97470a1801388c116f35
[platform/upstream/elfutils.git] / debuginfod / ChangeLog
1 2022-05-09  Mark Wielaard  <mark@klomp.org>
2
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.
6
7 2022-05-09  Mark Wielaard  <mark@klomp.org>
8
9         * debuginfod.cxx (conninfo): Always provide servname to getnameinfo.
10
11 2022-05-09  Mark Wielaard  <mark@klomp.org>
12
13         * debuginfod-client.c (debuginfod_query_server): Add
14         curl_easy_setopt_ck macro, use it for all curl_easy_setopt calls.
15
16 2022-05-09  Mark Wielaard  <mark@klomp.org>
17
18         * debuginfod-client.c (debuginfod_write_callback): Check result
19         of curl_easy_getinfo.
20
21 2022-05-05  Mark Wielaard  <mark@klomp.org>
22
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
25         when use_poll is set.
26
27 2022-05-05  Mark Wielaard  <mark@klomp.org>
28
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.
33
34 2022-05-09  Noah Sanci  <nsanci@redhat.com>
35
36         * debuginfod.cxx (main): Set nonzero defaults for fdcache.
37
38 2022-05-04  Frank Ch. Eigler <fche@redhat.com>
39             Mark Wielaard  <mark@klomp.org>
40
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
44         minor fd leaks.
45         * debuginfod-find.c  (main): Ditto.
46
47 2022-04-22  Mark Wielaard  <mark@klomp.org>
48
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.
56
57 2022-04-24  Mark Wielaard  <mark@klomp.org>
58
59         * debuginfod.cxx (main): Add MHD_USE_ITC to MHD_start_daemon flags.
60
61 2022-04-13  Aaron Merey  <amerey@redhat.com>
62
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.
68
69 2022-04-03  Frank Ch. Eigler <fche@redhat.com>
70
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.
77
78 2022-04-03  Frank Ch. Eigler <fche@redhat.com>
79
80         * debuginfod.cxx (main): Use MHD_USE_EPOLL for libmicrohttpd, to
81         encourage more round-robin dispatch of incoming connections.
82
83 2021-12-09  Alexander Kanavin <alex@linutronix.de>
84
85         * debuginfod-client.c (cache_clean_default_interval_s): Change type to
86         long from time_t.
87         (cache_miss_default_s): Likewise.
88         (cache_default_max_unused_age_s): Likewise.
89
90 2021-12-09  Mark Wielaard  <mark@klomp.org>
91
92         * debuginfod.cxx (database_stats_report): Don't format clog
93         using 'right' and 'setw(20)'.
94
95 2021-12-08  Frank Ch. Eigler  <fche@redhat.com>
96
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.
101         Activate error_cb.
102
103 2021-12-04  Mark Wielaard  <mark@klomp.org>
104
105         * debuginfod.cxx (main): Call debuginfod_pool_groom before exit.
106
107 2021-12-08  Mark Wielaard  <mark@klomp.org>
108
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
116         created.
117         (handle_root): Likewise.
118
119 2021-12-08  Frank Ch. Eigler  <fche@redhat.com>
120
121         * debuginfod.cxx (intern): Call set_metrics() holding the fdcache mutex.
122
123 2021-12-04  Mark Wielaard  <mark@klomp.org>
124
125         * debuginfod-client.c (debuginfod_query_server): Free winning_headers.
126         Reset response_data_size when clearing response_data.
127
128 2021-12-01  Mark Wielaard  <mark@klomp.org>
129
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.
134
135 2021-12-01  Mark Wielaard  <mark@klomp.org>
136
137         * debuginfod-client.c (timestamp): Use gmtime_r instead of gmtime.
138         (add_mhd_last_modified): Likewise.
139
140 2021-11-10  Érico N. Rolim  <erico.erc@gmail.com>
141
142         * debuginfod.cxx: include "system.h" under 'extern "C"' block.
143
144 2021-11-05  Frank Ch. Eigler  <fche@redhat.com>
145
146         PR28430
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.
151
152 2021-11-04  Frank Ch. Eigler  <fche@redhat.com>
153
154         PR28514
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.
158
159 2021-10-23  Frank Ch. Eigler  <fche@redhat.com>
160
161         PR28240
162         * debuginfod-client.c (debuginfod_query_server): Correct
163         negative-hit cache check sequence for root user.
164
165 2021-10-15  Mark Wielaard  <mark@klomp.org>
166
167         * debuginfod-client.c (debuginfod_query_server): Set
168         CURLOPT_PROTOCOLS.
169
170 2021-10-06  Di Chen <dichen@redhat.com>
171
172         PR28242
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.
177
178 2021-09-17  Noah Sanci  <nsanci@redhat.com>
179
180         * debuginfod-client.c (debuginfod_query_server): curl_multi_perform
181         now occurs before checking if response headers have arrived.
182
183 2021-09-14  Frank Ch. Eigler <fche@redhat.com>
184
185         PRPR28339
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().
190
191 2021-09-12  Mark Wielaard  <mark@klomp.org>
192
193         * debuginfod.cxx (libarchive_fdcache::lookup): Add endl after
194         obatched(clog) line.
195 2021-09-13  Noah Sanci  <nsanci@redhat.com>
196
197         * debuginfod-client.c (debuginfod_query_server): Removed constant
198         operations from a loop. curl_free memory.
199
200 2021-09-06  Dmitry V. Levin  <ldv@altlinux.org>
201
202         * debuginfod-client.c (debuginfod_begin): Remove cast of calloc return
203         value.
204
205 2021-08-28  Mark Wielaard  <mjw@redhat.com>
206
207         * debuginfod.cxx (parse_opt): Turn the -d arg ":memory:" into
208         "file::memory:?cache=shared" for the db_path.
209
210 2021-08-20  Di Chen  <dichen@redhat.com>
211
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.
217
218 2021-08-20  Saleem Abdulrasool  <abdulras@google.com>
219
220         * debuginfod.cxx: Remove error.h include.
221
222 2021-08-19  Frank Ch. Eigler  <fche@redhat.com>
223
224         PR28249
225         * debuginfod.cxx (handler_cb): Fix after_you unique_set key
226         to the entire incoming URL.
227
228 2021-08-02  Noah Sanci  <nsanci@redhat.com>
229
230         PR27277
231         * debuginfod-client.c (struct debuginfod_client): New field
232         winning_headers.
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.
243
244 2021-07-26  Noah Sanci  <nsanci@redhat.com>
245
246         PR27982
247         * debuginfod-client.c (globals): added default_maxsize and
248         default_maxtime.
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.
255
256 2021-07-16  Noah Sanci  <nsanci@redhat.com>
257
258         PR28034
259         * debuginfod-client.c (debuginfod_query_server): % escape filename
260         so the completed url is processed properly.
261
262 2021-06-28 Noah Sanci <nsanci@redhat.com>
263
264         PR25978
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
276
277 2021-07-06  Alice Zhang  <alizhang@redhat.com>
278
279         PR27531
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.
283
284 2021-07-01  Noah Sanci <nsanci@redhat.com>
285
286         PR27711
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.
291
292 2021-07-09  Noah Sanci  <nsanci@redhat.com>
293
294         PR27983
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
298         statements.
299         (globals): Removed url_delim_char, as it was no longer used.
300
301 2021-06-18  Mark Wielaard  <mark@klomp.org>
302
303         * debuginfod-client.c (debuginfod_begin): Don't use client if
304         calloc call failed.
305
306 2021-06-03  Frank Ch. Eigler <fche@redhat.com>
307
308         PR27863
309         * debuginfod.cxx (unique_set, unique_set_reserver): New classes.
310         (handler_cb): Use them to implement "after-you" queueing.
311
312 2021-05-14  Frank Ch. Eigler <fche@redhat.com>
313
314         PR27859
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.
319
320 2021-04-19  Martin Liska  <mliska@suse.cz>
321
322         * debuginfod-client.c (debuginfod_query_server): Use startswith.
323         (debuginfod_add_http_header): Likewise.
324         * debuginfod.cxx: Likewise.
325
326 2021-05-04  Alice Zhang <alizhang@redhat.com>
327
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.
337
338 2021-04-26  Frank Ch. Eigler <fche@redhat.com>
339
340         PR27571
341         * debuginfod-client.c (debuginfod_query_server): Chmod 0400 files
342         delivered into the cache to prevent accidental modification.
343
344 2021-04-26  Frank Ch. Eigler <fche@redhat.com>
345
346         PR26125
347         * debuginfod-client.c (debuginfod_clean_cache): For directory
348         rmdir, check mtime first.
349         (debuginfod_query_server): Try mkdir / mkstemp up to twice,
350         in case of race.
351
352 2021-04-23  Frank Ch. Eigler <fche@redhat.com>
353
354         PR27701
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.
360
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
366         callbacks.
367
368 2021-04-15  Frank Ch. Eigler <fche@redhat.com>
369
370         * debuginfod.cxx (groom): Only update database stats once.
371
372 2021-04-15  Frank Ch. Eigler <fche@redhat.com>
373
374         * debuginfod.cxx (elf_classify): Recognize symtab-only stripped files
375         like fedora's libicudata as debuginfo files.
376
377 2021-03-30  Frank Ch. Eigler <fche@redhat.com>
378
379         * debuginfod.cxx (main): Set child thread names.
380
381 2021-03-07  Timm Bäder <tbaeder@redhat.com>
382
383         * debuginfod-client.c (debuginfod_query_server): Tweak
384         double/long clamping arithmetic to avoid UB and warnings.
385
386 2021-02-25  Frank Ch. Eigler <fche@redhat.com>
387
388         * debuginfod.cxx (handler_cb): Filter webapi for bad
389         artifacttype keywords early for metric hygiene.
390
391 2021-02-14  Frank Ch. Eigler <fche@redhat.com>
392
393         * debuginfod.cxx (main -U): Use bsdtar unconditionally.  Also map
394         the debian-compatible .ipk (openembedded distro family) to same.
395
396 2021-02-04  Frank Ch. Eigler <fche@redhat.com>
397
398         PR27092 low-memory handling
399         * debuginfod.cxx (fdcache_mintmp): New parameter, with cmd-line option.
400         (parse_opt): Parse it.
401         (main): Default 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.
405         (groom): Ditto.
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.
409
410 2021-02-02  Frank Ch. Eigler <fche@redhat.com>
411
412         PR27323
413         * debuginfod.cxx (dbq): New read-only database connection for queries
414         only.
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.
423
424 2020-12-20  Dmitry V. Levin  <ldv@altlinux.org>
425
426         * .gitignore: New file.
427
428 2020-12-12  Dmitry V. Levin  <ldv@altlinux.org>
429
430         * debuginfod-client.c (debuginfod_query_server): Fix spelling typos in
431         comments.
432         * debuginfod.cxx: Likewise.
433         (parse_opt): Fix spelling typos in error diagnostics.
434
435 2020-12-08  Dmitry V. Levin  <ldv@altlinux.org>
436
437         * Makefile.am [LIBDEBUGINFOD]: Create libdebuginfod.so.1 first, turn
438         libdebuginfod.so into symlink.
439
440 2020-11-30  Dmitry V. Levin  <ldv@altlinux.org>
441
442         * Makefile.am (libdebuginfod.so): Replace $@.$(VERSION) with
443         $(LIBDEBUGINFOD_SONAME).
444         (install, uninstall, MOSTLYCLEANFILES): Replace
445         libdebuginfod.so.$(VERSION) with $(LIBDEBUGINFOD_SONAME).
446         (VERSION): Remove.
447         * debuginfod.h: Rename to ...
448         * debuginfod.h.in ... this.
449         (DEBUGINFOD_SONAME): New macro.
450
451 2020-11-30  Dmitry V. Levin  <ldv@altlinux.org>
452
453         * Makefile.am (libdebuginfod.so$(EXEEXT)): Drop $(EXEEXT) suffix.
454
455 2020-11-25  Frank Ch. Eigler  <fche@redhat.com>
456
457         * debuginfod.cxx (step_ok_done): Correct typo in prom metric label.
458
459 2020-11-25  Frank Ch. Eigler  <fche@redhat.com>
460
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.
464
465 2020-11-23  Frank Ch. Eigler  <fche@redhat.com>
466
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.
470
471 2020-11-23  Mark Wielaard  <mark@klomp.org>
472
473         * debuginfod-client.c (debuginfod_query_server): Initialize
474         struct handle_data errbuf to the empty string.
475
476 2020-11-11  Mark Wielaard  <mark@klomp.org>
477
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.
491
492 2020-11-21  Mark Wielaard  <mark@klomp.org>
493
494         * debuginfod.cxx (handle_root): New function.
495         (handler_cb): Handle "/" and report url1 in webapi error.
496
497 2020-11-11  Mark Wielaard  <mark@klomp.org>
498
499         * debuginfod-find.c (progressfn): Use clock_gettime to print Progress
500         at most 5 times a second.
501
502 2020-11-19  Frank Ch. Eigler  <fche@redhat.com>
503
504         * debuginfod.cxx (tmp_inc_metric): New class.
505         (handler_cb): Use it to track webapi operations.
506
507 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
508
509         * debuginfod-client.c (debuginfod_init_cache): Use ACCESSPERMS for
510         mkdir, DEFFILEMODE for open with O_CREAT.
511
512 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
513
514         * debuginfod.cxx: include libintl.h.
515
516 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
517
518         * Makefile.am (debuginfod_LDADD): Add argp_LDADD and fts_LIBS.
519         (debuginfod_find_LDADD): Likewise.
520         (libdebuginfod_so_LDLIBS): Add fts_LIBS.
521
522 2020-10-31  Frank Ch. Eigler  <fche@redhat.com>
523
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.
528         Tweak metrics.
529
530 2020-10-30  Frank Ch. Eigler  <fche@redhat.com>
531
532         PR26775 cont'd.
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
539         metric.
540
541 2020-10-29  Frank Ch. Eigler  <fche@redhat.com>
542
543         PR26775
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.
551
552 2020-10-29  Frank Ch. Eigler  <fche@redhat.com>
553
554         PR26810
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.
559
560 2020-10-25  Mark Wielaard  <mark@klomp.org>
561
562         * debuginfod-client.c (debuginfod_query_server): Translate
563         CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.
564
565 2020-10-20  Frank Ch. Eigler  <fche@redhat.com>
566
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.
572
573 2020-10-20  Frank Ch. Eigler  <fche@redhat.com>
574
575         * debuginfod.cxx (handle_buildid*): Add a parameter for detecting
576         internally-originated lookups for dwz resolution.
577
578 2020-09-18  Frank Ch. Eigler <fche@redhat.com>
579
580         * debuginfod.cxx (scan_source_file, archive_classify): Store only
581         canonicalized file names in sdef & sref records in the database.
582
583 2020-09-08  Mark Wielaard  <mark@klomp.org>
584
585         * Makefile.am (BUILD_STATIC): Include libcurl_LIBS in libdebuginfod
586         when NOT DUMMY_LIBDEBUGINFOD.
587
588 2020-09-16  Mark Wielaard  <mark@klomp.org>
589
590         * debuginfod-find.c: Fix license block comment.
591
592 2020-09-15  Mark Wielaard  <mark@klomp.org>
593
594         * debuginfod-find.c (main): Use dwelf_elf_begin.
595
596 2020-07-03  Alice Zhang <alizhang@redhat.com>
597
598         * debuginfod-client.c (debuginfod_query_server): Use strncasecmp
599         to compare effective_url. Try CURLINFO_SCHEME as fallback.
600
601 2020-06-19  Mark Wielaard  <mark@klomp.org>
602
603         * Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and
604         LIBDEBUGINFOD.
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.
612         (install): Likewise.
613         (uninstall): Likewise.
614         * debuginfod-client.c: Include dummy functions when
615         DUMMY_LIBDEBUGINFOD.
616         * debuginfod.cxx: Remove curl.h include.
617
618 2020-06-16  Mark Wielaard  <mark@klomp.org>
619
620         * debuginfod-client.c (debuginfod_query_server): Check malloc.
621         Move curl_multi_init call before handle_data malloc call.
622
623 2020-06-16  Mark Wielaard  <mark@klomp.org>
624
625         * debuginfod-client.c (debuginfod_query_server): Replace sizeof
626         build_id_bytes check with strlen build_id check.
627
628 2020-06-16  Mark Wielaard  <mark@klomp.org>
629
630         * debuginfod-client.c (debuginfod_query_server): Increase suffix
631         array and prepare having to escape 1 character with 2.
632
633 2020-06-16  Mark Wielaard  <mark@klomp.org>
634
635         * debuginfod-client.c (debuginfod_clean_cache): Handle failing
636         fopen (interval_path).
637
638 2020-03-29  Mark Wielaard  <mark@klomp.org>
639
640         * debuginfod-client.c (debuginfod_add_http_header): Check header
641         contains precisely one colon that isn't the first or last char.
642
643 2020-03-29  Frank Ch. Eigler  <fche@redhat.com>
644
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.
650
651 2020-03-27  Mark Wielaard  <mark@klomp.org>
652
653         * debuginfod.cxx (parse_opt): Check port is not zero.
654
655 2020-03-28  Frank Ch. Eigler  <fche@redhat.com>
656
657         * debuginfod.cxx (handle_buildid_r_match): During archive
658         extraction / fdcache prefetching, set the mtime of each
659         file in the cache.
660
661 2020-03-27  Frank Ch. Eigler  <fche@redhat.com>
662
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.
666
667 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
668
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.
678
679 2020-03-26  Frank Ch. Eigler <fche@redhat.com>
680
681         * debuginfod.cxx (handler_cb): Export two families of metrics for
682         prometheus traffic analysis: response times and data amounts.
683
684 2020-03-26  Frank Ch. Eigler <fche@redhat.com>
685
686         * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
687         after all if access(3)-able, fallback to bsdtar.
688
689 2020-03-25  Frank Ch. Eigler <fche@redhat.com>
690
691         * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
692         the .deb & .ddeb extensions, instead of dpkg-deb.
693
694 2020-03-26  Frank Ch. Eigler  <fche@redhat.com>
695
696         * debuginfod-client.c (debuginfod_query_server): Don't
697         set CURLOPT_PATH_AS_IS on old curl.  Mostly harmless.
698
699 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
700
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.
709
710 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
711
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.
718
719 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
720
721         * debuginfod-client.c (debuginfod_query_server): Print the
722         default_progressfn terminating \n message only if that progressfn
723         is actually set.
724
725 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
726
727         * debuginfod-find.c (main): Correct /source full-pathness check for
728         "debuginfod-find -v source deadbeef /pathname" case.
729
730 2020-03-22  Frank Ch. Eigler  <fche@redhat.com>
731
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.
738
739 2020-03-22  Frank Ch. Eigler  <fche@redhat.com>
740
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.
744
745 2020-03-03  Aaron Merey  <amerey@redhat.com>
746
747         * debuginfod-client.c (debuginfod_query_server): Update
748         cache_path even when new default path already exists.
749
750 2020-02-27  Aaron Merey  <amerey@redhat.com>
751
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.
756
757 2020-02-26  Konrad Kleine <kkleine@redhat.com>
758
759         * debuginfod-client.c (debuginfod_query_server): Handle curl's
760         response code correctly when DEBUGINFOD_URLS begin with file://
761
762 2020-02-25  Frank Ch. Eigler  <fche@redhat.com>
763
764         * debuginfod.cxx (parse_opt): Treat -R as if -Z.rpm .
765
766 2020-02-25  Frank Ch. Eigler  <fche@redhat.com>
767
768         * debuginfod.cxx (fdcache_prefetch): New parameter.
769         (parse_opt): Parse it.
770         (main): Default 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
777         into the fdcache.
778
779 2020-02-19  Aaron Merey  <amerey@redhat.com>
780
781         * debuginfod-client.c (debuginfod_clean_cache): Restrict
782         cleanup to client-pattern files.
783
784 2020-02-05  Frank Ch. Eigler  <fche@redhat.com>
785
786         * debuginfod.cxx (argp options): Add -Z option.
787         (canonicalized_archive_entry_pathname): New function for
788         distro-agnostic file name matching/storage.
789
790 2020-01-22  Frank Ch. Eigler  <fche@redhat.com>
791
792         * debuginfod.cxx (dwarf_extract_source_paths): Don't print
793         "skipping hat" messages at verbosity <=3, too noisy.
794
795 2020-01-19  Frank Ch. Eigler  <fche@redhat.com>
796
797         * debuginfod.cxx (scanq): Rework to let groomer/fts threads
798         synchronize with an empty workqueue, and lock out workqueue
799         consumers.
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.
805
806 2020-01-18  Frank Ch. Eigler  <fche@redhat.com>
807
808         * debuginfod.cxx (thread_main_scanner): Handle empty source_paths[].
809
810 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
811
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
815         filenames.
816         (handle_buildid_r_match): Use it to answer dwz/altdebug and webapi
817         requests.
818         (groom): Clean it.
819         (main): Initialize the cache control parameters from heuristics.
820         Use a consistent tmpdir for these and tmp files elsewhere.
821
822 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
823
824         * debuginfod.cxx (conninfo): Print User-Agent and X-Forwarded-For
825         request headers, after mild safety-censorship (for easier machine
826         processing).
827
828 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
829
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.
843
844 2019-01-02  Mark Wielaard  <mark@klomp.org>
845
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.
851
852 2020-01-09  Frank Ch. Eigler  <fche@redhat.com>
853
854         * debuginfod-client.c (add_extra_headers): New function,
855         based on mjw's draft.
856         (debuginfod_query_server): Call it.
857
858 2019-12-22  Frank Ch. Eigler  <fche@redhat.com>
859
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.
864
865 2019-12-19  Frank Ch. Eigler  <fche@redhat.com>
866
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.
874
875 2019-12-09  Mark Wielaard  <mark@klomp.org>
876
877         * debuginfod-client.c (debuginfod_query_server): Check
878         server_urls_envvar early.
879
880 2019-12-03  Mark Wielaard  <mark@klomp.org>
881
882         * debuginfod-client.c (debuginfod_query_server): Use separate
883         local variables for CURLcode curl_res and CURLMcode curlm_res.
884
885 2019-11-26  Mark Wielaard  <mark@klomp.org>
886
887         * Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
888         libdebuginfod.
889
890 2019-11-25  Frank Ch. Eigler  <fche@redhat.com>
891
892         * debuginfod.cxx (groom): Add a sqlite3_db_release_memory()
893         at the end of periodic grooming to try to shrink the process.
894
895 2019-11-24  Mark Wielaard  <mark@klomp.org>
896
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.
900
901 2019-11-24  Mark Wielaard  <mark@klomp.org>
902
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.
908
909 2019-11-07  Frank Ch. Eigler  <fche@redhat.com>
910
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
917         as long as possible.
918         * debuginfod.8: Document it, add security caution.
919
920 2019-11-06  Frank Ch. Eigler  <fche@redhat.com>
921
922         * debuginfod.cxx: Add new -L (symlink-following) mode.
923         * debuginfod.8: Document it.
924
925 2019-11-04  Frank Ch. Eigler  <fche@redhat.com>
926
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.
934
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.
939
940 2019-10-28  Frank Ch. Eigler  <fche@redhat.com>
941
942         * debuginfod.cxx: New file: debuginfod server.
943         * debuginfod.8: New file: man page.
944         * Makefile.am: Build it.
945
946 2019-10-28  Aaron Merey  <amerey@redhat.com>
947
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:
954         New man pages.