From 264c96fcd3f1eb9983b16a223afbc7d24e72ff29 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Tue, 12 Dec 2023 13:05:22 -0500 Subject: [PATCH] LU-17358 lprocfs: make job_stats job_id valid yaml Fix quoting job_id to account for leading '@' being reserved. Test-Parameters: trivial Signed-off-by: Nathaniel Clark Change-Id: Ifce3edc9b636db2f059ab9960488972a152d2e7a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53424 Reviewed-by: Andreas Dilger Reviewed-by: Feng Lei Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/obdclass/lprocfs_jobstats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index 2d40d14..c2d27e2 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -519,6 +519,9 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v) quote = "\""; } } + /* '@' is reserved in YAML, so it cannot start a bare string. */ + if (escaped[0] == '@') + quote = "\""; seq_printf(p, "- %-16s %s%*s%s\n", "job_id:", quote, joblen, escaped, quote); -- 1.8.3.1