From nobody Tue Nov 12 13:41:24 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xnnd03HcPz5cYRl; Tue, 12 Nov 2024 13:41:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xnnd02rKsz4Gfx; Tue, 12 Nov 2024 13:41:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731418884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8FiGcLYYg5rNMjIX+MxIRudp7CQ1zTY/dQpSC4X/2q0=; b=Owgta4Yg4BisktAy7+VDt/0m44loJRD+UU8lhm0UidwSSpXQ5zE8cYBlwWiqpNd2Rb72zL OK/AokdQdptH9THj+lvaxsO0aFRJfgMVS2vRU0d5rrMBhskxs+6RkCy8tgvaIYKHNvEIZl 5VDDqkX8X2mfvPmBH80vcWHEAefyKyyqUNVYvZKm2HHuUTuCtkt51/90X3SkNLE4dhLCVl LtbkWqjikRb1lvW1vb3S1iDukrOHwoMsv0Nyk3oCh37tXoAJ2NFa0X4dKt1jfjkhQPEkqM 8nbHTz/UeTEy45S3znisVMsxxBg9XrUvPj5m9FdV5TDq7YNPHjxda0UJ+w+uRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731418884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8FiGcLYYg5rNMjIX+MxIRudp7CQ1zTY/dQpSC4X/2q0=; b=AGE7E8G433G9y9h7yl0dZNySHW/vqPo9Z1nVd25pKAgmSMwpSA1DGAqPj49l8D6RgHdKOl nqOuH3RoHkhFjgIvEORos+4vxg7tdzGpJjztSovgtupez6fwIVcV7o2f45NGTh2mlq8s6y iQO/JxTeVRhtw/vneRIkg8dN8qEulwWHZh+Zn62MT9s+O/T5uYC9C/kx5uxdPEdR+gzgeC eJgfwKwkLz6+0jT7bSOlBef732Lb4h/RkgNreHXCfrqnjcyOB9DxPxx425myqzJ75Fe2Bg DSTvCzowqI+p4nrOHs7ExQ928u0u9qB26ParaAh9DGVGw0BcvtgmiQ8oF7WZFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731418884; a=rsa-sha256; cv=none; b=N9D0Jx2Avt+lYPgmnzOEbLPQSyXaV1CPbr+64mlFKACPFWFU4h0YzqQ0fcN+Qk1ACCnYt2 PMw1wDVgKmWlMDov9wtWUgNoWFuQ1fZXNspiMGnz9ejE1H8tKIBjHLFVIf2sLPXYnvP+kl PulEkKV04jEM+kwVElaWBck9W0CIwwhsQQYiyFf5FuQxem4oUxlQ55EVeyeTgLzl2YhgXc p8QT8gxwBjfcqMHkyrvaZP47MKpMPMRvAV1Hjo/Qe3iI6BwgJoYAjA8WC+rKxGg0v3ir+d LkwfxDaj+6JrLbRxaEiOTNtrruZZIKjwkwXHwNTrQA8dGQT1u8X541GHlr8tUQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xnnd028dHz1Bcb; Tue, 12 Nov 2024 13:41:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ACDfOp2017728; Tue, 12 Nov 2024 13:41:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ACDfO6a017725; Tue, 12 Nov 2024 13:41:24 GMT (envelope-from git) Date: Tue, 12 Nov 2024 13:41:24 GMT Message-Id: <202411121341.4ACDfO6a017725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 094a5146dff4 - stable/14 - freebsd-update: refuse to operate on a pkgbase system List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 094a5146dff465622640cd2ec40a13451a0e6598 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=094a5146dff465622640cd2ec40a13451a0e6598 commit 094a5146dff465622640cd2ec40a13451a0e6598 Author: Ed Maste AuthorDate: 2024-10-30 19:15:13 +0000 Commit: Ed Maste CommitDate: 2024-11-12 13:40:05 +0000 freebsd-update: refuse to operate on a pkgbase system FreeBSD-update is not compatible with packaged base. PR: 282252 Reviewed by: bapt, markj (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47341 (cherry picked from commit cf1aba2857c1ec59c9a34d363cb18a61ffa34a10) freebsd-update: improve pkgbase check The previous version used a case-insensitive match (default for -x). The presence of packages like freebsd-git-devtools and freebsd-ftpd would falsely trigger the packaged base check. Instead, just use `pkg which /usr/bin/uname` as a packaged base indication. pkg uses /usr/bin/uname to determine ABI, so we can rely on it existing. If it comes from a package then packaged base is in use. Also, extend the check to all freebsd-update commands. It is easier to just disallow all commands, and easier to test. Reported by: Mark Millard Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47378 (cherry picked from commit 856e158dc4aa5e43f0f15fcd3089fc0d71861b0e) --- usr.sbin/freebsd-update/freebsd-update.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 77b12a3756c2..f575f89bcf82 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -1046,6 +1046,26 @@ IDS_check_params () { fetch_setup_verboselevel } +# Packaged base and freebsd-update are incompatible. Exit with an error if +# packaged base is in use. +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 <