[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:26:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289368

Dave Cottlehuber <dch@freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|bugs@FreeBSD.org            |dch@freebsd.org
             Status|New                         |Open
                 CC|                            |dch@freebsd.org

--- Comment #2 from Dave Cottlehuber <dch@freebsd.org> ---
Reading the 14.3 code I can't see a path that gets you to this point. 15.0 code
is
similar, but not exactly the same.

Next time if you can repro, run it via `sh -x freebsd-update ...` which will
show
the shell script execution steps.


### 14.3-RELEASE branch

check_pkgbase()
{
        # Packaged base requires that pkg is bootstrapped.
        if ! pkg -c ${BASEDIR} -N >/dev/null 2>/dev/null; then
                return
        fi
        # uname(1) is used by pkg to determine ABI, so it should exist.
        # If it comes from a package then this system uses packaged base.
        if ! pkg -c ${BASEDIR} which /usr/bin/uname >/dev/null; then
                return
        fi
        cat <<EOF
freebsd-update is incompatible with the use of packaged base.  Please see
https://wiki.freebsd.org/PkgBase for more information.
EOF
        exit 1
}

...

check_pkgbase

get_params $@
for COMMAND in ${COMMANDS}; do
        cmd_${COMMAND}
done

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