git: cbeb1be34ba3 - main - Mk/Uses/npm.mk: Quote TMPDIR and WRKDIR in shell comparisons

Hiroki Tagato <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by tagattie:

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

commit cbeb1be34ba3107114345e52c6b57adc2ec34060
Author:     Shin-ichi Nagamura <[email protected]>
AuthorDate: 2026-07-31 09:15:29 +0000
Commit:     Hiroki Tagato <[email protected]>
CommitDate: 2026-07-31 09:15:29 +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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.