Hello community, here is the log from the commit of package babeltrace for openSUSE:Factory checked in at 2018-03-18 21:42:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/babeltrace (Old) and /work/SRC/openSUSE:Factory/.babeltrace.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "babeltrace" Sun Mar 18 21:42:35 2018 rev:2 rq:588016 version:1.5.4 Changes: -------- --- /work/SRC/openSUSE:Factory/babeltrace/babeltrace.changes 2017-11-04 10:25:36.602918341 +0100 +++ /work/SRC/openSUSE:Factory/.babeltrace.new/babeltrace.changes 2018-03-18 21:42:38.918460511 +0100 @@ -1,0 +2,24 @@ +Thu Mar 15 16:19:49 UTC 2018 - sor.ale...@meowr.ru + +- Update to version 1.5.4: + * Use signed accessors for clock offsets. + * Fix a signedness error in python complements. + * Handle packet_seek errors. + * Prevent calling adding the same trace recursively. + * Make sure we have all the metadata streams before adding new + traces. + * Add missing debugging information in the live plugin. + * Set stream id in HUP case. + * Use list rather than ptr array for trace streams. + * Fix a leak of streams. + * Handle 0 session case in ask new streams. + * Break loop on getting metadata error. + * Return error on ask_new_stream when should quit. + * Don't access missing ctf trace when getting metadata. + * Fix lttng-live discarded event count after inactivity. + * Fix timegm compat on Solaris. + * Fix Python bindings when building with PIE hardening. + * lttng-live: Print discarded event and packet lost warnings on + stderr. + +------------------------------------------------------------------- Old: ---- babeltrace-1.5.3.tar.bz2 New: ---- babeltrace-1.5.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ babeltrace.spec ++++++ --- /var/tmp/diff_new_pack.XCWrjK/_old 2018-03-18 21:42:40.146416271 +0100 +++ /var/tmp/diff_new_pack.XCWrjK/_new 2018-03-18 21:42:40.150416127 +0100 @@ -1,7 +1,7 @@ # # spec file for package babeltrace # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,12 +19,12 @@ %define soname libbabeltrace %define sover 1 Name: babeltrace -Version: 1.5.3 +Version: 1.5.4 Release: 0 Summary: Common Trace Format Babel Tower -License: MIT AND GPL-2.0 +License: MIT AND GPL-2.0-only Group: Development/Languages/C and C++ -URL: https://diamon.org/babeltrace +Url: https://diamon.org/babeltrace Source: https://efficios.com/files/babeltrace/%{name}-%{version}.tar.bz2 BuildRequires: bison BuildRequires: flex ++++++ babeltrace-1.5.3.tar.bz2 -> babeltrace-1.5.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/ChangeLog new/babeltrace-1.5.4/ChangeLog --- old/babeltrace-1.5.3/ChangeLog 2017-08-04 19:08:54.000000000 +0200 +++ new/babeltrace-1.5.4/ChangeLog 2018-02-01 04:05:00.000000000 +0100 @@ -1,3 +1,22 @@ +2018-01-31 babeltrace 1.5.4 (Gorilla Suit Day) + * Fix: use signed accessors for clock offsets + * Fix: signedness error in python complements + * Fix: handle packet_seek errors + * Fix: prevent calling adding the same trace recursively + * Fix: Make sure we have all the metadata streams before adding new traces + * Add missing debugging information in the live plugin + * Fix: set stream id in HUP case + * Fix: Use list rather than ptr array for trace streams + * Fix: leak of streams + * Fix: handle 0 session case in ask new streams + * Fix: break loop on getting metadata error + * Fix: return error on ask_new_stream when should quit + * Fix: don't access missing ctf trace when getting metadata + * Fix: lttng-live discarded event count after inactivity + * Fix: timegm compat on Solaris + * Fix: python bindings when building with PIE hardening + * lttng-live: print discarded event and packet lost warnings on stderr + 2017-08-04 lttng-tools 1.5.3 (International Beer Day) * Fix: unknown variable name in Python writer * Fix live-comm: only apply retry timeout for already seen inactive indexes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/bindings/python/Makefile.am new/babeltrace-1.5.4/bindings/python/Makefile.am --- old/babeltrace-1.5.3/bindings/python/Makefile.am 2017-08-04 19:08:54.000000000 +0200 +++ new/babeltrace-1.5.4/bindings/python/Makefile.am 2018-02-01 04:05:00.000000000 +0100 @@ -25,7 +25,7 @@ BUILD_FLAGS=CC="$(CC)" \ CFLAGS="$(GLIB_CFLAGS) $(AM_CFLAGS) $(CFLAGS)" \ CPPFLAGS="$(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)" \ - LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS) $(GLIB_LIBS) $(LIBS)" + LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS) $(GLIB_LIBS) -shared $(LIBS)" build-python-bindings.stamp: $(BINDINGS_DEPS) $(BUILD_FLAGS) $(PYTHON) $(builddir)/setup.py build_ext diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/bindings/python/Makefile.in new/babeltrace-1.5.4/bindings/python/Makefile.in --- old/babeltrace-1.5.3/bindings/python/Makefile.in 2017-08-04 19:09:04.000000000 +0200 +++ new/babeltrace-1.5.4/bindings/python/Makefile.in 2018-02-01 04:05:09.000000000 +0100 @@ -383,7 +383,7 @@ @USE_PYTHON_TRUE@BUILD_FLAGS = CC="$(CC)" \ @USE_PYTHON_TRUE@ CFLAGS="$(GLIB_CFLAGS) $(AM_CFLAGS) $(CFLAGS)" \ @USE_PYTHON_TRUE@ CPPFLAGS="$(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)" \ -@USE_PYTHON_TRUE@ LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS) $(GLIB_LIBS) $(LIBS)" +@USE_PYTHON_TRUE@ LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS) $(GLIB_LIBS) -shared $(LIBS)" @USE_PYTHON_TRUE@CLEANFILES = babeltrace/babeltrace_wrap.c babeltrace/babeltrace.py build-python-bindings.stamp @USE_PYTHON_TRUE@DISTCLEANFILES = setup.py @@ -620,9 +620,9 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@USE_PYTHON_FALSE@uninstall-local: @USE_PYTHON_FALSE@install-exec-local: @USE_PYTHON_FALSE@clean-local: -@USE_PYTHON_FALSE@uninstall-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/bindings/python/babeltrace/python-complements.c new/babeltrace-1.5.4/bindings/python/babeltrace/python-complements.c --- old/babeltrace-1.5.3/bindings/python/babeltrace/python-complements.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/bindings/python/babeltrace/python-complements.c 2018-02-01 04:05:00.000000000 +0100 @@ -264,7 +264,7 @@ int _bt_python_trace_collection_has_intersection(struct bt_context *ctx) { int ret; - int64_t begin, end; + uint64_t begin, end; ret = ctf_find_tc_stream_packet_intersection_union(ctx, &begin, &end); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/configure new/babeltrace-1.5.4/configure --- old/babeltrace-1.5.3/configure 2017-08-04 19:09:03.000000000 +0200 +++ new/babeltrace-1.5.4/configure 2018-02-01 04:05:07.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for babeltrace 1.5.3. +# Generated by GNU Autoconf 2.69 for babeltrace 1.5.4. # # Report bugs to <jeremie.galarn...@efficios.com>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='babeltrace' PACKAGE_TARNAME='babeltrace' -PACKAGE_VERSION='1.5.3' -PACKAGE_STRING='babeltrace 1.5.3' +PACKAGE_VERSION='1.5.4' +PACKAGE_STRING='babeltrace 1.5.4' PACKAGE_BUGREPORT='jeremie.galarn...@efficios.com' PACKAGE_URL='https://diamon.org/babeltrace' @@ -1410,7 +1410,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures babeltrace 1.5.3 to adapt to many kinds of systems. +\`configure' configures babeltrace 1.5.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1482,7 +1482,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of babeltrace 1.5.3:";; + short | recursive ) echo "Configuration of babeltrace 1.5.4:";; esac cat <<\_ACEOF @@ -1625,7 +1625,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -babeltrace configure 1.5.3 +babeltrace configure 1.5.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2048,7 +2048,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by babeltrace $as_me 1.5.3, which was +It was created by babeltrace $as_me 1.5.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3035,7 +3035,7 @@ # Define the identity of the package. PACKAGE='babeltrace' - VERSION='1.5.3' + VERSION='1.5.4' cat >>confdefs.h <<_ACEOF @@ -18592,7 +18592,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by babeltrace $as_me 1.5.3, which was +This file was extended by babeltrace $as_me 1.5.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18663,7 +18663,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -babeltrace config.status 1.5.3 +babeltrace config.status 1.5.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/configure.ac new/babeltrace-1.5.4/configure.ac --- old/babeltrace-1.5.3/configure.ac 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/configure.ac 2018-02-01 04:05:00.000000000 +0100 @@ -1,5 +1,5 @@ AC_PREREQ([2.50]) -AC_INIT([babeltrace],[1.5.3],[jeremie.galarn...@efficios.com],[],[https://diamon.org/babeltrace]) +AC_INIT([babeltrace],[1.5.4],[jeremie.galarn...@efficios.com],[],[https://diamon.org/babeltrace]) AC_SUBST([BABELTRACE_LIBRARY_VERSION], [1:0:0]) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/converter/babeltrace-log.c new/babeltrace-1.5.4/converter/babeltrace-log.c --- old/babeltrace-1.5.3/converter/babeltrace-log.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/converter/babeltrace-log.c 2018-02-01 04:05:00.000000000 +0100 @@ -282,7 +282,8 @@ if (!ctf_move_pos(&dummy, tlen * CHAR_BIT)) packet_filled = 1; if (packet_filled || ctf_pos_packet(&dummy)) { - ctf_pos_pad_packet(pos); + if (ctf_pos_pad_packet(pos)) + goto error; write_packet_header(pos, s_uuid); write_packet_context(pos); if (attempt++ == 1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/ctf/ctf.c new/babeltrace-1.5.4/formats/ctf/ctf.c --- old/babeltrace-1.5.3/formats/ctf/ctf.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/ctf/ctf.c 2018-02-01 04:05:00.000000000 +0100 @@ -36,6 +36,7 @@ #include <babeltrace/context-internal.h> #include <babeltrace/compat/uuid.h> #include <babeltrace/endian.h> +#include <babeltrace/error.h> #include <babeltrace/trace-debug-info.h> #include <babeltrace/ctf/ctf-index.h> #include <inttypes.h> @@ -434,7 +435,6 @@ * consumer had time to extract them. We keep track of those gaps with the * packet sequence number in each packet. */ -static void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream) { if ((!stream->events_discarded && !stream->packets_lost) || @@ -491,7 +491,8 @@ if (unlikely(pos->offset == EOF)) return EOF; - ctf_pos_get_event(pos); + if (ctf_pos_get_event(pos)) + return EOF; /* save the current position as a restore point */ pos->last_offset = pos->offset; @@ -1058,7 +1059,8 @@ case SEEK_SET: /* Fall-through */ break; /* OK */ default: - assert(0); + ret = -1; + goto end; } if ((pos->prot & PROT_WRITE) && pos->content_size_loc) @@ -1070,7 +1072,8 @@ if (ret) { fprintf(stderr, "[error] Unable to unmap old base: %s.\n", strerror(errno)); - assert(0); + ret = -1; + goto end; } pos->base_mma = NULL; } @@ -1090,7 +1093,8 @@ pos->cur_index = 0; break; default: - assert(0); + ret = -1; + goto end; } pos->content_size = -1U; /* Unknown at this point */ pos->packet_size = WRITE_PACKET_LEN; @@ -1106,7 +1110,8 @@ case SEEK_CUR: { if (pos->offset == EOF) { - return; + ret = 0; + goto end; } assert(pos->cur_index < pos->packet_index->len); /* The reader will expect us to skip padding */ @@ -1116,17 +1121,20 @@ case SEEK_SET: if (index >= pos->packet_index->len) { pos->offset = EOF; - return; + ret = 0; + goto end; } pos->cur_index = index; break; default: - assert(0); + ret = -1; + goto end; } if (pos->cur_index >= pos->packet_index->len) { pos->offset = EOF; - return; + ret = 0; + goto end; } packet_index = &g_array_index(pos->packet_index, @@ -1141,6 +1149,12 @@ ctf_update_current_packet_index(&file_stream->parent, prev_index, packet_index); + if (pos->cur_index >= pos->packet_index->len) { + pos->offset = EOF; + ret = 0; + goto end; + } + /* * We need to check if we are in trace read or called * from packet indexing. In this last case, the @@ -1162,7 +1176,8 @@ if (packet_index->data_offset == -1) { ret = find_data_offset(pos, file_stream, packet_index); if (ret < 0) { - return; + ret = -1; + goto end; } } pos->content_size = packet_index->content_size; @@ -1178,7 +1193,8 @@ goto read_next_packet; } else { pos->offset = EOF; - return; + ret = 0; + goto end; } } /* map new base. Need mapping length from header. */ @@ -1203,6 +1219,9 @@ ret = generic_rw(&pos->parent, &file_stream->parent.stream_packet_context->p); assert(!ret); } + ret = 0; +end: + bt_packet_seek_set_error(ret); } static @@ -2478,6 +2497,10 @@ /* Ask for the first packet to get the stream_id. */ packet_seek(&file_stream->pos.parent, 0, SEEK_SET); + ret = bt_packet_seek_get_error(); + if (ret) { + goto end; + } stream_id = file_stream->parent.stream_id; if (stream_id >= td->streams->len) { fprintf(stderr, "[error] Stream %" PRIu64 " is not declared " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/ctf/ir/stream.c new/babeltrace-1.5.4/formats/ctf/ir/stream.c --- old/babeltrace-1.5.3/formats/ctf/ir/stream.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/ctf/ir/stream.c 2018-02-01 04:05:00.000000000 +0100 @@ -778,6 +778,10 @@ /* mmap the next packet */ ctf_packet_seek(&stream->pos.parent, 0, SEEK_CUR); + ret = bt_packet_seek_get_error(); + if (ret) { + goto end; + } ret = bt_ctf_field_serialize(stream->packet_header, &stream->pos); if (ret) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/ctf/metadata/ctf-visitor-generate-io-struct.c new/babeltrace-1.5.4/formats/ctf/metadata/ctf-visitor-generate-io-struct.c --- old/babeltrace-1.5.3/formats/ctf/metadata/ctf-visitor-generate-io-struct.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/ctf/metadata/ctf-visitor-generate-io-struct.c 2018-02-01 04:05:00.000000000 +0100 @@ -2405,7 +2405,7 @@ ret = -EPERM; goto error; } - ret = get_unary_unsigned(&node->u.ctf_expression.right, &clock->offset_s); + ret = get_unary_signed(&node->u.ctf_expression.right, &clock->offset_s); if (ret) { fprintf(fd, "[error] %s: unexpected unary expression for clock offset_s\n", __func__); ret = -EINVAL; @@ -2417,7 +2417,7 @@ ret = -EPERM; goto error; } - ret = get_unary_unsigned(&node->u.ctf_expression.right, &clock->offset); + ret = get_unary_signed(&node->u.ctf_expression.right, &clock->offset); if (ret) { fprintf(fd, "[error] %s: unexpected unary expression for clock offset\n", __func__); ret = -EINVAL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/lttng-live/lttng-live-comm.c new/babeltrace-1.5.4/formats/lttng-live/lttng-live-comm.c --- old/babeltrace-1.5.3/formats/lttng-live/lttng-live-comm.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/lttng-live/lttng-live-comm.c 2018-02-01 04:05:00.000000000 +0100 @@ -390,7 +390,8 @@ if (!trace) { trace = g_new0(struct lttng_live_ctf_trace, 1); trace->ctf_trace_id = ctf_trace_id; - trace->streams = g_ptr_array_new(); + printf_verbose("Create trace ctf_trace_id %" PRIu64 "\n", ctf_trace_id); + BT_INIT_LIST_HEAD(&trace->stream_list); g_hash_table_insert(stream->session->ctf_traces, &trace->ctf_trace_id, trace); @@ -398,8 +399,10 @@ if (stream->metadata_flag) trace->metadata_stream = stream; + assert(!stream->in_trace); + stream->in_trace = 1; stream->ctf_trace = trace; - g_ptr_array_add(trace->streams, stream); + bt_list_add(&stream->trace_stream_node, &trace->stream_list); return ret; } @@ -506,18 +509,22 @@ ret = 0; goto end; } - printf_verbose("Waiting for %" PRIu64 " streams:\n", - ctx->session->stream_count); - ctx->session->streams = g_new0(struct lttng_live_viewer_stream, - ctx->session->stream_count); + printf_verbose("Waiting for %d streams:\n", + be32toh(rp.streams_count)); for (i = 0; i < be32toh(rp.streams_count); i++) { - ret_len = lttng_live_recv(ctx->control_sock, &stream, sizeof(stream)); + struct lttng_live_viewer_stream *lvstream; + + lvstream = g_new0(struct lttng_live_viewer_stream, 1); + ret_len = lttng_live_recv(ctx->control_sock, &stream, + sizeof(stream)); if (ret_len == 0) { fprintf(stderr, "[error] Remote side has closed connection\n"); + g_free(lvstream); goto error; } if (ret_len < 0) { perror("[error] Error receiving stream"); + g_free(lvstream); goto error; } assert(ret_len == sizeof(stream)); @@ -527,21 +534,23 @@ printf_verbose(" stream %" PRIu64 " : %s/%s\n", be64toh(stream.id), stream.path_name, stream.channel_name); - ctx->session->streams[i].id = be64toh(stream.id); - ctx->session->streams[i].session = ctx->session; + lvstream->id = be64toh(stream.id); + lvstream->session = ctx->session; - ctx->session->streams[i].mmap_size = 0; - ctx->session->streams[i].ctf_stream_id = -1ULL; + lvstream->mmap_size = 0; + lvstream->ctf_stream_id = -1ULL; if (be32toh(stream.metadata_flag)) { - ctx->session->streams[i].metadata_flag = 1; + lvstream->metadata_flag = 1; } - ret = lttng_live_ctf_trace_assign(&ctx->session->streams[i], + ret = lttng_live_ctf_trace_assign(lvstream, be64toh(stream.ctf_trace_id)); if (ret < 0) { + g_free(lvstream); goto error; } - + bt_list_add(&lvstream->session_stream_node, + &ctx->session->stream_list); } ret = 0; end: @@ -567,10 +576,11 @@ id = g_array_index(ctx->session_ids, uint64_t, i); ret = lttng_live_get_new_streams(ctx, id); printf_verbose("Asking for new streams returns %d\n", ret); + if (lttng_live_should_quit()) { + ret = -1; + goto end; + } if (ret < 0) { - if (lttng_live_should_quit()) { - goto end; - } if (ret == -LTTNG_VIEWER_NEW_STREAMS_HUP) { printf_verbose("Session %" PRIu64 " closed\n", id); @@ -593,7 +603,12 @@ nb_streams += ret; } } - ret = nb_streams; + if (ctx->session_ids->len == 0) { + /* All sessions are closed. */ + ret = -1; + } else { + ret = nb_streams; + } end: return ret; @@ -607,6 +622,11 @@ struct lttng_live_viewer_stream *metadata; char *metadata_buf = NULL; + if (!viewer_stream->ctf_trace->handle) { + printf_verbose("append_metadata: trace handle not ready yet.\n"); + return 0; + } + printf_verbose("get_next_index: new metadata needed\n"); ret = get_new_metadata(ctx, viewer_stream, &metadata_buf); if (ret < 0) { @@ -825,6 +845,9 @@ memcpy(cmd_buf, &cmd, sizeof(cmd)); memcpy(cmd_buf + sizeof(cmd), &rq, sizeof(rq)); + printf_verbose("get_metadata for trace_id: %d, ctf_trace_id: %" PRIu64 "\n", + metadata_stream->ctf_trace->trace_id, + metadata_stream->ctf_trace->ctf_trace_id); ret_len = lttng_live_send(ctx->control_sock, cmd_buf, cmd_buf_len); if (ret_len < 0) { perror("[error] Error sending get_metadata cmd and request"); @@ -943,6 +966,9 @@ if (!len_read) { (void) poll(NULL, 0, ACTIVE_POLL_DELAY); } + if (ret < 0) { + break; /* Stop on error. */ + } } while (ret > 0 || !len_read); if (babeltrace_close_memstream(metadata_buf, &size, @@ -1078,6 +1104,11 @@ viewer_stream->id = -1ULL; index->offset = EOF; ctx->session->stream_count--; + viewer_stream->in_trace = 0; + bt_list_del(&viewer_stream->trace_stream_node); + bt_list_del(&viewer_stream->session_stream_node); + g_free(viewer_stream); + *stream_id = be64toh(rp->stream_id); break; case LTTNG_VIEWER_INDEX_ERR: fprintf(stderr, "[error] get_next_index: error\n"); @@ -1192,7 +1223,8 @@ ret = handle_seek_position(index, whence, viewer_stream, pos, file_stream); if (ret != 0) { - return; + ret = -1; + goto end; } retry: @@ -1234,7 +1266,8 @@ if (!lttng_live_should_quit()) { fprintf(stderr, "[error] get_next_index failed\n"); } - return; + ret = -1; + goto end; } printf_verbose("Index received : packet_size : %" PRIu64 ", offset %" PRIu64 ", content_size %" PRIu64 @@ -1263,7 +1296,8 @@ file_stream->parent.stream_id = stream_id; viewer_stream->ctf_stream_id = stream_id; - return; + ret = 0; + goto end; } pos->packet_size = cur_index->packet_size; @@ -1276,14 +1310,30 @@ } if (cur_index->content_size == 0) { + /* Beacon packet index */ if (file_stream->parent.stream_class) { file_stream->parent.cycles_timestamp = cur_index->ts_cycles.timestamp_end; file_stream->parent.real_timestamp = ctf_get_real_timestamp( &file_stream->parent, cur_index->ts_cycles.timestamp_end); + + /* + * Duplicate the data from the previous index, because + * the one we just received is only a beacon with no + * relevant information except the timestamp_end. We + * don't need to keep this timestamp_end because we already + * updated the file_stream timestamps, so we only need + * to keep the last real index data as prev_index. That + * way, we keep the original prev timestamps and + * discarded events counter. This is the same behaviour + * as if we were reading a local trace, we would not + * have fake indexes between real indexes. + */ + memcpy(cur_index, prev_index, sizeof(struct packet_index)); } } else { + /* Real packet index */ if (file_stream->parent.stream_class) { /* Convert the timestamps and append to the real_index. */ cur_index->ts_real.timestamp_begin = ctf_get_real_timestamp( @@ -1297,6 +1347,16 @@ ctf_update_current_packet_index(&file_stream->parent, prev_index, cur_index); + /* + * We need to check if we are in trace read or called + * from packet indexing. In this last case, the + * collection is not there, so we cannot print the + * timestamps. + */ + if ((&file_stream->parent)->stream_class->trace->parent.collection) { + ctf_print_discarded_lost(stderr, &file_stream->parent); + } + file_stream->parent.cycles_timestamp = cur_index->ts_cycles.timestamp_begin; file_stream->parent.real_timestamp = @@ -1329,15 +1389,18 @@ pos->offset = EOF; if (!lttng_live_should_quit()) { fprintf(stderr, "[error] get_data_packet failed\n"); + ret = -1; + } else { + ret = 0; } - return; + goto end; } viewer_stream->data_pending = 0; read_packet_header(pos, file_stream); - + ret = 0; end: - return; + bt_packet_seek_set_error(ret); } int lttng_live_create_viewer_session(struct lttng_live_ctx *ctx) @@ -1392,10 +1455,22 @@ struct bt_context *bt_ctx = user_data; struct lttng_live_ctf_trace *trace = value; int ret; + struct lttng_live_viewer_stream *lvstream, *tmp; - ret = bt_context_remove_trace(bt_ctx, trace->trace_id); - if (ret < 0) - fprintf(stderr, "[error] removing trace from context\n"); + /* + * We don't have ownership of the live viewer stream, just + * remove them from our list. + */ + bt_list_for_each_entry_safe(lvstream, tmp, &trace->stream_list, + trace_stream_node) { + lvstream->in_trace = 0; + bt_list_del(&lvstream->trace_stream_node); + } + if (trace->in_use) { + ret = bt_context_remove_trace(bt_ctx, trace->trace_id); + if (ret < 0) + fprintf(stderr, "[error] removing trace from context\n"); + } /* remove the key/value pair from the HT. */ return 1; @@ -1405,7 +1480,7 @@ int add_one_trace(struct lttng_live_ctx *ctx, struct lttng_live_ctf_trace *trace) { - int i, ret; + int ret; struct bt_context *bt_ctx = ctx->bt_ctx; struct lttng_live_viewer_stream *stream; struct bt_mmap_stream *new_mmap_stream; @@ -1413,6 +1488,9 @@ struct bt_trace_descriptor *td; struct bt_trace_handle *handle; + printf_verbose("Add one trace ctf_trace_id: %" PRIu64 + " (metadata_stream: %p)\n", + trace->ctf_trace_id, trace->metadata_stream); /* * We don't know how many streams we will receive for a trace, so * once we are done receiving the traces, we add all the traces @@ -1423,15 +1501,20 @@ * If a trace is already in the context, we just skip this function. */ if (trace->in_use) { + printf_verbose("Trace already in use\n"); ret = 0; goto end; } + /* + * add_one_trace can be called recursively if during the + * bt_context_add_trace call we need to fetch new streams, so we need to + * prevent a recursive call to process our current trace. + */ + trace->in_use = 1; BT_INIT_LIST_HEAD(&mmap_list.head); - for (i = 0; i < trace->streams->len; i++) { - stream = g_ptr_array_index(trace->streams, i); - + bt_list_for_each_entry(stream, &trace->stream_list, trace_stream_node) { if (!stream->metadata_flag) { new_mmap_stream = zmalloc(sizeof(struct bt_mmap_stream)); new_mmap_stream->priv = (void *) stream; @@ -1453,6 +1536,7 @@ goto end_free; } + printf_verbose("Metadata stream found\n"); trace->metadata_fp = babeltrace_fmemopen(metadata_buf, stream->metadata_len, "rb"); if (!trace->metadata_fp) { @@ -1489,7 +1573,7 @@ } trace->trace_id = ret; - trace->in_use = 1; + printf_verbose("Trace now in use, id = %d\n", trace->trace_id); goto end; @@ -1499,6 +1583,56 @@ return ret; } +/* + * Make sure all the traces we know have a metadata stream or loop on + * ask_new_streams until it is done. This must be called before we call + * add_one_trace. + * + * Return 0 when all known traces have a metadata stream, a negative value + * on error. + */ +static +int check_traces_metadata(struct lttng_live_ctx *ctx) +{ + int ret; + struct lttng_live_ctf_trace *trace; + GHashTableIter it; + gpointer key; + gpointer value; + +retry: + g_hash_table_iter_init(&it, ctx->session->ctf_traces); + while (g_hash_table_iter_next(&it, &key, &value)) { + trace = (struct lttng_live_ctf_trace *) value; + printf_verbose("Check trace %" PRIu64 " metadata\n", trace->ctf_trace_id); + while (!trace->metadata_stream) { + printf_verbose("Waiting for metadata stream\n"); + if (lttng_live_should_quit()) { + ret = 0; + goto end; + } + ret = ask_new_streams(ctx); + if (ret < 0) { + goto end; + } else if (ret == 0) { + (void) poll(NULL, 0, ACTIVE_POLL_DELAY); + } else { + /* + * If ask_new_stream got streams from a trace we did not know + * about until now, we have to reinitialize the iterator. + */ + goto retry; + } + } + } + + ret = 0; + +end: + printf_verbose("End check traces metadata\n"); + return ret; +} + static int add_traces(struct lttng_live_ctx *ctx) { @@ -1507,6 +1641,17 @@ GHashTableIter it; gpointer key; gpointer value; + unsigned int nr_traces; + + printf_verbose("Begin add traces\n"); + +retry: + nr_traces = g_hash_table_size(ctx->session->ctf_traces); + + ret = check_traces_metadata(ctx); + if (ret < 0) { + goto end; + } g_hash_table_iter_init(&it, ctx->session->ctf_traces); while (g_hash_table_iter_next(&it, &key, &value)) { @@ -1515,11 +1660,21 @@ if (ret < 0) { goto end; } + /* + * If a new trace got added while we were adding the trace, the + * iterator is invalid and we have to restart. + */ + if (g_hash_table_size(ctx->session->ctf_traces) != nr_traces) { + printf_verbose("New trace(s) added during add_one_trace()\n"); + printf_verbose("JORAJ: GREP HERE\n"); + goto retry; + } } ret = 0; end: + printf_verbose("End add traces\n"); return ret; } @@ -1606,18 +1761,22 @@ ret = 0; goto end; } - printf_verbose("Waiting for %" PRIu64 " streams:\n", - ctx->session->stream_count); - ctx->session->streams = g_new0(struct lttng_live_viewer_stream, - ctx->session->stream_count); + printf_verbose("Waiting for %d streams:\n", stream_count); + for (i = 0; i < stream_count; i++) { - ret_len = lttng_live_recv(ctx->control_sock, &stream, sizeof(stream)); + struct lttng_live_viewer_stream *lvstream; + + lvstream = g_new0(struct lttng_live_viewer_stream, 1); + ret_len = lttng_live_recv(ctx->control_sock, &stream, + sizeof(stream)); if (ret_len == 0) { fprintf(stderr, "[error] Remote side has closed connection\n"); + g_free(lvstream); goto error; } if (ret_len < 0) { perror("[error] Error receiving stream"); + g_free(lvstream); goto error; } assert(ret_len == sizeof(stream)); @@ -1627,22 +1786,24 @@ printf_verbose(" stream %" PRIu64 " : %s/%s\n", be64toh(stream.id), stream.path_name, stream.channel_name); - ctx->session->streams[i].id = be64toh(stream.id); - ctx->session->streams[i].session = ctx->session; + lvstream->id = be64toh(stream.id); + lvstream->session = ctx->session; - ctx->session->streams[i].mmap_size = 0; - ctx->session->streams[i].ctf_stream_id = -1ULL; + lvstream->mmap_size = 0; + lvstream->ctf_stream_id = -1ULL; if (be32toh(stream.metadata_flag)) { - ctx->session->streams[i].metadata_flag = 1; + lvstream->metadata_flag = 1; } - ret = lttng_live_ctf_trace_assign(&ctx->session->streams[i], + ret = lttng_live_ctf_trace_assign(lvstream, be64toh(stream.ctf_trace_id)); if (ret < 0) { + g_free(lvstream); goto error; } nb_streams++; - + bt_list_add(&lvstream->session_stream_node, + &ctx->session->stream_list); } ret = nb_streams; end: @@ -1673,7 +1834,7 @@ fmt_write = bt_lookup_format(g_quark_from_static_string("text")); if (!fmt_write) { fprintf(stderr, "[error] ctf-text error\n"); - goto end; + goto end_free; } td_write = fmt_write->open_trace(NULL, O_RDWR, NULL, NULL); @@ -1725,6 +1886,7 @@ } ret = ask_new_streams(ctx); if (ret < 0) { + ret = 0; goto end_free; } if (!ctx->session->stream_count) { @@ -1742,10 +1904,10 @@ if (!iter) { if (lttng_live_should_quit()) { ret = 0; - goto end; + goto end_free; } fprintf(stderr, "[error] Iterator creation error\n"); - goto end; + goto end_free; } for (;;) { if (lttng_live_should_quit()) { @@ -1778,6 +1940,8 @@ } end_free: + g_hash_table_foreach_remove(ctx->session->ctf_traces, + del_traces, ctx->bt_ctx); bt_context_put(ctx->bt_ctx); end: if (lttng_live_should_quit()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/lttng-live/lttng-live-plugin.c new/babeltrace-1.5.4/formats/lttng-live/lttng-live-plugin.c --- old/babeltrace-1.5.3/formats/lttng-live/lttng-live-plugin.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/lttng-live/lttng-live-plugin.c 2018-02-01 04:05:00.000000000 +0100 @@ -223,6 +223,21 @@ return TRUE; } +static void free_session_streams(struct lttng_live_session *lsession) +{ + struct lttng_live_viewer_stream *lvstream, *tmp; + + bt_list_for_each_entry_safe(lvstream, tmp, &lsession->stream_list, + session_stream_node) { + /* + * The stream should not be in trace anymore. + */ + assert(!lvstream->in_trace); + bt_list_del(&lvstream->session_stream_node); + g_free(lvstream); + } +} + static int lttng_live_open_trace_read(const char *path) { int ret = 0; @@ -231,6 +246,8 @@ ctx = g_new0(struct lttng_live_ctx, 1); ctx->session = g_new0(struct lttng_live_session, 1); + BT_INIT_LIST_HEAD(&ctx->session->stream_list); + /* We need a pointer to the context from the packet_seek function. */ ctx->session->ctx = ctx; @@ -271,8 +288,8 @@ end_free: g_hash_table_destroy(ctx->session->ctf_traces); + free_session_streams(ctx->session); g_free(ctx->session); - g_free(ctx->session->streams); g_free(ctx); if (lttng_live_should_quit()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/formats/lttng-live/lttng-live.h new/babeltrace-1.5.4/formats/lttng-live/lttng-live.h --- old/babeltrace-1.5.3/formats/lttng-live/lttng-live.h 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/formats/lttng-live/lttng-live.h 2018-02-01 04:05:00.000000000 +0100 @@ -26,6 +26,7 @@ #include <stdint.h> #include <sys/param.h> +#include <babeltrace/list.h> #include "lttng-viewer-abi.h" #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 @@ -65,6 +66,9 @@ struct lttng_live_session *session; struct lttng_live_ctf_trace *ctf_trace; struct lttng_viewer_index current_index; + struct bt_list_head session_stream_node; /* Owns stream. */ + struct bt_list_head trace_stream_node; + int in_trace; char path[PATH_MAX]; }; @@ -72,14 +76,16 @@ uint64_t live_timer_interval; uint64_t stream_count; struct lttng_live_ctx *ctx; - struct lttng_live_viewer_stream *streams; + /* The session stream list owns the lttng_live_viewer_stream object. */ + struct bt_list_head stream_list; GHashTable *ctf_traces; }; struct lttng_live_ctf_trace { uint64_t ctf_trace_id; struct lttng_live_viewer_stream *metadata_stream; - GPtrArray *streams; + /* The trace has a list of streams, but it has no ownership on them. */ + struct bt_list_head stream_list; FILE *metadata_fp; struct bt_trace_handle *handle; int trace_id; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/include/Makefile.am new/babeltrace-1.5.4/include/Makefile.am --- old/babeltrace-1.5.3/include/Makefile.am 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/include/Makefile.am 2018-02-01 04:05:00.000000000 +0100 @@ -5,7 +5,8 @@ babeltrace/iterator.h \ babeltrace/trace-handle.h \ babeltrace/list.h \ - babeltrace/clock-types.h + babeltrace/clock-types.h \ + babeltrace/error.h babeltracectfinclude_HEADERS = \ babeltrace/ctf/events.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/include/Makefile.in new/babeltrace-1.5.4/include/Makefile.in --- old/babeltrace-1.5.3/include/Makefile.in 2017-08-04 19:09:05.000000000 +0200 +++ new/babeltrace-1.5.4/include/Makefile.in 2018-02-01 04:05:09.000000000 +0100 @@ -372,7 +372,8 @@ babeltrace/iterator.h \ babeltrace/trace-handle.h \ babeltrace/list.h \ - babeltrace/clock-types.h + babeltrace/clock-types.h \ + babeltrace/error.h babeltracectfinclude_HEADERS = \ babeltrace/ctf/events.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/include/babeltrace/compat/utc.h new/babeltrace-1.5.4/include/babeltrace/compat/utc.h --- old/babeltrace-1.5.3/include/babeltrace/compat/utc.h 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/include/babeltrace/compat/utc.h 2018-02-01 04:05:00.000000000 +0100 @@ -67,8 +67,8 @@ } } - /* Temporarily setting TZ to 1 for UTC */ - setenv("TZ", "", 1); + /* Temporarily setting TZ to UTC */ + setenv("TZ", "UTC", 1); tzset(); ret = mktime(tm); if (tz) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/include/babeltrace/ctf/types.h new/babeltrace-1.5.4/include/babeltrace/ctf/types.h --- old/babeltrace-1.5.3/include/babeltrace/ctf/types.h 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/include/babeltrace/ctf/types.h 2018-02-01 04:05:00.000000000 +0100 @@ -39,6 +39,7 @@ #include <stdio.h> #include <inttypes.h> #include <babeltrace/mmap-align.h> +#include <babeltrace/error.h> #define LAST_OFFSET_POISON ((int64_t) ~0ULL) @@ -223,9 +224,10 @@ } static inline -void ctf_pos_pad_packet(struct ctf_stream_pos *pos) +int ctf_pos_pad_packet(struct ctf_stream_pos *pos) { ctf_packet_seek(&pos->parent, 0, SEEK_CUR); + return bt_packet_seek_get_error(); } /* @@ -233,8 +235,10 @@ * the next packet if we are located at the end of the current packet. */ static inline -void ctf_pos_get_event(struct ctf_stream_pos *pos) +int ctf_pos_get_event(struct ctf_stream_pos *pos) { + int ret = 0; + assert(pos->offset <= pos->content_size); if (pos->offset == pos->content_size) { printf_debug("ctf_packet_seek (before call): %" PRId64 "\n", @@ -242,12 +246,15 @@ pos->packet_seek(&pos->parent, 0, SEEK_CUR); printf_debug("ctf_packet_seek (after call): %" PRId64 "\n", pos->offset); + ret = bt_packet_seek_get_error(); } + return ret; } void ctf_print_timestamp(FILE *fp, struct ctf_stream_definition *stream, uint64_t timestamp); int ctf_append_trace_metadata(struct bt_trace_descriptor *tdp, FILE *metadata_fp); +void ctf_print_discarded_lost(FILE *fp, struct ctf_stream_definition *stream); #endif /* _BABELTRACE_CTF_TYPES_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/include/babeltrace/error.h new/babeltrace-1.5.4/include/babeltrace/error.h --- old/babeltrace-1.5.3/include/babeltrace/error.h 1970-01-01 01:00:00.000000000 +0100 +++ new/babeltrace-1.5.4/include/babeltrace/error.h 2018-02-01 04:05:00.000000000 +0100 @@ -0,0 +1,54 @@ +#ifndef BABELTRACE_ERROR_H +#define BABELTRACE_ERROR_H + +/* + * BabelTrace + * + * Global error accessors. + * + * Copyright 2018 EfficiOS Inc. and Linux Foundation + * + * Author: Jérémie Galarneau <jeremie.galarn...@efficios.com> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * bt_packet_seek_get_error: get the return code of the last packet_seek use. + * + * The packet seek functions defined by the various formats don't return a + * value. An implementation that can fail to seek can set a per-thread + * packet_seek error to be checked by the caller. + * + * The error is cleared after access in order to preserve the compatibility + * with implementation that don't set an error. + */ +int bt_packet_seek_get_error(void); + +/* + * bt_packet_seek_set_error: set the return code of the last packet_seek use. + * + * This function sets the per-thread packet_seek error. A value of 0 indicates + * no error. Implementations of packet_seek are encouraged to use a negative + * value to indicate an error. + */ +void bt_packet_seek_set_error(int error); + +#endif /* BABELTRACE_ERROR_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/lib/Makefile.am new/babeltrace-1.5.4/lib/Makefile.am --- old/babeltrace-1.5.3/lib/Makefile.am 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/lib/Makefile.am 2018-02-01 04:05:00.000000000 +0100 @@ -9,7 +9,8 @@ context.c \ trace-handle.c \ trace-collection.c \ - registry.c + registry.c \ + error.c libbabeltrace_la_LDFLAGS = \ $(LT_NO_UNDEFINED) -version-info $(BABELTRACE_LIBRARY_VERSION) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/lib/Makefile.in new/babeltrace-1.5.4/lib/Makefile.in --- old/babeltrace-1.5.3/lib/Makefile.in 2017-08-04 19:09:05.000000000 +0200 +++ new/babeltrace-1.5.4/lib/Makefile.in 2018-02-01 04:05:09.000000000 +0100 @@ -147,7 +147,7 @@ $(top_builddir)/types/libbabeltrace_types.la \ $(top_builddir)/compat/libcompat.la am_libbabeltrace_la_OBJECTS = babeltrace.lo iterator.lo context.lo \ - trace-handle.lo trace-collection.lo registry.lo + trace-handle.lo trace-collection.lo registry.lo error.lo libbabeltrace_la_OBJECTS = $(am_libbabeltrace_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -453,7 +453,8 @@ context.c \ trace-handle.c \ trace-collection.c \ - registry.c + registry.c \ + error.c libbabeltrace_la_LDFLAGS = \ $(LT_NO_UNDEFINED) -version-info $(BABELTRACE_LIBRARY_VERSION) @@ -570,6 +571,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug-info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/registry.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trace-collection.Plo@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/lib/error.c new/babeltrace-1.5.4/lib/error.c --- old/babeltrace-1.5.3/lib/error.c 1970-01-01 01:00:00.000000000 +0100 +++ new/babeltrace-1.5.4/lib/error.c 2018-02-01 04:05:00.000000000 +0100 @@ -0,0 +1,45 @@ +/* + * BabelTrace + * + * Global error accessors. + * + * Copyright 2018 EfficiOS Inc. and Linux Foundation + * + * Author: Jérémie Galarneau <jeremie.galarn...@efficios.com> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <babeltrace/error.h> + +static __thread int packet_seek_error; + +int bt_packet_seek_get_error(void) +{ + int ret = packet_seek_error; + + packet_seek_error = 0; + return ret; +} + +void bt_packet_seek_set_error(int error) +{ + packet_seek_error = error; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/babeltrace-1.5.3/lib/iterator.c new/babeltrace-1.5.4/lib/iterator.c --- old/babeltrace-1.5.3/lib/iterator.c 2017-08-04 19:08:55.000000000 +0200 +++ new/babeltrace-1.5.4/lib/iterator.c 2018-02-01 04:05:00.000000000 +0100 @@ -144,6 +144,10 @@ continue; stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET); + ret = bt_packet_seek_get_error(); + if (ret < 0) { + return EOF; + } do { ret = stream_read_event(cfs); } while (cfs->parent.real_timestamp < timestamp && ret == 0); @@ -243,6 +247,10 @@ */ for (i = stream_pos->packet_index->len - 1; i >= 0; i--) { stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET); + ret = bt_packet_seek_get_error(); + if (ret < 0) { + return EOF; + } count = 0; /* read each event until we reach the end of the stream */ do {