From 75f582c9f6356c0d7d5a443451e1d1cd4a870c92 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 30 Dec 2016 18:14:19 -0400 Subject: work around ghc segfault hSetEncoding of a closed handle segfaults. https://ghc.haskell.org/trac/ghc/ticket/7161 3b9d9a267b7c9247d36d9b622e1b836724ca5fb0 introduced the crash. In particular, stdin may get closed (by eg, getContents) and then trying to set its encoding will crash. We didn't need to adjust stdin's encoding anyway, but only stderr, to work around https://github.com/yesodweb/persistent/issues/474 Thanks to Mesar Hameed for assistance related to reproducing this bug. --- Database/Handle.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Database') diff --git a/Database/Handle.hs b/Database/Handle.hs index 9071cd538..d84ce5b62 100644 --- a/Database/Handle.hs +++ b/Database/Handle.hs @@ -69,7 +69,7 @@ openDb db tablename = do worker <- async (workerThread (T.pack db) tablename jobs) -- work around https://github.com/yesodweb/persistent/issues/474 - liftIO useFileSystemEncoding + liftIO $ fileEncoding stderr return $ DbHandle worker jobs -- cgit v1.2.3