git: 84bfbd6bf78f - stable/14 - build: Use -f when copying sources

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 27 Aug 2026 06:34:44 UTC
The branch stable/14 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=84bfbd6bf78febee82b7298cf5fdb77b9f7398c4

commit 84bfbd6bf78febee82b7298cf5fdb77b9f7398c4
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-08-13 12:28:09 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-08-27 06:34:19 +0000

    build: Use -f when copying sources
    
    If one of the source files we copy is non-writeable, cp will create a
    non-writeable copy.  If the original is later modified, cp will fail to
    overwrite the copy since it is not writeable.  Using cp -f ensures the
    copy always succeeds, as long as the object directory is writeable.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   NetApp, Inc.
    
    (cherry picked from commit 336b6d11922ac3d080de50f789d40ff95b540cdf)
---
 tools/build/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index 98ee8b5bda9c..771334757b98 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -85,7 +85,7 @@ _WITH_EXPLICIT_BZERO!= cat ${HOST_INCLUDE_ROOT}/strings.h ${HOST_INCLUDE_ROOT}/s
 # cause it to pick the file from libkern instead (which won't compile).
 # Avoid modifying .PATH by creating a copy in the build directory instead.
 explicit_bzero.c: ${SRCTOP}/sys/libkern/explicit_bzero.c
-	cp ${.ALLSRC} ${.TARGET}
+	cp -f ${.ALLSRC} ${.TARGET}
 CLEANFILES+=	explicit_bzero.c
 INCS+=		strings.h
 SRCS+=		explicit_bzero.c
@@ -247,7 +247,7 @@ SRCS+=	capsicum_stubs.c
 # XXX: we can't add ${SRCTOP}/sys/kern to .PATH since that will causes
 # conflicts with other files. Instead copy subr_capability to the build dir.
 subr_capability.c: ${SRCTOP}/sys/kern/subr_capability.c
-	cp ${.ALLSRC} ${.TARGET}
+	cp -f ${.ALLSRC} ${.TARGET}
 SRCS+=	subr_capability.c
 CLEANFILES+=	subr_capability.c
 .endif # ${MAKE.OS} != "FreeBSD"