Bourne shell's wacky memory allocation

Guy Harris guy at sun.uucp
Sat Nov 9 18:16:00 AEST 1985


> It appears that Guy's fix will make SIGSEGV available for general use
> rather than reserved to the shell internals.  That would be nice.

Don't count your blessings until they've hatched, or something like that.
It doesn't make it available for general use, trust me.  You also have to
catch *all* the places where Bourne uses SIGSEGV to catch attempts to use
unallocated portions of the "stack" (temporary string space and the like is
allocated on a "stack" which consists mostly of the growing end of the data
space, although it's intermixed with blocks from the heap).  I got bit by
that a couple of days ago, and found *every* place where the "pushstak"
macro was used and added a test before it; if the place where the character
is to be "pushed" doesn't exist, it grows the data space.  I don't claim to
have caught every place; I want to beat on it a while, and then build a
version of the shell which *does* make SIGSEGV available for "general" use
(i.e., the shell will drop core on a SIGSEGV like it's supposed to) and try
it for a while.

It was a clever idea, my hat's off to Bourne, but I still want to get the
vanity plate SIGSEGV for him and weld it to his car, if he's got one.

	Guy Harris



More information about the Comp.unix.wizards mailing list