debuginfod-client: Initialize struct handle_data errbuf to the empty string.
[platform/upstream/elfutils.git] / debuginfod / ChangeLog
1 2020-11-23  Mark Wielaard  <mark@klomp.org>
2
3         * debuginfod-client.c (debuginfod_query_server): Initialize
4         struct handle_data errbuf to the empty string.
5
6 2020-11-11  Mark Wielaard  <mark@klomp.org>
7
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.
21
22 2020-11-21  Mark Wielaard  <mark@klomp.org>
23
24         * debuginfod.cxx (handle_root): New function.
25         (handler_cb): Handle "/" and report url1 in webapi error.
26
27 2020-11-11  Mark Wielaard  <mark@klomp.org>
28
29         * debuginfod-find.c (progressfn): Use clock_gettime to print Progress
30         at most 5 times a second.
31
32 2020-11-19  Frank Ch. Eigler  <fche@redhat.com>
33
34         * debuginfod.cxx (tmp_inc_metric): New class.
35         (handler_cb): Use it to track webapi operations.
36
37 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
38
39         * debuginfod-client.c (debuginfod_init_cache): Use ACCESSPERMS for
40         mkdir, DEFFILEMODE for open with O_CREAT.
41
42 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
43
44         * debuginfod.cxx: include libintl.h.
45
46 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
47
48         * Makefile.am (debuginfod_LDADD): Add argp_LDADD and fts_LIBS.
49         (debuginfod_find_LDADD): Likewise.
50         (libdebuginfod_so_LDLIBS): Add fts_LIBS.
51
52 2020-10-31  Frank Ch. Eigler  <fche@redhat.com>
53
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.
58         Tweak metrics.
59
60 2020-10-30  Frank Ch. Eigler  <fche@redhat.com>
61
62         PR26775 cont'd.
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
69         metric.
70
71 2020-10-29  Frank Ch. Eigler  <fche@redhat.com>
72
73         PR26775
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.
81
82 2020-10-29  Frank Ch. Eigler  <fche@redhat.com>
83
84         PR26810
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.
89
90 2020-10-25  Mark Wielaard  <mark@klomp.org>
91
92         * debuginfod-client.c (debuginfod_query_server): Translate
93         CURLE_PEER_FAILED_VERIFICATION to ECONNREFUSED.
94
95 2020-10-20  Frank Ch. Eigler  <fche@redhat.com>
96
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.
102
103 2020-10-20  Frank Ch. Eigler  <fche@redhat.com>
104
105         * debuginfod.cxx (handle_buildid*): Add a parameter for detecting
106         internally-originated lookups for dwz resolution.
107
108 2020-09-18  Frank Ch. Eigler <fche@redhat.com>
109
110         * debuginfod.cxx (scan_source_file, archive_classify): Store only
111         canonicalized file names in sdef & sref records in the database.
112
113 2020-09-08  Mark Wielaard  <mark@klomp.org>
114
115         * Makefile.am (BUILD_STATIC): Include libcurl_LIBS in libdebuginfod
116         when NOT DUMMY_LIBDEBUGINFOD.
117
118 2020-09-16  Mark Wielaard  <mark@klomp.org>
119
120         * debuginfod-find.c: Fix license block comment.
121
122 2020-09-15  Mark Wielaard  <mark@klomp.org>
123
124         * debuginfod-find.c (main): Use dwelf_elf_begin.
125
126 2020-07-03  Alice Zhang <alizhang@redhat.com>
127
128         * debuginfod-client.c (debuginfod_query_server): Use strncasecmp
129         to compare effective_url. Try CURLINFO_SCHEME as fallback.
130
131 2020-06-19  Mark Wielaard  <mark@klomp.org>
132
133         * Makefile.am (bin_PROGRAMS): Guard with DEBUGINFOD and
134         LIBDEBUGINFOD.
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.
142         (install): Likewise.
143         (uninstall): Likewise.
144         * debuginfod-client.c: Include dummy functions when
145         DUMMY_LIBDEBUGINFOD.
146         * debuginfod.cxx: Remove curl.h include.
147
148 2020-06-16  Mark Wielaard  <mark@klomp.org>
149
150         * debuginfod-client.c (debuginfod_query_server): Check malloc.
151         Move curl_multi_init call before handle_data malloc call.
152
153 2020-06-16  Mark Wielaard  <mark@klomp.org>
154
155         * debuginfod-client.c (debuginfod_query_server): Replace sizeof
156         build_id_bytes check with strlen build_id check.
157
158 2020-06-16  Mark Wielaard  <mark@klomp.org>
159
160         * debuginfod-client.c (debuginfod_query_server): Increase suffix
161         array and prepare having to escape 1 character with 2.
162
163 2020-06-16  Mark Wielaard  <mark@klomp.org>
164
165         * debuginfod-client.c (debuginfod_clean_cache): Handle failing
166         fopen (interval_path).
167
168 2020-03-29  Mark Wielaard  <mark@klomp.org>
169
170         * debuginfod-client.c (debuginfod_add_http_header): Check header
171         contains precisely one colon that isn't the first or last char.
172
173 2020-03-29  Frank Ch. Eigler  <fche@redhat.com>
174
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.
180
181 2020-03-27  Mark Wielaard  <mark@klomp.org>
182
183         * debuginfod.cxx (parse_opt): Check port is not zero.
184
185 2020-03-28  Frank Ch. Eigler  <fche@redhat.com>
186
187         * debuginfod.cxx (handle_buildid_r_match): During archive
188         extraction / fdcache prefetching, set the mtime of each
189         file in the cache.
190
191 2020-03-27  Frank Ch. Eigler  <fche@redhat.com>
192
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.
196
197 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
198
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.
208
209 2020-03-26  Frank Ch. Eigler <fche@redhat.com>
210
211         * debuginfod.cxx (handler_cb): Export two families of metrics for
212         prometheus traffic analysis: response times and data amounts.
213
214 2020-03-26  Frank Ch. Eigler <fche@redhat.com>
215
216         * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
217         after all if access(3)-able, fallback to bsdtar.
218
219 2020-03-25  Frank Ch. Eigler <fche@redhat.com>
220
221         * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
222         the .deb & .ddeb extensions, instead of dpkg-deb.
223
224 2020-03-26  Frank Ch. Eigler  <fche@redhat.com>
225
226         * debuginfod-client.c (debuginfod_query_server): Don't
227         set CURLOPT_PATH_AS_IS on old curl.  Mostly harmless.
228
229 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
230
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.
239
240 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
241
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.
248
249 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
250
251         * debuginfod-client.c (debuginfod_query_server): Print the
252         default_progressfn terminating \n message only if that progressfn
253         is actually set.
254
255 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
256
257         * debuginfod-find.c (main): Correct /source full-pathness check for
258         "debuginfod-find -v source deadbeef /pathname" case.
259
260 2020-03-22  Frank Ch. Eigler  <fche@redhat.com>
261
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.
268
269 2020-03-22  Frank Ch. Eigler  <fche@redhat.com>
270
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.
274
275 2020-03-03  Aaron Merey  <amerey@redhat.com>
276
277         * debuginfod-client.c (debuginfod_query_server): Update
278         cache_path even when new default path already exists.
279
280 2020-02-27  Aaron Merey  <amerey@redhat.com>
281
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.
286
287 2020-02-26  Konrad Kleine <kkleine@redhat.com>
288
289         * debuginfod-client.c (debuginfod_query_server): Handle curl's
290         response code correctly when DEBUGINFOD_URLS begin with file://
291
292 2020-02-25  Frank Ch. Eigler  <fche@redhat.com>
293
294         * debuginfod.cxx (parse_opt): Treat -R as if -Z.rpm .
295
296 2020-02-25  Frank Ch. Eigler  <fche@redhat.com>
297
298         * debuginfod.cxx (fdcache_prefetch): New parameter.
299         (parse_opt): Parse it.
300         (main): Default 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
307         into the fdcache.
308
309 2020-02-19  Aaron Merey  <amerey@redhat.com>
310
311         * debuginfod-client.c (debuginfod_clean_cache): Restrict
312         cleanup to client-pattern files.
313
314 2020-02-05  Frank Ch. Eigler  <fche@redhat.com>
315
316         * debuginfod.cxx (argp options): Add -Z option.
317         (canonicalized_archive_entry_pathname): New function for
318         distro-agnostic file name matching/storage.
319
320 2020-01-22  Frank Ch. Eigler  <fche@redhat.com>
321
322         * debuginfod.cxx (dwarf_extract_source_paths): Don't print
323         "skipping hat" messages at verbosity <=3, too noisy.
324
325 2020-01-19  Frank Ch. Eigler  <fche@redhat.com>
326
327         * debuginfod.cxx (scanq): Rework to let groomer/fts threads
328         synchronize with an empty workqueue, and lock out workqueue
329         consumers.
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.
335
336 2020-01-18  Frank Ch. Eigler  <fche@redhat.com>
337
338         * debuginfod.cxx (thread_main_scanner): Handle empty source_paths[].
339
340 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
341
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
345         filenames.
346         (handle_buildid_r_match): Use it to answer dwz/altdebug and webapi
347         requests.
348         (groom): Clean it.
349         (main): Initialize the cache control parameters from heuristics.
350         Use a consistent tmpdir for these and tmp files elsewhere.
351
352 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
353
354         * debuginfod.cxx (conninfo): Print User-Agent and X-Forwarded-For
355         request headers, after mild safety-censorship (for easier machine
356         processing).
357
358 2020-01-11  Frank Ch. Eigler  <fche@redhat.com>
359
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.
373
374 2019-01-02  Mark Wielaard  <mark@klomp.org>
375
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.
381
382 2020-01-09  Frank Ch. Eigler  <fche@redhat.com>
383
384         * debuginfod-client.c (add_extra_headers): New function,
385         based on mjw's draft.
386         (debuginfod_query_server): Call it.
387
388 2019-12-22  Frank Ch. Eigler  <fche@redhat.com>
389
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.
394
395 2019-12-19  Frank Ch. Eigler  <fche@redhat.com>
396
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.
404
405 2019-12-09  Mark Wielaard  <mark@klomp.org>
406
407         * debuginfod-client.c (debuginfod_query_server): Check
408         server_urls_envvar early.
409
410 2019-12-03  Mark Wielaard  <mark@klomp.org>
411
412         * debuginfod-client.c (debuginfod_query_server): Use separate
413         local variables for CURLcode curl_res and CURLMcode curlm_res.
414
415 2019-11-26  Mark Wielaard  <mark@klomp.org>
416
417         * Makefile.am (BUILD_STATIC): Add needed libraries for libdw and
418         libdebuginfod.
419
420 2019-11-25  Frank Ch. Eigler  <fche@redhat.com>
421
422         * debuginfod.cxx (groom): Add a sqlite3_db_release_memory()
423         at the end of periodic grooming to try to shrink the process.
424
425 2019-11-24  Mark Wielaard  <mark@klomp.org>
426
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.
430
431 2019-11-24  Mark Wielaard  <mark@klomp.org>
432
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.
438
439 2019-11-07  Frank Ch. Eigler  <fche@redhat.com>
440
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
447         as long as possible.
448         * debuginfod.8: Document it, add security caution.
449
450 2019-11-06  Frank Ch. Eigler  <fche@redhat.com>
451
452         * debuginfod.cxx: Add new -L (symlink-following) mode.
453         * debuginfod.8: Document it.
454
455 2019-11-04  Frank Ch. Eigler  <fche@redhat.com>
456
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.
464
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.
469
470 2019-10-28  Frank Ch. Eigler  <fche@redhat.com>
471
472         * debuginfod.cxx: New file: debuginfod server.
473         * debuginfod.8: New file: man page.
474         * Makefile.am: Build it.
475
476 2019-10-28  Aaron Merey  <amerey@redhat.com>
477
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:
484         New man pages.