git: fa08011a521c - main - zoneinfo: fix makefile rules script

From: Stephen J. Kiernan <stevek_at_FreeBSD.org>
Date: Wed, 15 Nov 2023 00:53:35 UTC
The branch main has been updated by stevek:

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

commit fa08011a521c1f15ca44d6a4f30a318d0a37a3a7
Author:     Stephen J. Kiernan <stevek@FreeBSD.org>
AuthorDate: 2023-11-15 00:38:47 +0000
Commit:     Stephen J. Kiernan <stevek@FreeBSD.org>
CommitDate: 2023-11-15 00:51:40 +0000

    zoneinfo: fix makefile rules script
    
    In make target rules, one needs to use subshell if there are
    change directory commands that should only have an effect on the
    other commands in the same line. Otherwise, if make is not running in
    compatibility mode (for example, when -j flag is specified), commands
    would be executed in a single shell and lines following the "cd" might
    not work as expected.
    
    Adjust the target script lines that use "cd" to run in a subshell
    by adding appropriate parenthesis.
    
    Reviewed by:    sjg
    Differential Revision:        https://reviews.freebsd.org/D42608
---
 share/zoneinfo/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile
index f2f14c01c7be..60ae1f76f5b5 100644
--- a/share/zoneinfo/Makefile
+++ b/share/zoneinfo/Makefile
@@ -93,10 +93,10 @@ ZIC= ${STAGE_HOST_OBJTOP}/usr/sbin/zic
 
 zoneinfo: ${TDATA}
 	mkdir -p ${TZBUILDDIR}
-	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
-	umask 022; cd ${.CURDIR}; \
+	(cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS})
+	(umask 022; cd ${.CURDIR}; \
 	${ZIC:Uzic} -D -d ${TZBUILDDIR} ${ZICFLAGS} -m ${NOBINMODE} \
-	    ${LEAPFILE} ${TZFILES}
+	    ${LEAPFILE} ${TZFILES})
 
 #
 # Sort TZS to ensure they are the same every build. find -s might
@@ -110,7 +110,7 @@ TZS!= cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort
 beforeinstall: install-zoneinfo
 install-zoneinfo:
 	mkdir -p ${DESTDIR}/usr/share/zoneinfo
-	cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
+	(cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS})
 .for f in ${TZS}
 	${INSTALL} ${TAG_ARGS} \
 	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \