Re: cannot run trace-cmd split in parallel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 10 Jul 2023 06:44:53 +0000
Sharon Gabay <Sharon.Gabay@xxxxxxxxxxxx> wrote:

> I think it would be useful to have two fixes:
> - make trace-cmd create the temporary output ("tmp.0.0") using either a
> uuid, or the name of the output file itself, or maybe add some suffix to
> it. In short, avoid collisions.

And the patch pretty much does the above ;-)

> - I'm not sure why but "trace-cmd split -o /tmp/a" will actually write to
> /tmp/a.1, if possible it would be best to write to the exact name
> specified by the user.

That was partially due to the default of the output file being the same as
the input file, and the '.1' made sure that the two did not collide.

But I can modify it to do the following:

diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c
index 1daa847d9775..59df1d02b345 100644
--- a/tracecmd/trace-split.c
+++ b/tracecmd/trace-split.c
@@ -545,7 +545,7 @@ void trace_split (int argc, char **argv)
 	if (!output)
 		output = strdup(input_file);
 
-	if (!repeat) {
+	if (!repeat && strcmp(output, input_file) == 0) {
 		output = realloc(output, strlen(output) + 3);
 		strcat(output, ".1");
 	}

That is, only add the '.1' if the output file is the same as the input file.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux