Fix: sink.ctf.fs: fix logic of make_unique_stream_file_name
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 2 Dec 2020 22:36:05 +0000 (17:36 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Dec 2020 20:52:09 +0000 (15:52 -0500)
commit1e03d33b36559cd925774ea25c627cefd43ce9ba
tree46b7402dc3f44e07783ef371d29cf916a763a4a0
parent0bbddf6c16d140f60870ccc9442b26fed6e54dc5
Fix: sink.ctf.fs: fix logic of make_unique_stream_file_name

The logic in make_unique_stream_file_name is wrong.  It tries names as
long as the candidate exists _and_ is named "metadata".  The intent here
is that we keep trying names as long as the candidate name names an
already existing file _or_ is named "metadata".  So the && should be a
||.

The impact of this bug is that if two streams have the same name,
they'll write to the same file, with troubling consequences (see bug
1279 [1]).

Add a test where `sink.ctf.fs` writes a trace with two streams with the
same name, and one stream named "metadata".

[1] https://bugs.lttng.org/issues/1279

Change-Id: Ifaa30459574229aa5e607095f65033d2caae188f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/4483
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/4492
src/plugins/ctf/fs-sink/fs-sink-stream.c
tests/Makefile.am
tests/data/plugins/sink.ctf.fs/stream-names/bt_plugin_foo.py [new file with mode: 0644]
tests/plugins/sink.ctf.fs/Makefile.am
tests/plugins/sink.ctf.fs/test_stream_names [new file with mode: 0755]
This page took 0.025631 seconds and 4 git commands to generate.