Subject: toolchain/30842: fails with mksh
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 07/26/2005 18:13:00
>Number:         30842
>Category:       toolchain
>Synopsis: 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
The MirOS Project
MirBSD 8 Kv#8n36-20050721 GENERIC#776 i386
mksh is the MirBSD version of the public domain korn shell,
which includes patches from the OpenBSD and Debian pdksh

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.
* Install mksh (emerge, apt-get or compile the sources
  yourself using mksh/
* Try to cross-build NetBSD:

$ HOST_CC=mgcc ./ -m pmax -O ~/nbsdpmax/obj -T ~/nbsdpmax/tooldir -U -u release

See it fail after less than one minute on an Athlon XP 500.
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.

RCS file: /cvsroot/src/,v
retrieving revision 1.137
diff -u -p -r1.137
---    29 May 2005 10:54:40 -0000      1.137
+++    26 Jul 2005 18:10:48 -0000
@@ -856,6 +856,12 @@ createmakewrapper()
+       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.