trace-cmd: Fix extracting instance in RO directory

If the extract command is run in a read-only directory like
/sys/kernel/tracing trying to extract an instance buffer, it would fail due
to trying to write one of the temp files in that directory. This is because
extract (and record) still save data for the top level instance (although
the top level instance buffers are not read). It creates temporary files to
do the creation.

Because the top level directory is not used, its instance was not
initialized with an "output file", which is used to know where to create the
temp files for. It then defaults to the local directory, which in this case
is not writable, and the extract fails.

Link: https://lore.kernel.org/20260424151531.3c9be298@gandalf.local.home
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221389
Reported-by:  Alexander Krabler <code@a.krabler.eu>
Tested-by: Alexander Krabler <code@a.krabler.eu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 file changed