winget uninstall leaves tracking catalog rows when the package was correlated through the tracking catalog
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 69/100
Research direction
Start with RecordUninstall in src/AppInstallerCLICore/Workflows/UninstallFlow.cpp and trace how the correlated installed version’s ID and source are passed to PackageTrackingCatalog::RecordUninstall in src/AppInstallerRepositoryCore/PackageTrackingCatalog.cpp. Read the linked CompositeSource.cpp methods to understand the ID/source behavior, then find or add coverage for the tracking-correlated uninstall case. Done when uninstall removes the package’s rows from installed.db, preventing later ARP entries with the same product code from being correlated to it.
Written by the indexing model from the issue text.
Description
Relevant area(s)
WinGet CLI
Relevant command(s)
winget uninstall
Brief description of your issue
When the installed (ARP) entry was correlated to the available package through the source's tracking catalog, winget uninstall reports success but leaves that package's rows in the tracking catalog (installed.db). Any later ARP entry with the same product code is then correlated to the old package again.
From the source (v1.29.380; the same code is on master today):
RecordUninstallseedsUninstallCorrelatedSourceswithGetInstalledVersion(package)first (UninstallFlow.cpp#L442-L463).- For a tracking-correlated package, that installed version is a
CompositeInstalledVersion. ItsGetSource()returns the tracking (remote) source (CompositeSource.cpp#L313-L322), but itsGetProperty(Id)returns the base installed version's id, i.e. the ARP-derived id such asARP\User\X64\<Key>(CompositeSource.cpp#L292-L301). - So the first item is {ARP-derived id, winget source}. The available package from that same source is then skipped by the same-source check (UninstallFlow.cpp#L39-L61), and
PackageTrackingCatalog::RecordUninstalllooks up the ARP-derived id, matches nothing and removes nothing (PackageTrackingCatalog.cpp#L292-L309).
Steps to reproduce
- Start with tracking-catalog rows for a package
<Id>(sourcewinget) whose recorded product codes include a plain ARP key name<Key>, and no ARP entry named<Key>. Seen withqup1010.FilePilot: its rows for 1.0.5 and 1.0.7 record product codefilepilot(from the ProductCode collision in microsoft/winget-pkgs#448131). - Create a per-user ARP entry
HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\<Key>withDisplayName,Publisher,DisplayVersion, andUninstallString=QuietUninstallString=cmd /c reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\<Key>" /f. winget list --id <Id> --exactshows the entry as<Id>.winget uninstall --id <Id> --exact --source winget --silent- Check a copy of
%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.dbfor manifest rows of<Id>.
Expected behavior
<Id>'s rows are removed from the tracking catalog, so a later ARP entry with the same product code is no longer correlated to <Id>.
Actual behavior
Successfully uninstalled (exit code 0). The log shows the uninstall string ran, and the ARP entry is gone. All of <Id>'s rows are still in installed.db, which the uninstall did not write to. When another product later creates an ARP entry with the same key name, winget list --id <Id> --exact again shows it as <Id> with an upgrade available.
I have only verified this case. Reading the code, any uninstall where the installed version was correlated through the tracking catalog would leave its rows behind.
Environment
Windows Package Manager v1.29.380
Windows: Windows.Desktop v10.0.26300.9818
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.29.380.0
- Dominant language
- C++
- Stars
- 26.6k
- Forks
- 1.8k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 41
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/winget-cli
-
Issue-Docs Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/winget-cli#6692 ·
Maintainers usually reply within 2 days
-
Issue-Docs Possible-Duplicate
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/winget-cli#6493 · 1 comment ·
Maintainers usually reply within 2 days
-
Issue-Feature
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/winget-cli#6427 ·
Maintainers usually reply within 2 days
-
Issue-Docs msstore
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/winget-cli#6331 · 1 comment ·
Maintainers usually reply within 2 days
-
Command-Source Issue-Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/winget-cli#6148 ·
Maintainers usually reply within 2 days
All issues in microsoft/winget-cli
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
distante/esphome-components#50 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
feat
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day