git: 93a86257b76d - main - component: Mk framework

From: Luca Pizzamiglio <pizzamig_at_FreeBSD.org>
Date: Wed, 11 Jan 2023 22:42:19 UTC
The branch main has been updated by pizzamig:

URL: https://cgit.FreeBSD.org/ports/commit/?id=93a86257b76dfc938ef0e37147e762b2605334ae

commit 93a86257b76dfc938ef0e37147e762b2605334ae
Author:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
AuthorDate: 2023-01-11 22:31:24 +0000
Commit:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
CommitDate: 2023-01-11 22:41:24 +0000

    component: Mk framework
    
    Add check to detect colon in .CURDIR, because it's not supported
    this patch detects the colon and shows a proper error message
    
    Reviewed By: #portmgr, tcberner
    Differential Revision: https://reviews.freebsd.org/D37500
---
 Mk/bsd.port.mk        | 5 +++++
 Mk/bsd.port.subdir.mk | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 50c8be9ae4cd..7628e7d1d48a 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1058,6 +1058,11 @@ _PORTS_DIRECTORIES+=	${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
 # make -C /usr/ports/category/port/.
 .CURDIR:=		${.CURDIR:tA}
 
+# Ensure .CURDIR doesn't contain a colon, which breaks makefile targets
+.if ${.CURDIR:S/:/\:/g} != ${.CURDIR}
+.error The current directory path contains ':', this is not supported
+.endif
+
 # make sure bmake treats -V as expected
 .MAKE.EXPAND_VARIABLES= yes
 
diff --git a/Mk/bsd.port.subdir.mk b/Mk/bsd.port.subdir.mk
index 426c64520f1d..724fa4505f53 100644
--- a/Mk/bsd.port.subdir.mk
+++ b/Mk/bsd.port.subdir.mk
@@ -51,6 +51,11 @@ MOVEDFILE?=		MOVED
 # make -C /usr/ports/category/port/.
 .CURDIR:=		${.CURDIR:tA}
 
+# Ensure .CURDIR doesn't contain a colon, which breaks makefile targets
+.if ${.CURDIR:S/:/\:/g} != ${.CURDIR}
+.error The current directory path contains ':', this is not supported
+.endif
+
 .include "${PORTSDIR}/Mk/bsd.commands.mk"
 
 .MAIN: all
@@ -505,7 +510,7 @@ _PORTSEARCH=	\
 	        } \
 	    }' ${MOVEDDIR}/${MOVEDFILE}; \
 	  fi \
-	fi 
+	fi
 
 search:
 	@${_PORTSEARCH}