Package: cscope
Version: 15.5+cvs20060902-2
Debian Release: testing/unstable
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.17.11
libc6 : 2.3.999.2-12

I've found this same problem some days ago,but I've found it een without the -q 
option,this is the bt :

cscope -bkRp2
(gdb) bt
#0  0x00002b4fcc889b39 in strncpy () from /lib/libc.so.6
#1  0x00002b4fcc5b6f9f in strncpy () from /lib/libsafe.so.2
#2  0x0000000000411d3e in invnewterm () at invlib.c:494
#3  0x0000000000412543 in invmake (invname=0x56ff50 "ncscope.in.out",
    invpost=0x2b4fccb5a3a0 "\017\003ª\005", infile=0x684840) at invlib.c:216
#4  0x0000000000408544 in build () at build.c:462
#5  0x00000000004133dc in main (argc=0, argv=0x7fffde60fdd0) at main.c:576
(gdb)


cscope -qbkRp2
(gdb) bt
#0  0x00002b957c57fb39 in strncpy () from /lib/libc.so.6
#1  0x00002b957c2acf9f in strncpy () from /lib/libsafe.so.2
#2  0x0000000000411d3e in invnewterm () at invlib.c:494
#3  0x0000000000412543 in invmake (invname=0x56ff50 "ncscope.in.out",
    invpost=0x2b957c8503a0 "\017\003ª\005", infile=0x684840) at invlib.c:216
#4  0x0000000000408544 in build () at build.c:462
#5  0x00000000004133dc in main (argc=0, argv=0x7fff2e91a0d0) at main.c:576
(gdb)

I've not studied the code so much to understand it,but at a first look I 
thought that invlib should work only if you wanted the inverted index,but Iwas 
wrong because it's functions are called anyway.If you change the following 
define at invlib.c:49 :
#define BLOCKSIZE       2 * BUFSIZ      /* logical block size */
to this define :
#define BLOCKSIZE       4 * BUFSIZ      /* logical block size */
then cscope does not segfaults anymore, with or without the -q option,and 
that's not too strange looking at the bt and looking at the code line the cause 
the segfault, i.e. invlib.c:494 :
strncpy(logicalblk.chrblk + lastinblk, thisterm, len);
there is some bug here,maybe I'll try to find it,or I'll try to rewrite the 
entire function,Ifyou have some hints they could be precious.
In the meantime I looked just some lines above and I found this :
/* HBB 20010501: Fixed bug by replacing magic number '8' by
     * what it actually represents. */
lastinblk -= (numwilluse - 2 * sizeof(long));
I looked at the version of this file of cscpe 15.1,and I thought "well this 
should be a change to be more readable and understandable and even portable,but 
shouldn't it be rewritten this way"
lastinblk -= (numwilluse - (2 * sizeof(long)));
anyway,even if this is true it does not solve the main problem.
bye,
        Giangiacomo Mariotti





Reply via email to