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

winget source update returns success (0) when it fails #2679

Open
o-l-a-v opened this issue Nov 8, 2022 · 1 comment
Open

winget source update returns success (0) when it fails #2679

o-l-a-v opened this issue Nov 8, 2022 · 1 comment
Labels
Command-Source Issue related to WinGet Source Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@o-l-a-v
Copy link

o-l-a-v commented Nov 8, 2022

Brief description of your issue

The CDN being (at least partially) broken (#2666) seems like an unhandled exception in winget-cli, as it returns success / %errorlevel 0, no?

Following running in CMD as admin should not return success IMO.

C:\Windows\system32>winget source reset --force && winget source update && echo %errorlevel%
Resetting all sources...Done
Updating all sources...
Updating source: msstore...
Done
Updating source: winget...
Cancelled
0

C:\Windows\system32>

Steps to reproduce

Change DNS to replicate CDN being down?

Expected behavior

If sources can't in fact be updated, it should return an error.

Actual behavior

Says updating sources failed, but exit code 0 = success.

Environment

Windows Package Manager v1.3.2691
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.2130
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2691.0
@ghost ghost added the Needs-Triage Issue need to be triaged label Nov 8, 2022
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Nov 8, 2022
@JohnMcPMS
Copy link
Member

This code is assuming that update never fails, and that any "failure" must surely be the user cancelling the update. Whoever wrote that is still using some sort of default user icon with blocky purple... you know what, doesn't matter who wrote it.

if (!context.Reporter.ExecuteWithProgress(updateFunction).empty())
{
context.Reporter.Info() << Resource::String::Cancelled << std::endl;
}

We can at least return E_ABORT if we think it was cancelled. The real fix would be to actually return the error out of the update attempt so that we can decide between cancellation and error states, even if we always return some generic error like SOURCE_UPDATE_FAILED.

@denelon denelon added this to the v1.5-Client milestone Feb 14, 2023
@denelon denelon modified the milestones: v1.5-Client, v.Next-Client Apr 18, 2023
@denelon denelon added the Command-Source Issue related to WinGet Source label Jun 10, 2023
@denelon denelon removed this from the v.Next-Client milestone Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-Source Issue related to WinGet Source Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

3 participants