[Bug 285490] pkg upgrade unexpectedly installs uninstalled, non-dependency package

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 17 Mar 2025 20:52:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285490

            Bug ID: 285490
           Summary: pkg upgrade unexpectedly installs uninstalled,
                    non-dependency package
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: alan@anarchycorp.com

`pkg-upgrade(8)` says:  "pkg upgrade will not install new packages, except as
required to fulfil dependencies of the packages listed on the command line." 
It used to be the case that running `pkg upgrade` for a package that was not
installed would fail with an error.

This seems to not match current reality:


```% pkg info pv
pkg: No package(s) matching pv
% sudo pkg upgrade pv
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        pv: 1.9.15

Number of packages to be installed: 1

95 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pv-1.9.15.pkg: 100%   95 KiB  97.7kB/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Installing pv-1.9.15...
[1/1] Extracting pv-1.9.15: 100%```


What is expected is that `pkg upgrade` will fail, as the package `pv` is NOT
installed and NOT a dependency being installed.

It looks to me like the documentation does not match how the software behaves,
so one or the other should change.  (My preference is that it behave as the
documentation currently says it should, i.e., `pkg upgrade` should never
install a brand new package.  That's what `pkg install` is for.)

This is tested on 14.2-RELEASE with pkg 1.21.3.

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