[GRASS5] d.legend crash (R_*() related?)

Hi,

some recent change must have introduced a new bug:

GRASS 6.1.cvs (pat):/eden0/ssi/scripts > echo $OUT
evi_regress_4_6_2001.slope
GRASS 6.1.cvs (pat):/eden0/ssi/scripts > d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luxirr.ttf
GRASS 6.1.cvs (pat):/eden0/ssi/scripts > d.rast $OUT
100%
GRASS 6.1.cvs (pat):/eden0/ssi/scripts > d.legend $OUT
*** glibc detected *** double free or corruption (out): 0x00000000005679d0 ***
ERROR eof from graphics driver.

########## gdb

GRASS 6.1.cvs (pat):/eden0/ssi/scripts > d.mon x0
using default visual which is TrueColor
ncolors: 16777216
Graphics driver [x0] started

GRASS 6.1.cvs (pat):/eden0/ssi/scripts > d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luxirr.ttf
GRASS 6.1.cvs (pat):/eden0/ssi/scripts > gdb `which d.legend`
GNU gdb Red Hat Linux (6.3.0.0-0.31rh)
...
This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1".
(gdb) r evi_regress_4_6_2001.slope
Starting program: /hardmnt/eden0/ssi/software/cvsgrass61/dist.x86_64-unknown-linux-gnu/bin/d.legend evi_regress_4_6_2001.slope
ERROR eof from graphics driver.

Program exited with code 01.
(gdb) bt full
No stack.

The d.legend/d.rast.leg worked last week - may it be related to recent R_() changes?

d.legend works fine if I don't use d.font.freetype.

Actually I don't know how to debug this as d.legend apparently crashes in the
very first line.

Markus

On Mon, Aug 22, 2005 at 08:21:58PM -0700, Brad Douglas wrote:

On Mon, 2005-08-22 at 21:43 +0200, Markus Neteler wrote:
> On Mon, Aug 22, 2005 at 11:59:54AM -0700, Brad Douglas wrote:
> > On Mon, 2005-08-22 at 16:38 +0200, Markus Neteler wrote:
> > >
> > > The d.legend/d.rast.leg worked last week - may it be related to recent R_() changes?
> > >
> > > d.legend works fine if I don't use d.font.freetype.
> > >
> > > Actually I don't know how to debug this as d.legend apparently crashes in the
> > > very first line.
> >
> > Markus,
> >
> > Could this be a 64bit issue? I just updated my i686 machine and I'm
> > unable to replicate the problem.
>
> maybe yes. But I used it successfully on the same machine last week.
> I'll try again tomorrow (at home now). Maybe Huidae has an idea as well.

I had made some very minor changes over the weekend, but I temporarily
backed most of them out and recompiled with no success.

I have sort of located the problem:

I did:

d.mon x0
d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luxirr.ttf
d.legend evi_regress_4_6_2001.slope
*** glibc detected *** double free or corruption (out): 0x00000000005460f0 ***
ERROR eof from graphics driver.

In d.legend it crashes in D_add_to_list():

        if(!use_mouse)
            D_add_to_list(G_recreate_command()) ;

which goes to

int D_add_to_list( char *string)
{
        return(R_pad_append_item("list", string, 0)) ;
}

which goes to

Breakpoint 11, R_pad_append_item (item=0x2a9555e90e "list", value=0x52afa0 "d.legend map=\"evi_regress_4_6_2001.slope\" color=\"black\" lines=0 thin=1 labelnum=5", replace=0) at item_appnd.c:13

int R_pad_append_item ( char *item, char *value, int replace)
{
    char result;
    
    _hold_signals(1);
    
    _send_ident (PAD_APPEND_ITEM);
    _send_text (item);
    _send_text (value);
    _send_int (&replace);
    _get_char (&result); <-- WOM!
    
    _hold_signals(0);
    
    return result;
}

in details the _get_char() function:
... where achar="list" when crashing in lib/raster/io.c:

int
_get_char(char *achar)
{
    flushout() ; <- Monitor <x0>: Premature EOF
    _get (achar, 1);
    
    return 0;
}

Basically the flushout() is killing the monitor after using d.font.freetype.

Maybe something needs to be added to d.font.freetype due to the recent
R_*() or XDRIVER changes?

Any ideas?

Markus

On Tue, Aug 23, 2005 at 11:09:52AM +0200, Markus Neteler wrote:

On Mon, Aug 22, 2005 at 08:21:58PM -0700, Brad Douglas wrote:
> On Mon, 2005-08-22 at 21:43 +0200, Markus Neteler wrote:
> > On Mon, Aug 22, 2005 at 11:59:54AM -0700, Brad Douglas wrote:
> > > On Mon, 2005-08-22 at 16:38 +0200, Markus Neteler wrote:
> > > >
> > > > The d.legend/d.rast.leg worked last week - may it be related to recent R_() changes?
> > > >
> > > > d.legend works fine if I don't use d.font.freetype.
> > > >
> > > > Actually I don't know how to debug this as d.legend apparently crashes in the
> > > > very first line.
> > >
> > > Markus,
> > >
> > > Could this be a 64bit issue? I just updated my i686 machine and I'm
> > > unable to replicate the problem.
> >
> > maybe yes. But I used it successfully on the same machine last week.
> > I'll try again tomorrow (at home now). Maybe Huidae has an idea as well.
>
> I had made some very minor changes over the weekend, but I temporarily
> backed most of them out and recompiled with no success.
>

I have sort of located the problem:

I did:

d.mon x0
d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luxirr.ttf
d.legend evi_regress_4_6_2001.slope
*** glibc detected *** double free or corruption (out): 0x00000000005460f0 ***
ERROR eof from graphics driver.

It also crashed with d.text which still worked last Friday:

GRASS 6.1.cvs (latlong):~ > d.mon x0
using default visual which is TrueColor
ncolors: 16777216
Graphics driver [x0] started
GRASS 6.1.cvs (latlong):~ > d.font.freetype font=/usr/X11R6/lib/X11/fonts/TTF/luximb.ttf
GRASS 6.1.cvs (latlong):~ > echo "TBE cases 1970-2005"| d.text col=black size=3 line=1
*** glibc detected *** double free or corruption (out): 0x00000000005448c0 ***
ERROR eof from graphics driver.

Markus