sh vs. sh5 in ultrix

Guy Harris guy at auspex.auspex.com
Tue Sep 4 05:00:02 AEST 1990


>So the executable for sh5 is more than three times larger than that
>of sh.  For quick execution of simple tasks there is a sense of 
>overkill in using sh5.  I guess that's the reason that the folks at
>DEC have not replaced sh with sh5.

I tend to be leery of guesses, perhaps because there may be more than
one possible answer to the question to which you're guessing the answer.
One alternative answer is that they're afraid putting in an S5 shell -
even with changes to make it more V7/BSD-flavored, such as changing the
behavior of "echo" - might break some V7/BSD shell scripts.

Sun took the alternate tack, in SunOS 3.0 (yes, 3.0, not 3.2; it wasn't
done as part of the big S5 compatibility push, it was done to add in the
functionality and bug fixes of the S5R2 shell), by making the
aforementioned changes and making an S5R2-based shell "/bin/sh".  (The
change in 3.2 was to make it act as if it were picking up builtins such
as "echo" and "test"/"[" as programs, based on PATH, so that the
behavior of those builtins depended on whether "/usr/5bin" came before
"/bin" or "/usr/bin" in PATH.)

For comparison, here are the sizes of the 4.3BSD shell source, compiled
on a Sun-4 running 4.0.3 (after fixing the "old-style" initializations
that the SunOS 4.x C compilers no longer accept) and "/usr/bin/sh". 
Both are statically linked, and both are compiled with "-O":

	auspex% size ./sh /usr/bin/sh
	text    data    bss     dec     hex
	40960   8192    0       49152   c000    ./sh
	90112   8192    3160    101464  18c58   /usr/bin/sh

so the code slightly more than doubles in size, but not triples.  I have
no problem with doubling the size of the code, if it means I don't have
to write "least common denominator" shell scripts and don't have to
stick something gross and OS-dependent such as "#! /usr/bin/sh5" at the
front of the script. 



More information about the Comp.unix.shell mailing list