Subject: Re: Odd problem w/ tcsh
To: None <jonathan@DSG.Stanford.EDU>
From: None <Havard.Eidnes@runit.sintef.no>
List: port-pmax
Date: 02/11/1998 12:46:50
> >Really funny to see so many people not reading the documentation, which
> >has all the information about the problem (and has had so for a *number*
> >of years... :-)
>
> Thanks for mentioning the relevant #define.
>
> But, umm, it's not quite `the correct solution'. tcsh's won built-in
> malloc should work.  It does work on other NetBSD ports.  It's a bug
> that it doesn't.  The same bug seems to affect other programs (resize,
> perl) in more pernicious ways.

Folks, go read the README file.  For those of you too lazy to do
so by yourselves, I'll quote the relevant section:

> On BSDreno, in ttyname() closedir() is called twice and so the same
> pointer gets free'd twice. tcsh's malloc is picky and it prints an
> error message to that effect. If you don't like the message:
>
> 1. Apply the following patch:
>
> *** /usr/src/lib/libc/gen/ttyname.c.orig        Fri Jun  1 17:17:15 1990
> --- /usr/src/lib/libc/gen/ttyname.c     Tue Oct 29 16:33:12 1991
> ***************
> *** 51,57 ****
>                 if (stat(buf, &sb2) < 0 || sb1.st_dev != sb2.st_dev ||
>                     sb1.st_ino != sb2.st_ino)
>                         continue;
> -               closedir(dp);
>                 rval = buf;
>                 break;
>         }
> --- 51,56 ----
>
> Or: Comment the error printing out in tc.alloc.c
> Or: Compile -DSYSMALLOC

So...  On inspection of the relevant piece of code in NetBSD's C
library, I can't find the above mentioned defect.  So to hunt the
bug down, set a breakpoing at the error message printout in
tc.alloc.c and find out who is freeing a pointer twice or where a
related memory allocation problem exists.

- Havard