-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add support for DisplayInstallWarnings #2217
Conversation
This change will probably block com callers with packages having warnings. We need to expose something in InstallOptions in Com interface |
src/AppInstallerCLICore/Argument.cpp
Outdated
@@ -97,6 +97,8 @@ namespace AppInstaller::CLI | |||
return Argument{ "wait", NoAlias, Args::Type::Wait, Resource::String::WaitArgumentDescription, ArgumentType::Flag, false }; | |||
case Args::Type::ProductCode: | |||
return Argument{ "product-code", NoAlias, Args::Type::ProductCode, Resource::String::ProductCodeArgumentDescription, ArgumentType::Standard, false }; | |||
case Args::Type::IgnoreWarnings: | |||
return Argument{ "ignore-warnings", NoAlias, Args::Type::IgnoreWarnings, Resource::String::IgnoreWarningsArgumentDescription, ArgumentType::Flag, false }; |
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.
nit: I think "ignore-install-warnings" would be more accurate, "ignore-warnings" seems too generic. Also please update the variable name to leave room for future warnings
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.
nit: I think "ignore-install-warnings" would be more accurate, "ignore-warnings" seems too generic. Also please update the variable name to leave room for future warnings
Also you'll need to expose them in each applicable command.
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.
I think this might be getting back more to the root issue that --force
(specifically for Hash Overrides and other actions with security concerns) should be changed to be less generic. As a user, I would expect that --force
would act as a general ignore warnings, especially so in this case.
I know that it would likely be a breaking change, but just throwing my thoughts here so @denelon can assess if / when it may be appropriate to make that change, given that it has implications on implementation of other features such as this one
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.
I've seen a couple of features reported with similar concerns like:
I just added it to:
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.
Breaking or not, we should change --force
per this discussion: #2112
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.
Changed to ignore-install-warnings
and expose the option in the install and upgrade commands
@@ -1349,4 +1349,10 @@ Please specify one of them using the `--source` option to proceed.</value> | |||
<data name="ShowLabelInstallationNotes" xml:space="preserve"> | |||
<value>InstallationNotes:</value> | |||
</data> | |||
<data name="IgnoreWarningsArgumentDescription" xml:space="preserve"> | |||
<value>Disables warning prompts</value> |
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.
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.
Changed to Disables install warnings
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.
🕐
Since this field is per installer level, maybe for better user experience, shall we change the installer selection logic to pick installers without warnings over warnings? |
I would say no - I wouldn't want winget to select an x86 installer for a x64 system if the x64 installer had installer warnings. Similarly, I wouldn't want the warnings to change a user scoped installation to a machine scoped installation, just because the machine scope didn't have warnings. I could see adding a setting to always suppress the warnings, but I don't think that changing the selection behavior based on a warning is a good idea, since it isn't a guarantee that the application is running when the user attempts the upgrade |
I agree, the installer selection logic actually has different levels of priority when determining which installer to pick, the priority of the InstallWarnings should always be in the lowest. Only when 2 installers have same scope, arch etc would the InstallWarnings be considered a factor. But given how rare this would be, I'm ok with not implementing anything. Just throwing some thought out. |
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.
I don't think that this feature has been though through enough. I would expect that many upgrades affect their own package, which is in line with the current message of "interfering with running applications". So the flag is added, then nearly every package prompts you?
I get that it is painful if running an installer messes with active processes, but I don't think this is the right way to deal with that.
|
||
if (displayInstallWarnings && !context.Args.Contains(Execution::Args::Type::IgnoreWarnings) && !Settings::User().Get<Settings::Setting::InstallIgnoreWarnings>()) | ||
{ | ||
bool ignoreWarning = context.Reporter.PromptForBoolResponse(Resource::String::InstallWarning); |
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.
I'm not sure what the use case is here, but I don't like prompting on a warning. At a minimum I would think that the setting should be ignore/display/prompt with the default being display.
ignore = Don't show them at all
display = Display the warning once the installer is chosen (before download) which gives an interactive user a fair amount of time to react with CTRL+C
prompt = This behavior of prompting after displaying the warnings.
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.
I agree that not prompting is better, especially knowing that WinGet is used in many autonomous install/upgrade scenarios
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.
Changed settings to take in an enum for installWarning level with ignore
, display
, and prompt
as the possible values. Changed install warning behavior as suggested
src/AppInstallerCLICore/Argument.cpp
Outdated
@@ -97,6 +97,8 @@ namespace AppInstaller::CLI | |||
return Argument{ "wait", NoAlias, Args::Type::Wait, Resource::String::WaitArgumentDescription, ArgumentType::Flag, false }; | |||
case Args::Type::ProductCode: | |||
return Argument{ "product-code", NoAlias, Args::Type::ProductCode, Resource::String::ProductCodeArgumentDescription, ArgumentType::Standard, false }; | |||
case Args::Type::IgnoreWarnings: | |||
return Argument{ "ignore-warnings", NoAlias, Args::Type::IgnoreWarnings, Resource::String::IgnoreWarningsArgumentDescription, ArgumentType::Flag, false }; |
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.
Breaking or not, we should change --force
per this discussion: #2112
@ryfu-msft this pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Resolves #1786
Changes:
--ignore-warnings
flag to allow users to override the default behavior of warning promptsTests:
Microsoft Reviewers: Open in CodeFlow