]> git.apps.os.sepia.ceph.com Git - ceph.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>
Wed, 16 Jul 2025 17:18:26 +0000 (13:18 -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>
(cherry picked from commit 73792b78b4b520bcbfac254528f79a80b4d331c5)

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}"'