[GHC] #16318: Explicitly passing -package-env causes "Loaded package environment from .ghc.environment" message to be printed twice
GHC
ghc-devs at haskell.org
Mon Mar 4 13:46:30 UTC 2019
#16318: Explicitly passing -package-env causes "Loaded package environment from
.ghc.environment" message to be printed twice
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 8.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
I'm reasonably confident that commit
e67bebbf735db498c2cbf191d1878644ca5ed5cc (`Load plugins in interactive
session`) is the culprit:
{{{#!diff
-ghciUI :: [(FilePath, Maybe Phase)] -> Maybe [String] -> Ghc ()
+ghciUI :: HscEnv -> DynFlags -> [(FilePath, Maybe Phase)] -> Maybe
[String]
+ -> Ghc ()
#if !defined(GHCI)
-ghciUI _ _ = throwGhcException (CmdLineError "not built for interactive
use")
+ghciUI _ _ _ _ =
+ throwGhcException (CmdLineError "not built for interactive use")
#else
-ghciUI = interactiveUI defaultGhciSettings
+ghciUI hsc_env dflags0 srcs maybe_expr = do
+ dflags1 <- liftIO (initializePlugins hsc_env dflags0)
+ _ <- GHC.setSessionDynFlags dflags1
+ interactiveUI defaultGhciSettings srcs maybe_expr
#endif
}}}
This inserts a call to `setSessionDynFlags`, which transitively invokes
`initPackages`, which is the function that logs the "`Loaded package
environment from ...`" message. But if you look at the source code for
`interactiveUI`, you'll see that it invokes `setProgramDynFlags`, which
//itself// transitively invokes `initPackages`!
It seems like we might want to decouple the action of logging package
environments from `initPackages`. Thoughts, hvr?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16318#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list