git: 9f25a717ff5f - stable/15 - build: Use -f when copying sources

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

URL: https://cgit.FreeBSD.org/src/commit/?id=9f25a717ff5fb54d3456bb5abc74192b8ca0784e

commit 9f25a717ff5fb54d3456bb5abc74192b8ca0784e
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:33:50 +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 b0506806ba18..c26dac86bec2 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -103,7 +103,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
@@ -270,7 +270,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