summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmk/luapath29
1 files changed, 27 insertions, 2 deletions
diff --git a/mk/luapath b/mk/luapath
index fe5fc9f..b36da19 100755
--- a/mk/luapath
+++ b/mk/luapath
@@ -104,6 +104,30 @@
104# interpreter glob patterns from preferred install directory 104# interpreter glob patterns from preferred install directory
105# string.match expressions. 105# string.match expressions.
106# 106#
107# * 2016-10-10 - Fix issue with passing empty CPPFLAGS to ${CC}. /usr/bin/cc
108# in NetBSD 7.0.1 does not tolerate an empty string argument. This
109# exposed a bug in NetBSD's and FreeBSD's /bin/sh, triggered by how we
110# pass CPPFLAGS (see evalmacro and runcc routines, below).
111#
112# Some Ash variants (confirmed /bin/sh in NetBSD 7.0.1 and FreeBSD
113# 10.1) will expand unquoted ${UNSET-} and ${UNSET:-} as an empty
114# string rather than eliding it during argument processing. That is,
115#
116# nargs() { printf "%d\n" "$#"; }
117# nargs ${UNSET} 2 3
118# nargs ${UNSET-} 2 3
119#
120# prints "2" and "3", whereas every other shell tested prints "2" and
121# "2" (confirmed dash in Ubuntu Xenial; bash 4.3 in Ubuntu Xenial;
122# pdksh in FreeBSD 10.1, NetBSD 7.0, OS X 10.1, OpenBSD 6.0; ksh93 in
123# Solaris 11.3 and AIX 7.1; ksh88 in AIX 7.1).
124#
125# A workaround in set -u mode (where unbound variable expansion aborts
126# execution) is to substitute a known empty value. E.g.
127#
128# EMPTY=
129# nargs ${UNSET-$EMPTY}
130#
107# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 131# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
108# 132#
109# Copyright (C) 2012-2016 William Ahern 133# Copyright (C) 2012-2016 William Ahern
@@ -138,10 +162,11 @@ unset IFS # no field splitting surprises
138unset LUA_PATH || true # interferes search for module install directory 162unset LUA_PATH || true # interferes search for module install directory
139unset LUA_CPATH || true 163unset LUA_CPATH || true
140 164
141MYVERSION=20160325 165MYVERSION=20161010
142MYVENDOR="william@25thandClement.com" 166MYVENDOR="william@25thandClement.com"
143 167
144 168
169EMPTY= # empty string for parameter expansion workaround for Ash bug
145DEVRANDOM=/dev/urandom 170DEVRANDOM=/dev/urandom
146SANDBOX="${TMPDIR}/${0##*/}-" 171SANDBOX="${TMPDIR}/${0##*/}-"
147 172
@@ -322,7 +347,7 @@ runcc() {
322# 347#
323evalmacro() { 348evalmacro() {
324 printf "#include <$1>\n[===[$2]===]\n" \ 349 printf "#include <$1>\n[===[$2]===]\n" \
325 | runcc ${CPPFLAGS:-} -E - 2>>/dev/null \ 350 | runcc ${CPPFLAGS:-${EMPTY}} -E - 2>>/dev/null \
326 | sed -ne " 351 | sed -ne "
327 s/^.*\\[===\\[ *\\(${3:-.*}\\) *\\]===\\].*$/${4:-\\1}/ 352 s/^.*\\[===\\[ *\\(${3:-.*}\\) *\\]===\\].*$/${4:-\\1}/
328 t Found 353 t Found