[comp.sys.next] Repl: segmentation fault

gatesl@ucs.orst.edu (Lee Gates) (11/01/90)

Hello, I am trying (first time install) to get MH 6.7 going on a NeXT Cube,
but am having a few problems.  I can get everything to compile, but it seems
repl is being generated corrupt.  When I run repl, it comes back segmentation
fault.  I have tried recompiling several times, only to reproduce the error.

If you have an ideas that might help, I would really appreciate it.

here are the options I am using.  If there is an error here, please let me know.

options	BSD42 BSD43 BIND DBM MHRC FOLDPROT='"0700"' MHRC MORE='"/usr/ucb/more"' MSGPROT='"0600"' RPATHS TYPESIG='void' WHATNOW

thanx
lee
--
Lee Gates --  Living in the Land of Rain, Corvallis OR
gatesl@mist.cs.orst.edu

glenn@heaven.woodside.ca.us (Glenn Reid) (11/02/90)

In article <21478@orstcs.CS.ORST.EDU> gatesl@ucs.orst.edu (Lee Gates) writes:
  Hello, I am trying (first time install) to get MH 6.7 going on a NeXT Cube,
  but am having a few problems.  I can get everything to compile, but it seems
  repl is being generated corrupt.  When I run repl, it comes back segmentation
  fault.  I have tried recompiling several times, only to reproduce the error.

  If you have an ideas that might help, I would really appreciate it.

Try compiling it with the optimizer turned off (don't use the -O option).
That has worked for me on some things in the past.

-- 
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		PostScript/NeXT developers
 ..{adobe,next}!heaven!glenn		415-851-1785

iansmith@nagel.gatech.edu (Ian Smith) (11/06/90)

In article <21478@orstcs.CS.ORST.EDU> gatesl@ucs.orst.edu (Lee Gates) writes:
>Hello, I am trying (first time install) to get MH 6.7 going on a NeXT Cube,
>but am having a few problems.  I can get everything to compile, but it seems
>repl is being generated corrupt.  When I run repl, it comes back segmentation
>fault.  I have tried recompiling several times, only to reproduce the error.
[stuff deleted]
>--
>Lee Gates --  Living in the Land of Rain, Corvallis OR
>gatesl@mist.cs.orst.edu

I had the same problem.  After some digging and using the malloc
debugging library I found that the function replout (in the file
$DIST/uip/replsbr.c) is freeing some memory more than once.  It
appears that there are two loops (one while and one for) that both
free the same memory.  I just hacked out the while loop and it worked
ok.  I'm not sure this is the answer, but it works.

Here are the diffs between my hacked version and the virgin release
of $DIST/uip/replsbr.c:
69a70
> 
93a95
> /*    malloc_debug(2 + 4 + 8 + 16 + 32); */
105,106c107,108
<     for (i = ncomps; i--; )
< 	if ((*nxtbuf++ = malloc( SBUFSIZ )) == NULL)
---
>     for (i = ncomps; i--; ) {
> 	if (((*nxtbuf) = malloc( SBUFSIZ )) == NULL)
107a110,111
>       ++nxtbuf;
>       }
235,238c239,242
<     while ( cptr = *savecomp++ )
< 	free (cptr->c_text);
<     for (nxtbuf = compbuffers, i = ncomps; i--; )
<         free (*nxtbuf++);
---
> /*    while ( cptr = *savecomp++ ) {
> 	myfree (cptr->c_text,0); } */
>     for (nxtbuf = compbuffers, i = ncomps; i--; ) 
>         free(*nxtbuf++); 

It works fine for me.  Also, here's my MH file from the conf directory:
# @(#)$Id: MH,v 1.7 90/04/06 09:44:31 sources Exp $
# a 4.2BSD VAX system running SendMail
bin	/usr/local/lib/mh
bboards nntp
etc	/usr/local/lib/mh
mail	/usr/spool/mail
manuals	local
mts	sendmail/smtp
ccoptions -D__STRICT_BSD__
ldoptions 
ranlib on
options	BSD42 BERK BIND MHE NFS
options WHATNOW 

Note, I turned the optimizer off as Glenn Reid suggested, but I'm not sure
that this made any difference. I'm working on that.

ian

iansmith@warhol.gatech.edu
--
"Daddy what's regret?"
"Well son, all I can say is its always better to regret something you have
done, than to regret something you haven't done. And, if you see you mother
this afternoon..."  --Gibby