Don't set the MSYS env var globally#1329
Merged
Phantsure merged 1 commit intoactions:mainfrom Feb 8, 2023
Merged
Conversation
Contributor
Author
|
I don't have much experience with typescript, feedback welcome. The process.env cast ist needed since exec() is too strict to take process.env. I couldn't find any code setting env vars elsewhere. |
e0f8c81 to
98d6336
Compare
Phantsure
reviewed
Feb 2, 2023
| await exec(command, undefined, {cwd}) | ||
| await exec(command, undefined, { | ||
| cwd, | ||
| env: {...(process.env as object), MSYS: 'winsymlinks:nativestrict'} |
Phantsure
reviewed
Feb 2, 2023
Phantsure
approved these changes
Feb 2, 2023
Contributor
Phantsure
left a comment
There was a problem hiding this comment.
Looks good. But please take care of tests. http test is flaky so might need to run multiple times. Can ignore audit one
b2d865f introduced a call to exportVariable() to export the MSYS env var, which configures the symlink strategy for MSYS2/cygwin binaries it calls. By setting the env var globally, this also changes the behaviour of other MSYS2 using tools in a CI job, and also overrides MSYS configuration set by the user, which I think was not intended. To avoid this leakage set the MSYS env var only for the commands which @actions/cache calls. Fixes actions#1312
98d6336 to
e28808d
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
b2d865f introduced a call to exportVariable() to export the MSYS env var, which configures the symlink strategy for MSYS2/cygwin binaries it calls.
By setting the env var globally, this also changes the behaviour of other MSYS2 using tools in a CI job, and also overrides MSYS configuration set by the user, which I think was not intended.
To avoid this leakage set the MSYS env var only for the commands which @actions/cache calls.
Fixes #1312