hp2ps: fix invalid PostScript for names with parentheses
authorBen Gamari <ben@smart-cactus.org>
Sat, 16 Jul 2016 22:14:04 +0000 (00:14 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sat, 16 Jul 2016 22:14:05 +0000 (00:14 +0200)
The names in the .hp files may contain un-matched opening parentheses,
so escape them.

GHC Trac: #9517

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2398

GHC Trac Issues: #9517

utils/hp2ps/Key.c

index 22ad106..b7742cf 100644 (file)
@@ -44,7 +44,8 @@ escape(char *result, const char *name)
 {
     while (*name != '\0')
     {
-        if (*name == '\\')
+        // escape parentheses too, because "name" could contain un-matched ones
+        if (*name == '\\' || *name == '(' || *name == ')')
         {
             *result++ = '\\';
         }