From 20b0027ca1a7ee3b6811f4d67c6015483c6bb456 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Wed, 10 Apr 2024 15:23:53 -0700 Subject: [PATCH] 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: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20240410222353.1722840-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-list.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index e0fe3d178d631..5cab31231551d 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -326,6 +326,9 @@ static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, .. case '\n': strbuf_addstr(buf, "\\n"); break; + case '\r': + strbuf_addstr(buf, "\\r"); + break; case '\\': fallthrough; case '\"': -- 2.30.2