[GHC] #10623: Handling of ASCII encodings introduced in D898 breaks Unicode terminal detection

GHC ghc-devs at haskell.org
Thu Jul 9 11:53:01 UTC 2015


#10623: Handling of ASCII encodings introduced in D898 breaks Unicode terminal
detection
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2-rc2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:  T8958a
 Related Tickets:  #10298, #7695     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by bgamari:

Old description:

> Phab:D898 was primarily intended to fix hangs in the event that `iconv`
> was unavailable (namely #10298 and #7695). In addition to this fix, it
> also introduced self-contained handling of ANSI terminals to allow
> compiled executables to run in minimal environments lacking iconv.
>
> However, the behavior that the patch introduced is highly suspicious.
> Specifically, it gives the user a UTF-8 encoding even if they requested
> ASCII.

New description:

 Phab:D898 was primarily intended to fix hangs in the event that `iconv`
 was unavailable (namely #10298 and #7695). In addition to this fix, it
 also introduced self-contained handling of ANSI terminals to allow
 compiled executables to run in minimal environments lacking iconv.

 However, the behavior that the patch introduced is highly suspicious.
 Specifically, it gives the user a UTF-8 encoding even if they requested
 ASCII.

 This has the potential to break quite a lot of code. At very least it
 breaks GHC's Unicode terminal detection logic, which attempts to catch an
 invalid character when encoding a pair of smart-quotes. Of course, this
 exception will never be thrown if a UTF-8 encoder is used.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10623#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list