trap causes longjmp botch

Chris Torek chris at mimsy.UUCP
Mon Jun 13 17:18:10 AEST 1988


In article <502 at philmds.UUCP> leo at philmds.UUCP (Leo de Wit) writes:
>    Used to [use trap 'action' 0] myself that way too ... until one
>day the sh (/bin/sh; the Bourne shell on an Ultrix machine) complained
>about a 'longjmp botch'; I don't remember if there was a core dump.

Unless it was otherwise disabled (file `core' in current directory
unwritable, `limit coredumpsize 0', etc), there was.

>    What is the problem with this trap?  [explanation deleted]

The problem is that there is a bug in the 4.2BSD /bin/sh such that
`trap 0' outside of a script sometimes causes a longjmp to a stack
context that is no longer around.  Most likely this bug has been around
since V7, but is only caught now that longjmp unwinds the stack and
aborts if the frame is gone.

The bug does not occur when the trap is inside a script.

The bug remains in the 4.3BSD /bin/sh.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list