Subject: bin/25938: Error when running bin/sh/mkinit.sh via Solaris ksh
To: None <gnats-bugs@gnats.NetBSD.org>
From: Chris Ross <cross+netbsd@distal.com>
List: netbsd-bugs
Date: 06/15/2004 17:09:27
>Number:         25938
>Category:       bin
>Synopsis:       Error when running bin/sh/mkinit.sh via Solaris ksh
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 15 21:10:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Chris Ross
>Release:        NetBSD 2.0F
>Organization:
>Environment:
System: Solaris 10_b54 (May 2004)
Architecture: sparc64
Machine: sparc64
>Description:
	When trying to generate init.c for the build of bin/sh,
ksh appears to parse this script differently.  Or, at least,
parses the '(' in the regexp differently.  Escaping this regexp
solves the problem for the sparc64 Solaris build, and also still
works on NetBSD native builds (at least on i386).
>How-To-Repeat:
	Build NetBSD HEAD on a Solaris machine using /usr/bin/ksh as
BSHELL, HOST_SH, and CONFIG_SHELL.
>Fix:
	The following patch corrects this problem, and still works
on NetBSD native builds (in my limited testing).  From knowing how
things are supposed to be parsed, this should be completely safe.

Index: bin/sh/mkinit.sh
===================================================================
RCS file: /cvsroot/src/bin/sh/mkinit.sh,v
retrieving revision 1.1
diff -u -r1.1 mkinit.sh
--- bin/sh/mkinit.sh	17 Jan 2004 11:47:31 -0000	1.1
+++ bin/sh/mkinit.sh	15 Jun 2004 21:04:33 -0000
@@ -88,7 +88,7 @@
 			IFS=' 	'
 			set -- $line
 			# Ignore those with arguments
-			[ "$2" = "${2##*(}" ] || continue
+			[ "$2" = "${2##*\(}" ] || continue
 			# and multiline definitions
 			[ "$line" = "${line%\\}" ] || continue
 			defines="${defines}#undef  $2${nl}${line}${nl}"
>Release-Note:
>Audit-Trail:
>Unformatted: