Subject: Re: MAKEDEV is not portable
To: NetBSD/sparc Discussion List <port-sparc@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: port-sparc
Date: 01/06/1999 22:19:20
[ On Wed, January 6, 1999 at 15:30:59 (-0800), Shyeah right.  What am I gonna do with a gun rack? wrote: ]
> Subject: Re: MAKEDEV is not portable
>
> SunOS, Solaris, Pyramid OSx (at least!) have shells with functions
> but no arithmetic; HP/UX had the same until release 10; I suspect
> IRIX and AIX have the same.

Except for SunOS they all (so far as I remember) have KSH, and KSH93 is
freely available in binary form for SunOS-4 [and irix and HP-UX and DEC
Alpha OSF/1 and even Linux 2.0 and OS/390 now].  So far as I remember
HP/UX came with ksh before release 10 too (but I tried not to touch
HP/UX very often as I found it left radiation burns all over me...)  OSx
might not have had ksh in the early days, but I remember Pyramid doing a
big drive to get everyone to upgrade to DC/OSx and I'd be surprised to
find anyone still running OSx.  AIX has had Ksh in almost all of its
variants, even 2.x I think, and certainly it was always there on the
RS/6000s (3.0 and newer).  Solaris, aka SunOS-5, and every other UNIX
System V Release 4 port and derrivative has, or should have had, ksh.

Others not mentioned to date are Digital UNIX and Seqyent Dynix, which
both had a straight V7 Bourne shell, but so far as I remember also both
came with ksh (or did either one or both just com with the UNIX System 5
shell as sh5 or some such?).

The reason I go on about this is because I've found in the past that if
you're intending to write a fully portable script then either you write
to a specific "feature-full" shell (eg. KSH or POSIX) or you write
"plain jane" V7 scripts and suffer the forks.  Trying to use shell
functions portably is a terribly thankless task.  I've even encountered
shells that fork to run functions, and you'd be just as well off putting
the functions (sans the function definitino syntax goop) in separate
script files and sourcing them (which opens a file but avoids the fork).

So, given the range of systems capable of hosting NetBSD diskless
operation complete with NFS'ed /dev, I'd recommend that MAKEDEV remain
as it is and that a comment be placed near the top that guides users who
encounter problems to try finding a copy of KSH and using that to run
the script, or just give them the following URLs:

	http://www.cs.mun.ca/~michael/pdksh/
	http://www.research.att.com/sw/tools/reuse/ (click on "Binary")
	ftp://ftp.netbsd.org/pub/NetBSD/ (to upgrade their aging server)

The ultimate solution is to put /dev in a memory filesystem, or to
integrate DEVFS, etc., especially since compatability of /dev over NFS
is not a given....

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>