From e4fcc3d208326aadbae99e3ca1137e7c7fba3138 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 10 Jul 2024 03:02:09 +0100 Subject: [PATCH] build: restore compat with old NetBSD sh (re: 6eeafa16) I'd used expansions of the form ${foo-} for compatibility with a possible future use of 'set -u'/'set -o nounset'. However, on older NetBSD sh (as still in use on sdf.org and sdf-eu.org), if foo is unset, then empty removal is not performed as it should and even an unquoted ${foo-} yields an empty field. So, to be compatible with NetBSD sh, we cannot use expansions of that form in contexts where empty removal is expected. --- bin/package | 8 ++++---- src/cmd/INIT/mamake.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/package b/bin/package index 605439aaacc8..b660011606d0 100755 --- a/bin/package +++ b/bin/package @@ -115,7 +115,7 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2024-07-04 $ +@(#)$Id: '$command$' (ksh 93u+m) 2024-07-10 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] @@ -548,7 +548,7 @@ SEE ALSO pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2024-07-04 + version package (ksh 93u+m) 2024-07-10 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property @@ -3187,7 +3187,7 @@ make|view) case $target in '') target="install" ;; esac - eval capture \$\{MAMAKE_DEBUG_PREFIX-} mamake \$makeflags \$noexec \$target $assign + eval capture \$MAMAKE_DEBUG_PREFIX mamake \$makeflags \$noexec \$target $assign case $HOSTTYPE in darwin.*) @@ -3376,7 +3376,7 @@ test) # run all available default regression tests, using our newly compiled she set -f set -- ${args:-src} cd "$1" || exit - capture ${MAMAKE_DEBUG_PREFIX-} mamake test + capture $MAMAKE_DEBUG_PREFIX mamake test ;; use) # finalize the environment diff --git a/src/cmd/INIT/mamake.c b/src/cmd/INIT/mamake.c index 141062a59ad7..956662d98c50 100644 --- a/src/cmd/INIT/mamake.c +++ b/src/cmd/INIT/mamake.c @@ -27,7 +27,7 @@ * coded for portability */ -#define RELEASE_DATE "2024-07-08" +#define RELEASE_DATE "2024-07-10" static char id[] = "\n@(#)$Id: mamake (ksh 93u+m) " RELEASE_DATE " $\0\n"; #if _PACKAGE_ast @@ -2229,7 +2229,7 @@ static int update(Rule_t *r) } /* do */ - append(buf, "${MAMAKE_DEBUG_PREFIX-} "); + append(buf, "$MAMAKE_DEBUG_PREFIX "); append(buf, getval(state.vars, "MAMAKE")); append(buf, " -C "); append(buf, r->name);