Add curly brackets to list of characters that gn needs to escape
Curly brackets {} needs to be escaped to avoid brace expansion
on systems using bash as the default shell.
BUG=709934
Review-Url: https://codereview.chromium.org/2809633002
Cr-Original-Commit-Position: refs/heads/master@{#466286}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7fd3f6718896969f1a5d3850a6d81f4ccf74abd3
diff --git a/escape.cc b/escape.cc
index 84928ef..685a100 100644
--- a/escape.cc
+++ b/escape.cc
@@ -27,7 +27,7 @@
// ` a b c d e f g h i j k l m n o
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
// p q r s t u v w x y z { | } ~
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0 };
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
// Append one character to the given string, escaping it for Ninja.
//
diff --git a/escape_unittest.cc b/escape_unittest.cc
index f2b2eae..fc7692d 100644
--- a/escape_unittest.cc
+++ b/escape_unittest.cc
@@ -49,6 +49,10 @@
// Some more generic shell chars.
EXPECT_EQ("a_\\;\\<\\*b", EscapeString("a_;<*b", opts, nullptr));
+
+ // Curly braces must be escaped to avoid brace expansion on systems using
+ // bash as default shell..
+ EXPECT_EQ("\\{a,b\\}\\{c,d\\}", EscapeString("{a,b}{c,d}", opts, nullptr));
}
TEST(Escape, NinjaPreformatted) {