[commit: ghc] master: hp2ps: fix invalid PostScript for names with parentheses (5df92f6)

git at git.haskell.org git at git.haskell.org
Sun Jul 17 07:53:48 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5df92f6776b31b375a80865e7db1f330d929c18f/ghc

>---------------------------------------------------------------

commit 5df92f6776b31b375a80865e7db1f330d929c18f
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Jul 17 00:14:04 2016 +0200

    hp2ps: fix invalid PostScript for names with parentheses
    
    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


>---------------------------------------------------------------

5df92f6776b31b375a80865e7db1f330d929c18f
 utils/hp2ps/Key.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils/hp2ps/Key.c b/utils/hp2ps/Key.c
index 22ad106..b7742cf 100644
--- a/utils/hp2ps/Key.c
+++ b/utils/hp2ps/Key.c
@@ -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++ = '\\';
         }



More information about the ghc-commits mailing list