-
Notifications
You must be signed in to change notification settings - Fork 698
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
Fix extra-prog-path propagation in the codebase. #9527
Fix extra-prog-path propagation in the codebase. #9527
Conversation
9993cbd
to
38a2d4a
Compare
It does seem I went a bit over the board. |
Ah no actually
(notice the |
And in fact
versus the new version
|
38a2d4a
to
4d6dfd6
Compare
Fixed it also for PS C:\Users\Javier\code\auxxx> cat .\app\Main.hs
module Main where
import System.Process
main :: IO ()
main = callCommand "git --version"
PS C:\Users\Javier\code\auxxx> cabal run
'git' is not recognized as an internal or external command,
operable program or batch file.
PS C:\Users\Javier\code\auxxx> C:\\Users\\Javier\\code\\cabal\\dist-newstyle\\build\\x86_64-windows\\ghc-9.6.3\\cabal-install-3.11.0.0\\x\\cabal\\build\\cabal\\cabal.exe run
...
git version 2.43.0 |
50a61e8
to
6d48309
Compare
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.
Idea looks good to me, some small nitpicking.
I am going to manually check the change later.
6d48309
to
cbcfb6b
Compare
677367f
to
5c51f82
Compare
5c51f82
to
c03caf8
Compare
I have reworked the solution a bit, in the same spirit as before but more principled. The commit message should give some guidance for the review. |
c03caf8
to
4cf508f
Compare
Great! Looks good to me. |
Each command action is its own function, so there is no better way right now to do this I think without breaking many things. So I'd rather leave it as is. |
b0a2344
to
981111c
Compare
981111c
to
eafdd0e
Compare
Extra prog paths were being handled in many different ways all thorugh the codebase. This PR introduces a unified way to look at them. Aiming for traceability, the addition of extra paths is now traced via `logExtraProgramSearchPath`. All appearances of `modifyProgramSearchPath` are replaced with `appendProgramSearchPath` which traces the added paths. `progInvokePathEnv` was only being set by GHC for some paths to executables in components and only under certain circumstances. Now every `ghcInvocation` sets the extra paths directly into `pkgInvokeEnv`. In particular this fixes PATH issues when running MinGW cabal in PowerShell, as usually for other OSes the system path contains most of the expected directories.
Similarly to CmdExec and CmdTest, get paths to all dependency binaries and add those to PATH. Unlike CmdExec, add just the explicitly required paths.
eafdd0e
to
f06195d
Compare
@mergify backport 3.10 |
✅ Backports have been created
|
Fix extra-prog-path propagation in the codebase. (backport #9527)
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by #8972 but undone by #9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes #9756 (cherry picked from commit 84c30c2)
We must consider the path to the installed build-tool before the path to existing versions of the build tool in paths such as `extra-prog-path` or in the system path. This was previously fixed by haskell#8972 but undone by haskell#9527. This also renames `appendProgramSearchPath` to `prependProgramSearchPath` to describe correctly what that function does. Fixes haskell#9756
Fixes #9519.
Fixes #8391.
This allows finding system executables in:
cabal exec
will find whatever executablecabal build
when cloningsource-repository-packages
will find gitcabal get
if invoking git (with-s
for example) will workcabal run
'ed executable inherits the pathIn particular this fixes PATH issues when running MinGW cabal in PowerShell.
Paths added are also now logged in info verbosity.
QA Notes
In a Windows system with MSYS2/MinGW installed, either system-wide or by ghcup.
Running the following in a PowerShell with previous cabal should fail:
And now it should work:
Also when you have
source-repository-package
stanzas in your cabal.project, it doesn't work:And after this PR it does:
cabal get -s
used to fail:not anymore:
The PATH printed in the verbose mode used to sometimes have
\n
interleaved, can be seen withcabal get -s ... --verbose=3
:not anymore after this change.