[GRASS-dev] Re: ctypes problem with Vect_open_old

Martin Landa landa.martin at gmail.com
Sat Jul 23 04:27:48 EDT 2011


Hi,

2011/7/23 Glynn Clements <glynn at gclements.plus.com>:
>> D1/5: Vect__open_old(): name = (null) mapset = (null) layer= (null) update = 0
>> Segmentation fault
>
> "(null)" is what libc's printf("%s") prints for a null pointer.
>
> This is a different problem to your original report.

sorry, small bug in my sample test. Here is a new attempt - sample script:

"""
#!/usr/bin/python

from grass.lib.gis  import *
from grass.lib.vector import *

map_obj = Map_info()
map = pointer(map_obj)

print os.environ['PYTHONPATH']
print sizeof(off_t)
Vect_open_update(map, "a", "")

p = Vect_new_line_struct()
c = Vect_new_cats_struct()

Vect_append_point(p, 1, 1, 0)
Vect_cat_set(c, 1, 1)
print p.contents.n_points

Vect_write_line(map, GV_POINT, p, c)

Vect_build(map)
Vect_close(map)
"""

My system is Debian GNU/Linux unstable 32bit, the script works when
GRASS compiled without LFS, with LFS it fails.

/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/etc/python
8
/usr/local/src/grass_trunk/dist.i686-pc-linux-gnu/etc/python
8
D1/5: Vect__open_old(): name = a mapset =  layer= (null) update = 1
D1/5: Vect_set_thresh(): thresh = 0.000000
D3/5: dig_init_plus()
D3/5: dig_cidx_init()
D1/5: G_find_vector2(): name=a mapset=
D1/5: Map name: a
D1/5: Map mapset: pg
D1/5: open format file: 'pg/vector/a/frmt'
D1/5: Vector format: 0 (native)
D2/5: G__read_Cell_head
D2/5: G__read_Cell_head_array
....
D1/5: Vect_open_sidx(): name = a mapset= pg mode = update
D1/5: get coor info: /home/martin/grassdata/nc_spm_08/pg/vector/a/coor
D1/5: Info->size = 134, Info->mtime = 1311408989
D2/5: Spidx header: file version 5.1 , supported from GRASS version 5.1
D2/5:   byte order 0
D2/5:   header size 113
D2/5:   with_z 0
D2/5:   coor size 134
D1/5: Sidx head: coor size = 134, coor mtime = 0
D1/5: Memory based spatial index
D1/5: dig_read_spindx()
D2/5: Spidx header: file version 5.1 , supported from GRASS version 5.1
D2/5:   byte order 0
D2/5:   header size 113
D2/5:   with_z 0
D2/5:   coor size 134
*** glibc detected *** /usr/bin/python: malloc(): memory corruption:
0x09ba9fe8 ***

It indicates other problem than reported originally.

Martin

-- 
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa


More information about the grass-dev mailing list