-
Notifications
You must be signed in to change notification settings - Fork 709
Fix PATH changes not triggering REPL reconfiguration (#2015) #10817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mpickering
wants to merge
1
commit into
master
Choose a base branch
from
wip/investigate-recomp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: PathRecomp | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
author: Test Author | ||
maintainer: [email protected] | ||
build-type: Simple | ||
cabal-version: >=1.10 | ||
|
||
library | ||
exposed-modules: Lib | ||
hs-source-dirs: src | ||
build-depends: base | ||
default-language: Haskell2010 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Distribution.Simple | ||
main = defaultMain | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Test.Cabal.Prelude | ||
import qualified Data.Map as Map | ||
import qualified Control.Monad.IO.Class as IO | ||
import System.Environment (getEnvironment) | ||
|
||
main = cabalTest $ recordMode DoNotRecord $ do | ||
-- First run cabal repl with the normal PATH | ||
env <- IO.liftIO getEnvironment | ||
let originalPath = maybe "" id (lookup "PATH" env) | ||
|
||
-- Run repl with original PATH | ||
cabalWithStdin "repl" ["lib:PathRecomp"] "" >>= assertOutputContains "module loaded" | ||
|
||
-- Now modify the PATH by prefixing with a dummy directory | ||
-- This simulates a user modifying their PATH between cabal commands | ||
let modifiedPath = "/dummy/path:" ++ originalPath | ||
withEnv [("PATH", Just modifiedPath)] $ do | ||
-- Run repl with modified PATH - this should still work | ||
r <- cabalWithStdin "repl" ["lib:PathRecomp"] "(Prelude.fmap . Prelude.fmap) (\"/dummy/path\" `Data.List.isInfixOf`) (System.Environment.lookupEnv \"PATH\")" | ||
assertOutputContains "module loaded" r | ||
assertOutputContains "Just True" r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Lib | ||
( someFunc | ||
) where | ||
|
||
someFunc :: IO () | ||
someFunc = putStrLn "someFunc" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
synopsis: Fix PATH changes not triggering REPL reconfiguration | ||
packages: cabal-install | ||
prs: #10817 | ||
issues: #2015 | ||
|
||
When modifying your PATH environment variable between Cabal commands, REPL | ||
sessions will now correctly use the updated environment. Previously, if you | ||
changed your PATH after initial configuration, Cabal would continue using the | ||
old PATH settings in REPL sessions without warning. | ||
|
||
With this fix, Cabal properly detects PATH changes and reconfigures the REPL | ||
accordingly, ensuring tools and libraries in your current PATH are available. | ||
While this may cause additional rebuilds when PATH changes, it prevents the | ||
confusing errors that could occur when your REPL environment didn't match your | ||
system configuration. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text, including the title, feels a little repetitive. I suggest dropping the first sentence in the description and make it into one paragraph:
Again, consider that it appears right after the title ("synopsis" field). And that the former third sentence basically repeated the former first one that I suggest to drop.