[Bug 255967] ports-mgmt/pkg: pkg upgrade incorrectly reports "1 candidates"

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 18 May 2021 08:38:42 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255967

            Bug ID: 255967
           Summary: ports-mgmt/pkg: pkg upgrade incorrectly reports "1
                    candidates"
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: tux2bsd@protonmail.com

This is my first bug report but it is 100% verified, I just hope I've specified
the right pkg in the summary...

From my testing it is independent of architechture (aarch64 vs amd64) or
FreeBSD release (13 vs 12.2).  

Requires a fresh install of FreeBSD, then:

pkg update
pkg upgrade # will report:

Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%

This should be 0 candidates.  This incorrect number of candidates is the bug.

pkg install -f pkg  #This work around to get pkg behaving again.

Verification:
https://forums.freebsd.org/threads/pkg-upgrade-what-is-1-candidates-reproducible.80139/


Fresh install immediately after pkg is bootstrapped.

root@freebsd:~ # pkg update
Updating FreeBSD repository catalogue...
Fetching packagesite.txz: 100%    6 MiB 321.6kB/s    00:19    
Processing entries: 100%
FreeBSD repository update completed. 28975 packages processed.
All repositories are up to date.
root@freebsd:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (1 candidates): 100%
Processing candidates (1 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
root@freebsd:~ # date

-- 
You are receiving this mail because:
You are the assignee for the bug.