Skip to content
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

Remove IsAdmin() environment variable override #2229

Merged
merged 20 commits into from Nov 9, 2022

Conversation

mitchell-as
Copy link
Contributor

@mitchell-as mitchell-as commented Nov 8, 2022

BugDX-1329 IsAdmin detection broken on CI

Runtimes are not installed to the admin %PATH% even if the user has admin privileges (which is the case on CI), so when uninstalling the runtime, the user scope needs to be used. Previously, the environment variable would override IsAdmin() to return false on CI (and thus uninstall with user scope despite having admin privileges).

@github-actions github-actions bot changed the base branch from version/0-36-0-RC1 to version/0-36-0-RC1 November 8, 2022 17:05
@mitchell-as mitchell-as changed the title Added unit test for IsAdmin(). Fix integration test to handle IsAdmin() being true on CI but false on developer machines Nov 8, 2022
@mitchell-as mitchell-as changed the title Fix integration test to handle IsAdmin() being true on CI but false on developer machines Remove IsAdmin() environment variable override Nov 8, 2022
@mitchell-as mitchell-as marked this pull request as ready for review November 8, 2022 22:25
Comment on lines 217 to 218
// Note: on Windows, runtimes are not installed to the Admin %PATH%, even if the user has admin
// privileges, so call CleanUserEnv with user scope.
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't sound right to me. We pass isAdmin to WriteUserEnv(), and it's respected there.

If CleanUserEnv() doesn't handle this input the same as WriteUserEnv() then we should address that head-on. The current change feels like we're working around the issue from the consuming code, which is error-prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After investigation, it was a bug in ConfigureAvailableShells. Thanks for suggesting something was amiss.

@mitchell-as
Copy link
Contributor Author

I checked the other calls to ConfigureAvailableShells in our code-base, and they look okay. Most use true for user-scope.

Copy link
Member

@Naatan Naatan left a comment

Choose a reason for hiding this comment

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

Nice catch!

@mitchell-as mitchell-as merged commit ac1161d into version/0-36-0-RC1 Nov 9, 2022
@mitchell-as mitchell-as deleted the mitchell/dx-1329 branch November 9, 2022 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants