Skip to content

Don't set the MSYS env var globally#1329

Merged
Phantsure merged 1 commit intoactions:mainfrom
lazka:dont-set-msys-globally
Feb 8, 2023
Merged

Don't set the MSYS env var globally#1329
Phantsure merged 1 commit intoactions:mainfrom
lazka:dont-set-msys-globally

Conversation

@lazka
Copy link
Contributor

@lazka lazka commented Jan 29, 2023

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

@lazka
Copy link
Contributor Author

lazka commented Jan 29, 2023

@Phantsure ^

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.

@lazka lazka marked this pull request as ready for review January 29, 2023 09:05
@lazka lazka requested a review from a team as a code owner January 29, 2023 09:05
@lazka lazka force-pushed the dont-set-msys-globally branch 2 times, most recently from e0f8c81 to 98d6336 Compare February 2, 2023 08:22
await exec(command, undefined, {cwd})
await exec(command, undefined, {
cwd,
env: {...(process.env as object), MSYS: 'winsymlinks:nativestrict'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

Copy link
Contributor

@Phantsure Phantsure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cache: Sets global MSYS env var, interfering with MSYS2 on Windows runners

2 participants