Subject: Re: toolchain/30842: fails with mksh
To: None <>
From: Alan Barrett <>
List: netbsd-bugs
Date: 07/26/2005 22:13:31
On Tue, 26 Jul 2005, wrote:
> mksh is the MirBSD version of the public domain korn shell,
> which includes patches from the OpenBSD and Debian pdksh
> derivates.
> As such, it needs a special handling for the braceexpand
> mode as well, else MAKEOBJDIR creation in the nbmake wrapper
> will fail.

So, if I understand correctly, this shell interprets braces inside here
documents as special characters, unless you "set +o braceexpand".

Can we solve this problem without adding more special cases to
by just adding backslashes in appropriate places, so it doesn't matter
whether or not the shell does brace expansion?  For example, does the
following patch work (in the absence of the "set +o braceexpand" patch)?
It changes all "\${...}" to "\$\{...\}" in the here-document that uses to create the makewrapper.

--apb (Alan Barrett)

---	2005-07-26 22:05:38.000000000 +0200
+++	2005-07-26 22:07:10.000000000 +0200
@@ -872,7 +872,7 @@
 	for f in ${makeenv}; do
-		if eval "[ -z \"\${$f}\" -a \"\${${f}-X}\" = \"X\" ]"; then
+		if eval "[ -z \"\$\{$f\}\" -a \"\$\{${f}-X\}\" = \"X\" ]"; then
 			eval echo "unset ${f}" ${makewrapout}
 			eval echo "${f}=\'\$$(echo ${f})\'\;\ export\ ${f}" ${makewrapout}
@@ -882,7 +882,7 @@
 	eval cat <<EOF ${makewrapout}
-exec "\${TOOLDIR}/bin/${toolprefix}make" \${1+"\$@"}
+exec "\$\{TOOLDIR\}/bin/${toolprefix}make" \$\{1+"\$@"\}
 	[ "${runcmd}" = "echo" ] && echo EOF
 	${runcmd} chmod +x "${makewrapper}"