git: 58dd07bd36d5 - 2026Q3 - Mk/Uses/npm.mk: Quote TMPDIR and WRKDIR in shell comparisons

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Thu, 10 Sep 2026 20:54:51 UTC
The branch 2026Q3 has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=58dd07bd36d5551532b11c6e7e3f1eabadfb37ba

commit 58dd07bd36d5551532b11c6e7e3f1eabadfb37ba
Author:     Shin-ichi Nagamura <core@zsc.jp>
AuthorDate: 2026-07-31 09:15:29 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-09-10 20:54:26 +0000

    Mk/Uses/npm.mk: Quote TMPDIR and WRKDIR in shell comparisons
    
    When TMPDIR is unset, the generated shell command becomes:
        if [ != ${WRKDIR} ]; then
    and /bin/sh reports:
        [: !=: unexpected operator
    
    Quoting both variables fixes the issue.
    
    PR:             297181
    Reported by:    Shin-ichi Nagamura <core@zsc.jp>
    
    (cherry picked from commit cbeb1be34ba3107114345e52c6b57adc2ec34060)
---
 Mk/Uses/npm.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Mk/Uses/npm.mk b/Mk/Uses/npm.mk
index c886b3623dea..0ce55db4764f 100644
--- a/Mk/Uses/npm.mk
+++ b/Mk/Uses/npm.mk
@@ -300,7 +300,7 @@ npm-archive-node-modules:
 		${TAR} -cz --options 'gzip:!timestamp' \
 			-f ${DISTDIR}/${DIST_SUBDIR}/${_DISTFILE_prefetch} \
 			-C ${WRKDIR} @node-modules-cache.mtree; \
-		if [ ${TMPDIR} != ${WRKDIR} ]; then \
+		if [ "${TMPDIR}" != "${WRKDIR}" ]; then \
 			${RM} -r ${WRKDIR}; \
 		fi; \
 	fi
@@ -416,7 +416,7 @@ npm-archive-node-modules:
 			node-modules-cache.mtree && \
 		${TAR} -cz --options 'gzip:!timestamp' \
 			-f ${DISTDIR}/${DIST_SUBDIR}/${_DISTFILE_prefetch} @node-modules-cache.mtree; \
-		if [ ${TMPDIR} != ${WRKDIR} ]; then \
+		if [ "${TMPDIR}" != "${WRKDIR}" ]; then \
 			${RM} -r ${WRKDIR}; \
 		fi; \
 	fi