git: 67d2aaf078e9 - main - csh: install hard link with same mode as target

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 29 Nov 2022 21:04:21 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=67d2aaf078e967bb626cf50c53d679aad71aeaf9

commit 67d2aaf078e967bb626cf50c53d679aad71aeaf9
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-11-23 17:14:18 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-11-29 21:04:05 +0000

    csh: install hard link with same mode as target
    
    Previously when using NO_ROOT we recorded METALOG entries for the /.cshrc
    hard link with a different file mode than the link target, which is not
    permitted.
    
    We cannot just set LINKMODE here as it would also apply to the hard link
    for the tcsh binary.
    
    Reviewed by:    brooks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D37499
---
 bin/csh/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bin/csh/Makefile b/bin/csh/Makefile
index 2281c11538d0..d59626703685 100644
--- a/bin/csh/Makefile
+++ b/bin/csh/Makefile
@@ -162,6 +162,9 @@ beforeinstallconfig:
 	rm -f ${DESTDIR}/.cshrc
 
 afterinstallconfig:
-	${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
+	# XXX Set link mode explicitly via -m.  We cannot use LINKMODE for this
+	# link, as it would also apply to the tcsh link above.
+	${INSTALL_LINK} ${TAG_ARGS} -m ${CONFMODE} ${DESTDIR}/root/.cshrc \
+	    ${DESTDIR}/.cshrc
 
 .include <bsd.prog.mk>