You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Backport #10827: Fix environment variable handling when running executables (#10887)
* Fix environment variable handling when running executables
This fixes a bug where environment variables were duplicated when running executables.
```
overrideEnv <- fromMaybe [] <$> getEffectiveEnvironment ([("PATH", Just newPath)] ++ envOverrides)
let shellEnv = overrideEnv ++ existingEnv
```
Since getEffectiveEnvironment already calls getEnvironment internally, if any overrides
are passed then the result is a complete environment. Appending it to
the already existing environment results in duplicated environment variables.
The fix:
* Added getFullEnvironment function to handle the common pattern correctly
* Updated code in Bench, Test/ExeV10, Test/LibV09, and Client/Run to use this function
In the future it would be good to generalise `getFullEnvironment`
further so it can also handle the `addLibraryPath` case, which modifies
an environment variable, rather than merely setting or unsetting it.
Fixes#10718
(cherry picked from commit 4375dd5)
* Add test for duplicate environment variables when invoking testsuite
Adds a simple test case that identifies and reports duplicate
environment variables in the Cabal environment.
For issue (#10718)
(cherry picked from commit 6e54b23)
---------
Co-authored-by: Matthew Pickering <[email protected]>
0 commit comments