help with fixing a shell bug? (whimp - (nf)

willcox at ccvaxa.UUCP willcox at ccvaxa.UUCP
Tue Apr 24 21:29:00 AEST 1984


#R:nsc:-87900:ccvaxa:5200003:000:1537
ccvaxa!willcox    Apr 24 16:29:00 1984

This just came up recently in net.unix-wizards (I think it was), though
the problem reported was a segmentation violation instead of a loop.
Your problem stems from the way that sh allocates memory.  It assumes
that it can use as much memory as it wants, and does so until it gets a
memory fault (or segmentation violation, or whatever your machine calls
it).  It catches the resulting signal, and only then, in the signal
handler, does it do an sbrk() to get more memory.  The trouble is in
the assumption that that the instruction that caused the trap will be
restarted.  This is true on the VAX and PDP-11, but not on some other
machines, e.g. the Gould Concept series, or 68000.  Since the
instruction that usually gets the trap is setting up the free memory
list, said list gets garbled.

On some machines, this causes the behavior you saw.  On others
you see other strange results.

We circumvented the problem by putting code into the kernel to back up
the PC on the appropriate trap, thus ensuring that the offending
instruction would, in fact, be re-executed.  A cleaner and more
permanent solution would have been to fix sh, but we didn't want to
have to deal with the psuedo-Algol code, and were worried (without
justification, it turned out) that other utilities would make the same
broken assumptions about faults.

Welcome to the world of Algol-C.

-------------
David Willcox
(217) 384-8500
Compion Corp., The Software Subsidiary of Gould, Inc.

Unet:	...!uiucdcs!ccvaxa!willcox
Mail:	1101 E. University; Urbana, IL 61801



More information about the Net.bugs mailing list