[GHC] #16318: Explicitly passing -package-env causes "Loaded package environment from .ghc.environment" message to be printed twice

#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 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ $ /opt/ghc/8.6.3/bin/ghc -package-env .ghc.environment.x86_64-linux-8.6.3 -e "putStrLn \"Hello\"" Loaded package environment from .ghc.environment.x86_64-linux-8.6.3 Loaded package environment from .ghc.environment.x86_64-linux-8.6.3 Hello }}} This is a regression from GHC 8.4.4: {{{ $ /opt/ghc/8.4.4/bin/ghc -package-env .ghc.environment.x86_64-linux-8.4.4 -e "putStrLn \"Hello\"" Loaded package environment from .ghc.environment.x86_64-linux-8.4.4 Hello }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16318 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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): Actually, the window of time in which this regression was introduced can be narrowed down even further, since this does not occur in GHC 8.6.2: {{{ $ /opt/ghc/8.6.2/bin/ghc -package-env .ghc.environment.x86_64-linux-8.6.2 -e "putStrLn \"Hello\"" Loaded package environment from .ghc.environment.x86_64-linux-8.6.2 Hello }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16318#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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
participants (1)
-
GHC