File tree 7 files changed +58
-0
lines changed
cabal-install/src/Distribution/Client
cabal-testsuite/PackageTests/PathRecomp 7 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -2334,6 +2334,7 @@ elaborateInstallPlan
2334
2334
)
2335
2335
(perPkgOptionMapMappend pkgid packageConfigProgramArgs)
2336
2336
elabProgramPathExtra = perPkgOptionNubList pkgid packageConfigProgramPathExtra
2337
+ elabConfiguredPrograms = configuredPrograms compilerprogdb
2337
2338
elabConfigureScriptArgs = perPkgOptionList pkgid packageConfigConfigureArgs
2338
2339
elabExtraLibDirs = perPkgOptionList pkgid packageConfigExtraLibDirs
2339
2340
elabExtraLibDirsStatic = perPkgOptionList pkgid packageConfigExtraLibDirsStatic
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage
274
274
, elabProgramPaths :: Map String FilePath
275
275
, elabProgramArgs :: Map String [String ]
276
276
, elabProgramPathExtra :: [FilePath ]
277
+ , elabConfiguredPrograms :: [ConfiguredProgram ]
277
278
, elabConfigureScriptArgs :: [String ]
278
279
, elabExtraLibDirs :: [FilePath ]
279
280
, elabExtraLibDirsStatic :: [FilePath ]
Original file line number Diff line number Diff line change
1
+ name : PathRecomp
2
+ version : 0.1.0.0
3
+ license : BSD3
4
+ author : Test Author
5
+ maintainer : test@example.com
6
+ build-type : Simple
7
+ cabal-version : >= 1.10
8
+
9
+ library
10
+ exposed-modules : Lib
11
+ hs-source-dirs : src
12
+ build-depends : base
13
+ default-language : Haskell2010
Original file line number Diff line number Diff line change
1
+ import Distribution.Simple
2
+ main = defaultMain
3
+
Original file line number Diff line number Diff line change
1
+ import Test.Cabal.Prelude
2
+ import qualified Data.Map as Map
3
+ import qualified Control.Monad.IO.Class as IO
4
+ import System.Environment (getEnvironment )
5
+
6
+ main = cabalTest $ recordMode DoNotRecord $ do
7
+ -- First run cabal repl with the normal PATH
8
+ env <- IO. liftIO getEnvironment
9
+ let originalPath = maybe " " id (lookup " PATH" env)
10
+
11
+ -- Run repl with original PATH
12
+ cabalWithStdin " repl" [" lib:PathRecomp" ] " " >>= assertOutputContains " module loaded"
13
+
14
+ -- Now modify the PATH by prefixing with a dummy directory
15
+ -- This simulates a user modifying their PATH between cabal commands
16
+ let modifiedPath = " /dummy/path:" ++ originalPath
17
+ withEnv [(" PATH" , Just modifiedPath)] $ do
18
+ -- Run repl with modified PATH - this should still work
19
+ r <- cabalWithStdin " repl" [" lib:PathRecomp" ] " (Prelude.fmap . Prelude.fmap) (\" /dummy/path\" `Data.List.isInfixOf`) (System.Environment.lookupEnv \" PATH\" )"
20
+ assertOutputContains " module loaded" r
21
+ assertOutputContains " Just True" r
Original file line number Diff line number Diff line change
1
+ module Lib
2
+ ( someFunc
3
+ ) where
4
+
5
+ someFunc :: IO ()
6
+ someFunc = putStrLn " someFunc"
7
+
Original file line number Diff line number Diff line change
1
+ synopsis: Fix PATH changes not triggering REPL reconfiguration
2
+ packages: cabal-install
3
+ prs: #10817
4
+ issues: #2015
5
+
6
+ Previously, if you changed your PATH after initial configuration, Cabal would
7
+ continue using the old PATH settings in REPL sessions without warning.
8
+ With this fix, Cabal properly detects PATH changes and reconfigures the REPL
9
+ accordingly, ensuring tools and libraries in your current PATH are available.
10
+ While this may cause additional rebuilds when PATH changes, it prevents the
11
+ confusing errors that could occur when your REPL environment didn't match your
12
+ system configuration.
You can’t perform that action at this time.
0 commit comments