Subject: re: /etc/rc.d/ runs slowsly
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 04/09/2000 04:18:06
[[ "redirected" means that you *don't* reply to the lists it was
redirected from! ]]

[ On Saturday, April 8, 2000 at 22:44:32 (-0700), Greywolf wrote: ]
> Subject: re: /etc/rc.d/ runs slowsly 
>
> What "fork test"?  "test" is a builtin, no?

nope, not yet:

03:53 [2622] # uname -sr 
NetBSD 1.4V
03:54 [2623] # sh
# type test
test is /bin/test
# type [
[ is /bin/[
# type pwd
pwd is a shell builtin

> Don't we have a decent parser anywhere in the root filesystem?

"parser"?  yes, but not one that can match strings efficiently when used
as a normal filter program....
 
> *sigh*.  Here we go.  The beginning of the end.  Now we're gonna need
> /usr mounted right away.
> 
> This is not acceptable for a BSD.

don't be so silly!  ;-)

'grep/fgrep/egrep', and/or 'sed', and/or 'awk' should probably be in
/bin regardless (just so long as it's not GNU Awk or GNU Grep!  ;-)
(the real nawk is only about 170KB on i386 when statically linked)
 
> How far are we going to degenerate?  /usr does NOT belong on root.
> Run HP-UX or Solaris or maybe IRIX if that's better for you.

Now please get a grip on reality and stop living in a time warp!

/usr hasn't "belonged" on a separate disk ever since home directories
were moved out of it, or since decently priced disks got bigger than
10MB (yes, megabytes), whichever came first.  The proper definition of a
root filesystem is that it be *stable*, not small -- it doesn't have to
fit on a single disk cylinder you know!
 
> pmatch would be good.

Hmmm...  that rings a bell from long ago....  There's a libkern routine
of that name that does shell-style "glob" matches....

Seriously though a proper basic implementation of fgrep, or even the
full grep, should be fine.  The "grep using regcomp" by James Howard and
Dag-Erling Co´dan Sm°rgrav is only ~130KB on i386 when statically
linked.  If the regcomp part were taken out and only 'fgrep' remained it
would be much smaller (as if that really matters except on install media!)

>  I wonder if perhaps a case statement instead of
> an if [ ... ] would be better.

I think you'd have to write self-modifying code, or at least generate
code on the fly, to use a 'case' statement -- either that or "un-roll"
the function into every script (and thus increase the maintenance
headache again).

"Premature optimisation is the root of all evil..."  Let's fix the
actual problems with the new scripts, not get pedantic about squeezing
every byte out of them!

-- 
							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>