winget uninstall leaves tracking catalog rows when the package was correlated through the tracking catalog

Đang mở
#6,657 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
69/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
cli, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Command-Uninstall
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):

  • RecordUninstall seeds UninstallCorrelatedSources with GetInstalledVersion(package) first (UninstallFlow.cpp#L442-L463).
  • For a tracking-correlated package, that installed version is a CompositeInstalledVersion. Its GetSource() returns the tracking (remote) source (CompositeSource.cpp#L313-L322), but its GetProperty(Id) returns the base installed version's id, i.e. the ARP-derived id such as ARP\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::RecordUninstall looks up the ARP-derived id, matches nothing and removes nothing (PackageTrackingCatalog.cpp#L292-L309).
Steps to reproduce
  1. Start with tracking-catalog rows for a package <Id> (source winget) whose recorded product codes include a plain ARP key name <Key>, and no ARP entry named <Key>. Seen with qup1010.FilePilot: its rows for 1.0.5 and 1.0.7 record product code filepilot (from the ProductCode collision in microsoft/winget-pkgs#448131).
  2. Create a per-user ARP entry HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\<Key> with DisplayName, Publisher, DisplayVersion, and UninstallString = QuietUninstallString = cmd /c reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\<Key>" /f.
  3. winget list --id <Id> --exact shows the entry as <Id>.
  4. winget uninstall --id <Id> --exact --source winget --silent
  5. Check a copy of %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db for 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
Ngôn ngữ chính
C++
Star
26.6k
Fork
1.8k
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
41

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/winget-cli

Tất cả issue của microsoft/winget-cli

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.