From: Jonathan Rajotte Date: Tue, 1 Dec 2020 17:19:53 +0000 (-0500) Subject: Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel" X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=bd6661538d573c0798439f2933474f677a857728;hp=bd6661538d573c0798439f2933474f677a857728;p=lttng-tools.git Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel" Observed issue ============== lttng-ivc observed unexpected path generated for streamed snapshot: joraj-alpa/ test-20190319-120000-20210113-110101/ snapshot-1-20210113-110102-0/ * ust/ * ust/ pid/ app-ust-2362198-20210113-110101/ channel_0 channel_1 metadata channel_2 channel_3 "ust" the domain subdir is present two-time instead off only one time. The same problem is seen for kernel snapshots. Cause ===== Based on dissection the problem was introduced by commit 5da88b0f58d7f838068037ea449ddfb25d3e85ad [1] For snapshots, the consumer output object of the snapshot output and information is fetched from the *original* consumer output. (code block around src/bin/lttng-sessiond/cmd.c:4748) The snapshot consumer output does not contains the necessary information to populate domain_subdir on copy (domain_subdir is '\0'). This would lead to a len evaluation of 1 for the consumer_path_offset in setup_channel_trace_path:70. This would end up not "skipping" the "ust" and "kernel" part of the path. Solution ======== Part of the solution is to copy the domain_subdir from the original session consumer output to the snapshot output. Still, the problem was still present since that now that the domain_subdir was not "\0", the value was suffixed to the passed session_path. In the snapshot code path, "ust/" and "kernel/" were already present in the session_path passed to setup_channel_trace_path. A quick modification at the caller level in the snapshot code path fixes the issues once and for all. Tests ======= The test suit is augmented for certain key tests to validate the complete path of a trace. Path validation is based on crude bash pattern matching. Known drawbacks ========= None References ========== [1] https://github.com/lttng/lttng-tools/commit/5da88b0f58d7f838068037ea449ddfb25d3e85ad Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Ie7cd2d5471ee3a942fa511e2f4cab09e3aa499e4 ---