]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/options: chomp whitespace
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 1 Jul 2025 19:37:53 +0000 (15:37 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Tue, 1 Jul 2025 19:41:05 +0000 (15:41 -0400)
If there are trailing newlines in a string (like long_desc), then the generated
C++ code is invalid (because the newline will not be escaped).

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/common/options/y2c.py

index 0b64bec58ec3a26696c1ef9bc3bba7fac9cbd62f..9f7975af3bdafd96eed352f80fd260fdace63929 100755 (executable)
@@ -19,6 +19,7 @@ def level_to_cxx(lv):
 def eval_str(v):
     if v == "":
         return v
+    v = v.strip()
     v = v.strip('"').replace('"', '\\"')
     return f'"{v}"'