Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles; site ccvaxa.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!willcox From: willcox@ccvaxa.UUCP Newsgroups: net.bugs Subject: Re: help with fixing a shell bug? (whimp - (nf) Message-ID: <5200003@ccvaxa.UUCP> Date: Tue, 24-Apr-84 07:29:00 EDT Article-I.D.: ccvaxa.5200003 Posted: Tue Apr 24 07:29:00 1984 Date-Received: Fri, 4-May-84 00:23:27 EDT References: <879@nsc.UUCP> Lines: 36 Nf-ID: #R:nsc:-87900:ccvaxa:5200003:000:1537 Nf-From: ccvaxa!willcox Apr 24 16:29:00 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