[GHC] #8601: runghc from standard input and --ghc-args

#8601: runghc from standard input and --ghc-args ------------------------------------+------------------------------------- Reporter: wuzzeb | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- I am trying to use runghc with a cabal sandbox, and it works when the haskell code is in a file like follows: {{{ runghc -- -package-db --ghc-arg=.cabal-sandbox/i386-linux- ghc-7.6.3-packages.conf.d somefile.hs }}} But if I try and load the script from standard input (actually I am trying to run a GHC script from a bash script using "runghc << EOF" but it is easier to see if you just run from the console) {{{ runghc -- -package-db --ghc-arg=.cabal-sandbox/i386-linux- ghc-7.6.3-packages.conf.d < somefile.hs }}} you get an error {{{ .cabal-sandbox/i386-linux-ghc-7.6.3-packages.conf.d/:1:57: Not in scope: `main' Perhaps you meant `min' (imported from Prelude) }}} Looking at the utils/runghc/runghc.hs source file, what happens is inside the doIt function. The first thing the doIt function does is call getGhcArgs which strips the --ghc-args. Then it checks the args and sees there is no file, so falls into the case where it reads standard input, creates a temp file, and then recalls doIt. Here is the problem, because the "--ghc-arg" string has already been stripped so the second call to doIt is where the error occurs. With that, I can actually get it to work with the following :) {{{ runghc -- -package-db --ghc-arg=--ghc-arg=.cabal-sandbox/i386-linux- ghc-7.6.3-packages.conf.d < somefile.hs }}} By passing --ghc-arg= twice, it is stripped once the first time doIt is called and once the second time and GHC gets the correct args :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8601 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8601: runghc from standard input and --ghc-args -------------------------------------+------------------------------------ Reporter: wuzzeb | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by wuzzeb): * status: new => patch Comment: I fixed the bug in the attached patch. I also kept around the ability to use --ghc-arg=--ghc-arg= as a prefix for backwards compatibility, although I have no strong feelings so if you want to take it out that is fine. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8601#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8601: runghc from standard input and --ghc-args
-------------------------------------+------------------------------------
Reporter: wuzzeb | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8601: runghc from standard input and --ghc-args
-------------------------------------+------------------------------------
Reporter: wuzzeb | Owner:
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Austin Seipp

#8601: runghc from standard input and --ghc-args -------------------------------------+------------------------------------ Reporter: wuzzeb | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: Merged (with a fixed test.) Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8601#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC