From nobody Thu Oct 23 00:37:49 2025 X-Original-To: dev-commits-src-branches@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 4csRvf0Q5dz6Cbms; Thu, 23 Oct 2025 00:37:50 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4csRvd5sjsz3bh9; Thu, 23 Oct 2025 00:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761179869; 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=XSu3uQ9bbwKV8zHEvvqxKscsZN2Ptsj0CLfWdRp6rwg=; b=dWECBOUYmeFXX5pNS3NitgM7DS4oavXlDpRtPkPyHT/4lJ30IDepydNsjn7S6RZ5lQUMQY 2MYUP6ee/FjIEh+UlJ0n5lUjhaHrHwbgUIb+Nr/OLJd2Au4MN3FtGk10okGbzvl+8bXg/r QMvVfQ2hSO/jJLkTSxE0fL5TJSsrWKQ/L/4lXH9rMwruiYEhiUSXPH2UN9lGg+bW8Tc0Xo mKIya+06USDNlQwkq/eD1j/R9CHHOTuTq885mf9Ei3rOmz105msnDYb2J/7qkUmN0lPZ0+ y07L124uVOxMeAO5Ysx8R5D6BzIlZKhCLpaIR1ZbI+2TrJX/hOZdxb2Bujpcjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761179869; 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=XSu3uQ9bbwKV8zHEvvqxKscsZN2Ptsj0CLfWdRp6rwg=; b=VXwhBJGgDxal10DQcPqr/5sdk2dVzz/on1YD+8VBYne+DNm8Ar05XDeQk6aboDGT8PO4Lq 31Q4wGg/ocUy7aY879Mn5XA9ONxnpl94XwtsoOmI7By8tlMk7daGvqZzTg3q4oNPH8pVfZ DT5xxdyhRMqZ/tJTLPesTOTevL8Cy5U2cs6ytF+h84izPvnFos88kpl5nKErnNSr12cQCK w3V2YBoK6Iqf9pA8oDSA9TVkZrfkREiH58foCdWS+Nykv8Sxjh2SvL9vHS70g9IOrkHLws Tep+QzqYfdkyoYbwKnQBGE9RHn8JtR7EU82QYFd9mOOwLdn8L5a9lwdA2mpkNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761179869; a=rsa-sha256; cv=none; b=gTQ8EWL0q34sffLXGJPXf4Ui/+C2eYABZMvdkZcuBtJIAmgv6/aop7ZRsE+IE9AneisWZ7 VOs826P1PFv1HyXV4Z8AkgAjFyxjrmivXzrmrWe37orMAlgaYGFDeDMWSb+z899GlPMX0R W9daTpO8xdvIAyDL0/toNU86fx5KNtzXCuEGCfS4c1MZs9gWRSW4TO2F29m/4ZklQ04VzM Cj2fdFDoEzakUc7Zy9GlMRW/cQcYUVYag3RcwubgaxtXdcLHAD6JlPJGlX6e1xzr47qmMA 5HOgxRdMKSblPIhhst3K4pQJlPISjXVXzhdwMlLDQiQAgGMt7L6KFOiNDjeUtg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4csRvd5SZyzsLC; Thu, 23 Oct 2025 00:37:49 +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 59N0bnZf023483; Thu, 23 Oct 2025 00:37:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59N0bnsN023480; Thu, 23 Oct 2025 00:37:49 GMT (envelope-from git) Date: Thu, 23 Oct 2025 00:37:49 GMT Message-Id: <202510230037.59N0bnsN023480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: ef82bdc864c5 - stable/15 - Makefile: Don't allow install{world,kernel} with pkgbase List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: ef82bdc864c5750c6c42a45696aa35c1a1cff10a Auto-Submitted: auto-generated The branch stable/15 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ef82bdc864c5750c6c42a45696aa35c1a1cff10a commit ef82bdc864c5750c6c42a45696aa35c1a1cff10a Author: Lexi Winter AuthorDate: 2025-10-17 19:06:17 +0000 Commit: Colin Percival CommitDate: 2025-10-23 00:36:50 +0000 Makefile: Don't allow install{world,kernel} with pkgbase Using these targets on a pkgbase system will cause the installed system to become out of sync with the package database, which is almost certain to cause issues the next time pkg(8) is used. To prevent users doing this accidentally, disallow install* if we detect that FreeBSD-runtime is installed in the target. The check can be overridden with DESTDIR=/ for users who are sure they want to do this. MFC after: 3 days Reviewed by: emaste Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D52879 (cherry picked from commit 74a6bb524e5b9ad654a9acc5da5c195f406717b5) --- Makefile.inc1 | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 21adf215c0aa..dcd4fd23c087 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -600,7 +600,16 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} .endif .endif # !defined(_MKSHOWCONFIG) +PKG_NAME_PREFIX?= FreeBSD +PKG_MAINTAINER?= re@FreeBSD.org +PKG_WWW?= https://www.FreeBSD.org +PKG_WORKERS_COUNT?= 1 + .if make(*package*) +.export PKG_NAME_PREFIX +.export PKG_MAINTAINER +.export PKG_WWW + .if !defined(PKG_TIMESTAMP) .if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git) SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD @@ -611,14 +620,6 @@ SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} .else SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif -PKG_WORKERS_COUNT?= 1 - -PKG_NAME_PREFIX?= FreeBSD -PKG_MAINTAINER?= re@FreeBSD.org -PKG_WWW?= https://www.FreeBSD.org -.export PKG_NAME_PREFIX -.export PKG_MAINTAINER -.export PKG_WWW .endif .if !defined(_MKSHOWCONFIG) @@ -1366,6 +1367,28 @@ __installcheck_DESTDIR: .PHONY .endif .endif +# +# Don't allow installworld or installkernel on a pkgbase system. This avoids +# accidentally updating a pkgbase system with install{world,kernel}, causing +# the installed system to become out of date with the package database. +# +# Skip the check if DESTDIR is defined on the assumption the user knows what +# they're doing. This means the check can be disabled for the running system +# using DESTDIR=/. +# +.if !make(distributeworld) && !defined(DESTDIR) +_installcheck_world: __installcheck_PKG +_installcheck_kernel: __installcheck_PKG +__installcheck_PKG: .PHONY +.if exists(${LOCALBASE}/sbin/pkg-static) + @if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \ + echo >&2 "ERROR: This target should not be used on a system installed from packages." ; \ + echo >&2 " To override this check, set DESTDIR=/."; \ + false; \ + fi +.endif +.endif + .if !defined(DB_FROM_SRC) # # Check for missing UIDs/GIDs.