[GHC] #10889: Compiled software can not read UTF-8 characters using readFile when run via Upstart

GHC ghc-devs at haskell.org
Wed Sep 16 15:43:34 UTC 2015


#10889: Compiled software can not read UTF-8 characters using readFile when run via
Upstart
-------------------------------------+-------------------------------------
              Reporter:  SiXoS       |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.2
              Keywords:              |  Operating System:  Linux
          Architecture:              |   Type of failure:  Runtime crash
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Honestly I dont know if this is a problem with Upstart or ghc.

 I'm Using Ubuntu 14

 Create a software that reads from a file containing UTF-8 characters.
 Compile the program. Running the program from the terminal works but not
 if you run it via Upstart. It will crash with the following error:
 "hGetContents: invalid argument (invalid byte sequence)"

 Minimal Example:
 Main.hs:

 {{{#!hs
 module Main where

 main :: IO ()
 main = readFile "ex.txt" >>= putStr

 }}}

 ex.txt:
 {{{
 å
 }}}

 Place ex.txt and the compiled program "Comp" in the same directory
 "/the/path/"

 /etc/init/bug-test.conf:
 {{{
 start on runlevel [2345]
 stop on runlevel [^2345]

 chdir /the/path/

 exec ./Comp
 }}}

 If you run ./Comp from the terminal it works. But if you run "sudo service
 bug-test start" and then check "/var/log/upstart/bug-test.log" you will
 see that it has crashed.

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


More information about the ghc-tickets mailing list