[Bug 289368] If $BASEDIR is undefined, then refusal to run freebsd-update is ineffective on a pkgbase system

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 08 Sep 2025 07:17:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289368

Graham Perrin <grahamperrin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://github.com/freebsd/
                   |                            |freebsd-src/blob/094a5146df
                   |                            |f465622640cd2ec40a13451a0e6
                   |                            |598/usr.sbin/freebsd-update
                   |                            |/freebsd-update.sh#L1049-L1
                   |                            |067
           Keywords|                            |needs-qa, pkgbase
            Summary|freebsd-update can          |If $BASEDIR is undefined,
                   |unexpectedly run on a       |then refusal to run
                   |pkgbase system              |freebsd-update is
                   |                            |ineffective on a pkgbase
                   |                            |system

--- Comment #1 from Graham Perrin <grahamperrin@gmail.com> ---
On releng/14.3
<https://github.com/freebsd/freebsd-src/commits/releng/14.3/usr.sbin/freebsd-update/freebsd-update.sh>,
the most recent cherry-pick was November 2024:

> freebsd-update: refuse to operate on a pkgbase system

The main branch
<https://github.com/freebsd/freebsd-src/commits/main/usr.sbin/freebsd-update/freebsd-update.sh>
has three more recent commits.


Below, I can make refusal effective by setting BASEDIR before the run of
freebsd-update.

----

Script started on Mon Sep  8 07:58:51 2025
root@pkg:~ # freebsd-update fetch

Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 14.3-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
^C

root@pkg:~ # echo $SHELL

/bin/csh
root@pkg:~ # freebsd-version -kru ; uname -aKU

14.3-RELEASE-p2
14.3-RELEASE-p2
14.3-RELEASE-p2
FreeBSD pkg 14.3-RELEASE-p2 FreeBSD 14.3-RELEASE-p2
releng/14.3-n271439-5982521fe3dd GENERIC amd64 1403000 1403000
root@pkg:~ # setenv BASEDIR /

root@pkg:~ # freebsd-update fetch

freebsd-update is incompatible with the use of packaged base.  Please see
https://wiki.freebsd.org/PkgBase for more information.
root@pkg:~ # exit

exit

Script done on Mon Sep  8 07:59:34 2025

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