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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Dec 2020 20:08:27 +0000 (15:08 -0500)
commitd19b245bad1fcd0ac56045819f927e206088e8a5
tree76dcf9c972cbc53006aab96ac250221a727f5f05
parent72d458a311ee9b8c2cc84d8ade5754e5ea517fcb
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>
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.024542 seconds and 4 git commands to generate.