From c75b80bf6116d2aa6020b1f7596bf025532cb7a6 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 18 Dec 2012 11:41:03 +0100 Subject: Escape \ and " when writing .config entries for strings. --- kconfiglib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kconfiglib.py b/kconfiglib.py index d22ec75..5cb36b5 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2943,7 +2943,10 @@ class Symbol(Item, _HasVisibility): return ["# CONFIG_{0} is not set".format(self.name)] elif self.type == STRING: - return ['CONFIG_{0}="{1}"'.format(self.name, val)] + # Escape \ and " + return ['CONFIG_{0}="{1}"' + .format(self.name, + val.replace("\\", "\\\\").replace('"', '\\"'))] elif self.type == INT or self.type == HEX: return ["CONFIG_{0}={1}".format(self.name, val)] -- cgit v1.2.3