Commit 20b0027c authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf list: Escape '\r' in JSON output

Events like for sapphirerapids have '\r' in the uncore descriptions. The
non-escaped versions of this fail JSON validation the the 'perf list'
test.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240410222353.1722840-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0ffc8fca
...@@ -326,6 +326,9 @@ static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, .. ...@@ -326,6 +326,9 @@ static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, ..
case '\n': case '\n':
strbuf_addstr(buf, "\\n"); strbuf_addstr(buf, "\\n");
break; break;
case '\r':
strbuf_addstr(buf, "\\r");
break;
case '\\': case '\\':
fallthrough; fallthrough;
case '\"': case '\"':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment