Subject: toolchain/30842: build.sh fails with mksh
To: None <toolchain-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <tg@MirBSD.org>
List: netbsd-bugs
Date: 07/26/2005 18:13:00
>Number: 30842
>Category: toolchain
>Synopsis: build.sh fails with mksh
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 26 18:13:00 +0000 2005
>Originator: Thorsten Glaser
>Release: -rHEAD
>Organization:
The MirOS Project
>Environment:
MirBSD odem.66h.42h.de 8 Kv#8n36-20050721 GENERIC#776 i386
>Description:
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.
This problem is not limited to MirOS BSD because mksh is
already part of many other operating systems, such as
Arch GNU/Linux, Crux GNU/Linux, Debian GNU/* and Gentoo
GNU/Linux; it's also available for Mac OS X and Darwin,
Free/Net/Open/DragonFly BSD, Solaris, Interix (Microsoft
Services for Unix 3.5) and GNU/Cygwin.
I have attached a suggested patch.
>How-To-Repeat:
* Install mksh (emerge, apt-get or compile the sources
yourself using mksh/Build.sh)
* Try to cross-build NetBSD:
$ HOST_CC=mgcc ./build.sh -m pmax -O ~/nbsdpmax/obj -T ~/nbsdpmax/tooldir -U -u release
See it fail after less than one minute on an Athlon XP 500.
>Fix:
The first case branch is for modern mksh; the second one
is for older mksh until and including R20.
I haven't tested this on systems such as Solaris /bin/sh
or /usr/xpg4/bin/sh yet, though.
Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.137
diff -u -p -r1.137 build.sh
--- build.sh 29 May 2005 10:54:40 -0000 1.137
+++ build.sh 26 Jul 2005 18:10:48 -0000
@@ -856,6 +856,12 @@ createmakewrapper()
;;
esac
+ case "$KSH_VERSION" in
+ *MIRBSD KSH*|* MirOS *KSH mode*)
+ set +o braceexpand
+ ;;
+ esac
+
eval cat <<EOF ${makewrapout}
#! /bin/sh
# Set proper variables to allow easy "make" building of a NetBSD subtree.