[commit: haddock] T6018-injective-type-families, adamse-D1033, ghc-head, wip/10268, wip/10313, wip/D548-master, wip/D548-master-2, wip/T10483, wip/T8584, wip/T9840, wip/api-ann-hstylit, wip/api-ann-hstylit-1, wip/api-ann-hstylit-2, wip/api-ann-hstylit-3, wip/api-ann-hstylit-4, wip/api-ann-hstylit-5, wip/ast-prepare-annotations, wip/ast-prepare-annotations-final, wip/ast-prepare-annotations-final2, wip/ast-prepare-annotations-final3, wip/ast-prepare-annotations-final4, wip/ast-prepare-annotations-final5, wip/ast-prepare-annotations-final6, wip/orf-new, wip/orf-reboot, wip/pattern-synonyms, wip/rae, wip/trac-9744: Fix use-after-close lazy IO bug (2f639ff)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 08:31:38 UTC 2015


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

On branches: T6018-injective-type-families,adamse-D1033,ghc-head,wip/10268,wip/10313,wip/D548-master,wip/D548-master-2,wip/T10483,wip/T8584,wip/T9840,wip/api-ann-hstylit,wip/api-ann-hstylit-1,wip/api-ann-hstylit-2,wip/api-ann-hstylit-3,wip/api-ann-hstylit-4,wip/api-ann-hstylit-5,wip/ast-prepare-annotations,wip/ast-prepare-annotations-final,wip/ast-prepare-annotations-final2,wip/ast-prepare-annotations-final3,wip/ast-prepare-annotations-final4,wip/ast-prepare-annotations-final5,wip/ast-prepare-annotations-final6,wip/orf-new,wip/orf-reboot,wip/pattern-synonyms,wip/rae,wip/trac-9744
Link       : http://git.haskell.org/haddock.git/commitdiff/2f639ffe09dd24d8648363b567de2d7caa39db99

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

commit 2f639ffe09dd24d8648363b567de2d7caa39db99
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Thu Oct 9 21:38:11 2014 -0700

    Fix use-after-close lazy IO bug
    
    Make `getPrologue` force `parseParas dflags str` before returning. Without this,
    it will attempt to read from the file after it is closed, with unspecified and
    generally bad results.
    
    Signed-off-by: David Feuer <David.Feuer at gmail.com>
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


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

2f639ffe09dd24d8648363b567de2d7caa39db99
 src/Haddock.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Haddock.hs b/src/Haddock.hs
index 980926c..c0a6714 100644
--- a/src/Haddock.hs
+++ b/src/Haddock.hs
@@ -451,7 +451,7 @@ getPrologue dflags flags =
     [filename] -> withFile filename ReadMode $ \h -> do
       hSetEncoding h utf8
       str <- hGetContents h
-      return . Just $ parseParas dflags str
+      return . Just $! parseParas dflags str
     _ -> throwE "multiple -p/--prologue options"
 
 



More information about the ghc-commits mailing list