[commit: ghc] ghc-8.0: hp2ps: fix invalid PostScript for names with parentheses (11200a0)

git at git.haskell.org git at git.haskell.org
Sun Aug 7 11:59:13 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/11200a08a14751c59ee70018c5078e85abebdb2f/ghc

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

commit 11200a08a14751c59ee70018c5078e85abebdb2f
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
    
    (cherry picked from commit 5df92f6776b31b375a80865e7db1f330d929c18f)


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

11200a08a14751c59ee70018c5078e85abebdb2f
 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