Fix: sink.ctf.fs: remove spurious directory level when using assume-single-trace
The behavior of `sink.ctf.fs` with the `assume-single-trace=true`
parameter does not match the documentation nor the comments in the code.
The man page says:
If the assume-single-trace parameter is true, then the output trace
path to use for the single input trace is the directory specified by
the path parameter.
What I understand from this is that if you pass `path=/tmp/yo`, that
should produce the `/tmp/yo/metadata` file and the data files alongside
it.
The documentation on the `fs_sink_comp::assume_single_trace` says:
/*
* True if the component assumes that it will only write a
* single CTF trace (which can contain one or more data
* streams). This makes the component write the stream files
* directly in the output directory (`output_dir_path` above).
*/
bool assume_single_trace;
The `output_dir_path` would contain `/tmp/yo`, in the previous example,
so that confirms the previous assumption.
The actual behavior is that the sink puts the trace in an extra `trace`
directory, in `/tmp/yo/trace`.
We end up with the `trace` relative trace path (relative to the base
output directory) because `make_trace_path_rel` returns an empty string
when `assume_single_trace` is true and `sanitize_trace_path` replaces it
with `trace`.
When using `assume-single-trace=true`, we should not deal with a
relative trace path, as the trace is output directly in the base output
directory. We also don't want to run the path in
`make_unique_trace_path`, as the trace should be output in the base
directory specified by the user, not another directory. Anyway, if the
user specifies an existing directory, `sink.ctf.fs` will initially
error out with:
Single trace mode, but output path exists: output-path="/tmp/yo"
Although that's a TOCTOU bug, two babeltrace instances could both check
at the same time that the same output directory does not exist, and both
write in the same directory. That would not be good.
Change-Id: Ib2415420eabbc096a920d113863993161105e90a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/4480
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.02893 seconds and 4 git commands to generate.