-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
None
-
3
-
9223372036854775807
yml_log_sub_test_end() in lustre/tests/yaml.sh writes a subtest's failure message into results.yml with shell quoting placed inside a YAML double-quoted scalar:
printf ' error: "%q"\n' "$*"
%q quotes for bash; the surrounding "..." is a YAML double-quoted scalar, where the only legal escapes are the ones YAML defines. The two disagree, so a failure message can either break the file or be recorded wrong.
Symptom 1: the file will not parse
An apostrophe in the message emits \', which is not a YAML escape:
error: "Health\ hasn\'t\ recovered"
Any conformant parser rejects the whole document, not just that scalar:
yaml.scanner.ScannerError: while scanning a double-quoted scalar found unknown escape character "'"
So the run reports nothing at all. Note this is reachable only from a subtest that failed — the error field is empty for a pass — so it fires exactly when the report is wanted. "Health hasn't recovered" is a real message from wait_recovery_complete(); "can't open ..." messages hit it too.
Symptom 2: the message is recorded wrong
A message holding a newline or tab gets bash ANSI-C quoting instead. That parses, and the recorded value silently keeps the literal wrapper:
in: "line one\nline two\ttabbed" out: error: "$'line one\nline two\ttabbed'" parsed: $'line one\nline two\ttabbed'
Fix
Write a single-quoted YAML scalar. It takes no backslash escapes at all, so '' is the only sequence needing care and the message cannot introduce syntax. Fold newlines and tabs to spaces first, to keep the scalar on one line.
Messages containing no such character are unaffected in value: %q wrote "Out\ of\ memory", which decoded to the same string the single-quoted form now carries directly.
Verification
Driving the real function over nine messages and parsing each result: the old format broke or corrupted 5 of 9; the new format is correct on 9 of 9 — apostrophes, doubled apostrophes, embedded double quotes, $ & % ; < >, globs, brackets, trailing backslash, and multiline.
Impact
Any consumer of results.yml — Maloo, ltvm test, or a hand-rolled parser — loses a whole run's results whenever a failure message contains an apostrophe. A raw control character in a message (for example an escape sequence) is still not handled and is out of scope here.