[GHC] #10298: Infinite loop when shared libraries are unavailable
GHC
ghc-devs at haskell.org
Sun May 17 01:57:49 UTC 2015
#10298: Infinite loop when shared libraries are unavailable
-------------------------------------+-------------------------------------
Reporter: snoyberg | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.10.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Runtime crash | (amd64)
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by hsyl20):
I have an additional fix to propose for this bug: handle Unicode to ASCII
conversions in GHC without Iconv:
{{{
diff --git a/libraries/base/GHC/IO/Encoding.hs
b/libraries/base/GHC/IO/Encoding.hs
index 31683b4..c67f317 100644
--- a/libraries/base/GHC/IO/Encoding.hs
+++ b/libraries/base/GHC/IO/Encoding.hs
@@ -243,6 +243,7 @@ mkTextEncoding' cfm enc = case [toUpper c | c <- enc,
c /= '-'] of
"UTF32" -> return $ UTF32.mkUTF32 cfm
"UTF32LE" -> return $ UTF32.mkUTF32le cfm
"UTF32BE" -> return $ UTF32.mkUTF32be cfm
+ "ANSI_X3.41968" -> return char8 -- match "ANSI_X3.4-1968" (ASCII)
#if defined(mingw32_HOST_OS)
'C':'P':n | [(cp,"")] <- reads n -> return $
CodePage.mkCodePageEncoding cfm cp
_ -> unknownEncodingErr (enc ++ codingFailureModeSuffix cfm)
}}}
It seems that static binaries fall back to ASCII even if the current
locale is UTF-8. ASCII is identified with the string "ANSI_X3.4-1968" on
my system (Linux 4.0, glibc 2.21). Maybe we should match other possible
aliases?
I tested this patch with a single static binary in a initramfs and it
works fine now. It should fix #7695 too (single static binary in a
chrooted environment).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10298#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list