git: 469727c966bb - main - Makefile.inc1: Use INSTALL_DDIR for distributeworld's distrib-dirs

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Thu, 08 Jun 2023 18:14:20 UTC
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=469727c966bbd91447c8402470452b95810f3ffe

commit 469727c966bbd91447c8402470452b95810f3ffe
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-06-08 16:47:04 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2023-06-08 18:14:12 +0000

    Makefile.inc1: Use INSTALL_DDIR for distributeworld's distrib-dirs
    
    INSTALL_DDIR is the canonicalised version of DESTDIR/DISTDIR. Whilst
    most of what distrib-dirs does doesn't need the canonicalised form, it
    is responsible for installing the POSIX and en_US.US_ASCII NLS symlinks
    to C, and therefore needs the canonicalised version for those two uses
    of install for NO_ROOT builds, since our install does a naive text-based
    prefix strip when creating the METALOG entry rather than a smarter path
    semantics-aware one (which itself is really a bug, and has bitten us
    many times). As a result, using plain DESTDIR/DISTDIR instead can result
    in the METALOG having ./path/to/destdir/base/usr/share/nls/$LOCALE
    rather than ./base/usr/share/nls/$LOCALE and then being filtered out
    when creating base.meta (or, if you're unlucky and the absolute path
    begins with base or tests, weird things will probably happen).
    
    Given this footgun an audit of DESTDIR uses is probably in order,
    especially those using DESTDIR/DISTDIR, but this is sufficient for now.
---
 Makefile.inc1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 86e8da9467da..88ae6dadd8a1 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1456,7 +1456,7 @@ distributeworld installworld stageworld: _installcheck_world .PHONY
 	-mkdir ${DESTDIR}/${DISTDIR}/base
 	${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH:Q} ${MAKE} \
 	    METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
-	    DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
+	    DISTBASE=/base DESTDIR=${INSTALL_DDIR}/base \
 	    LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
 	${INSTALL_SYMLINK} ${INSTALLFLAGS} usr/src/sys ${INSTALL_DDIR}/base/sys
 .endif # make(distributeworld)