pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Apr 23 18:06:13 UTC 2020

Modified Files:
        pkgsrc/mk: subst.mk

Log Message:
mk/subst.mk: prevent filename expansion using "set -f"

This avoids creating a temporary directory.

The "set -f" option is not used anywhere else in pkgsrc, even though it
has been available since 1985 in the 8th Edition of Research Unix. Even
AIX and IRIX have that option, so it seems a safe bet.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 pkgsrc/mk/subst.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/subst.mk
diff -u pkgsrc/mk/subst.mk:1.79 pkgsrc/mk/subst.mk:1.80
--- pkgsrc/mk/subst.mk:1.79     Sat Apr 18 15:04:34 2020
+++ pkgsrc/mk/subst.mk  Thu Apr 23 18:06:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.79 2020/04/18 15:04:34 rillig Exp $
+# $NetBSD: subst.mk,v 1.80 2020/04/23 18:06:13 rillig Exp $
 #
 # The subst framework replaces text in one or more files in the WRKSRC
 # directory. Packages can define several ``classes'' of replacements.
@@ -159,19 +159,18 @@ ${_SUBST_COOKIE.${class}}:
        ${RUN} message=${SUBST_MESSAGE.${class}:Q};                     \
        if [ "$$message" ]; then ${ECHO_SUBST_MSG} "$$message"; fi
        ${RUN}                                                          \
-       basedir=${WRKSRC:Q};                                            \
-       emptydir="$$basedir/.subst-empty";                              \
+       cd ${WRKSRC};                                                   \
        patterns=${SUBST_FILES.${class}:Q};                             \
-       ${MKDIR} "$$emptydir"; cd "$$emptydir";                         \
+       set -f;                                                         \
        for pattern in $$patterns; do                                   \
+       set +f;                                                         \
        changed=no;                                                     \
-       cd "$$basedir";                                                 \
        for file in $$pattern; do                                       \
                case $$file in /*) ;; *) file="./$$file";; esac;        \
                tmpfile="$$file.subst.sav";                             \
                if [ ! -f "$$file" ]; then                              \
                        [ -d "$$file" ] || ${_SUBST_WARN.${class}} "Ignoring non-existent file \"$$file\"."; \
-               elif ${_SUBST_IS_TEXT_FILE_CMD.${class}}; then  \
+               elif ${_SUBST_IS_TEXT_FILE_CMD.${class}}; then          \
                        ${SUBST_FILTER_CMD.${class}}                    \
                        < "$$file"                                      \
                        > "$$tmpfile";                                  \
@@ -195,7 +194,6 @@ ${_SUBST_COOKIE.${class}}:
        if ${TEST} "$$changed,${SUBST_NOOP_OK.${class}:tl}" = no,no; then \
                ${FAIL_MSG} "[subst.mk:${class}] The filename pattern \"$$pattern\" has no effect."; \
        fi; \
-       done; \
-       cd ${WRKDIR}; ${RMDIR} "$$emptydir"
+       done
        ${RUN} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}.tmp && ${MV} ${.TARGET}.tmp ${.TARGET}
 .endfor



Home | Main Index | Thread Index | Old Index