git: 336b6d11922a - main - build: Use -f when copying sources

Dag-Erling Smørgrav <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7dba52.25665.18cca710__20578.4000850812$1786624630$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=336b6d11922ac3d080de50f789d40ff95b540cdf

commit 336b6d11922ac3d080de50f789d40ff95b540cdf
Author:     Dag-Erling Smørgrav <[email protected]>
AuthorDate: 2026-08-13 12:28:09 +0000
Commit:     Dag-Erling Smørgrav <[email protected]>
CommitDate: 2026-08-13 12:31:54 +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.
---
 tools/build/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index d71cc710be87..e7af3129730b 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -110,7 +110,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
@@ -277,7 +277,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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.