[TUHS] A few comments on porting the Bourne shell

Dan Cross crossd at gmail.com
Tue Jan 3 07:00:58 AEST 2023


On Mon, Jan 2, 2023 at 3:41 PM Larry McVoy <lm at mcvoy.com> wrote:
> On Mon, Jan 02, 2023 at 02:24:22PM -0600, G. Branden Robinson wrote:
> > At 2023-01-02T14:34:22-0500, Rich Salz wrote:
> > > The difference is that "make" need only run on your build systems.
> > > Installation scripts need to run on customer systems.
> >
> > Surprisingly (not really), I don't agree with this, either.
> >
> > make, like tsort, is a generally useful tool that people misconceive as
> > being limited in scope to traditional compile-and-link software
> > development.
> >
> > A dab of imagination and familiarity with existing tooling can save one
> > much wheel reinvention.
>
> If we wanted to use Makefiles in our customer run product, we would have
> shipped it.

Couldn't you also ship a shell? That kinda seems like the simplest solution.

I used to be pretty dogmatic about adherence to 7th Ed tools and
syntax, but I think I'm like the frog in the pot where the temperature
is slowly rising: I suspect I've let things creep in that are not
portable to a universal intersection set, simply because I haven't
noticed, because I'm no longer trying to run things on very old
systems regularly. Will that script I wrote last week run on Ultrix?
Beats me; I haven't powered up the DECstation in 15 years. But
considering the issue raises a related question: practically speaking,
what do you define as a least common denominator? For example, is
`nawk` allowed, or just the traditional 7th Ed awk? How about extended
regular expressions? GNU coreutils `egrep` now spits out a warning
saying, "egrep is obsolescent; using grep -E" (I cannot adequately
express how irritating I find this).  Does `tr` need the square
brackets? Etc. The shell by itself is just part of the equation, and
as a programming environment, /bin/sh is not all that interesting
unless complemented by a bunch of utilities, the portability of which
seems less guaranteed than it once was.

I actually think the shell is less of an issue; C is a bigger one for
me. About a year ago, I set up some emulated systems on my local ham
radio network (connected to AX.25 also!). Among them were Multics and
TOPS-20, but also a VAX running 4.3BSD and 7th Ed on a PDP-11. But
getting anything modern to build on either is a serious pain; speaking
of shells, I was able to find what is (I think) the last version of
tcsh to support 4.3 and get that to build.

Then again, having 7th Ed around forces me to think about shell script
portability again, so...there's that. :-)

        - Dan C.


More information about the TUHS mailing list