Re: segfault in incremental build mode with partial files

Shigio YAMAGUCHI <[email protected]> Mon, 29 Jul 2024 08:43:29 +0900
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <CADJmJYoKFN0cxx-ibyhBE5tnhYtH7hA_WJ18pak3hjQm=v38fQ@mail.gmail.com>
Hello,
Could you please send me a reproduction environment without
vim-related files? Thank you in advance.

Regards,
Shigio

On Mon, Jul 29, 2024 at 12:03=E2=80=AFAM Scott Mcdermott <[email protected]>=
 wrote:
>
> This is to report a crash and segfault when running gtags
> in incremental mode.
>
> My editor is configured to run gtags in all git repos.  It's crashing
> when I edit in my ~/.vim/ directory, which is a checkout of
> https://github.com/smemsh/.vim/ repo (config file is "gtags.conf"
> therein).  This gtags was built in May of this year from the
> then-current trunk.  I checked and it looks like no crash fixes
> have been committed since. System is Ubuntu22 on x86_64.
>
> This problem went away when I removed the existing files
> (so it was non-incremental).  The tags update script has a trap
> to remove partials if no finish (editor exits before gtags finishes,
> process group is killed), but the update wrapper has race
> conditions so it probably didn't work and the file generation was
> incomplete.
>
> Nonetheless, gtags still should not crash.
>
> Let me know if more information is needed (i.e., build with -g, or
> upload the partials -- which I saved -- somewhere).
>
> See below; eom.
>
>  $ cd var/vim/tags/home-scott-.vim
>
>  $ lsa
> -rw-r--r-- 1 1001 666 2.0M 20240712000626 GPATH
> -rw-r--r-- 1 1001 666 4.1M 20240712055818 GRTAGS
> -rw-r--r-- 1 1001 666 338M 20240712055818 GTAGS
>
>  $ gdb -q -d ~/upsrc/global --args `which gtags` --incremental /home/scot=
t/var/vim/tags/home-scott-.vim
> Reading symbols from /usr/local/bin/gtags...
> (gdb) r
> Starting program: /usr/local/bin/gtags --incremental /home/scott/var/vim/=
tags/home-scott-.vim
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1"=
.
> [Detaching after fork from child process 4066050]
> [Detaching after fork from child process 4066053]
> [Detaching after fork from child process 4066054]
>
> Program received signal SIGSEGV, Segmentation fault.
> __bt_dleaf (t=3Dt@entry=3D0x555555694920, key=3Dkey@entry=3D0x0, h=3Dh@en=
try=3D0x55555588a630, index=3D0) at bt_delete.c:507
> 507                     ip[0] =3D ip[1] < offset ? ip[1] + nbytes : ip[1]=
;
> (gdb) bt
> #0  __bt_dleaf (t=3Dt@entry=3D0x555555694920, key=3Dkey@entry=3D0x0, h=3D=
h@entry=3D0x55555588a630, index=3D0) at bt_delete.c:507
> #1  0x0000555555609515 in __bt_delete (dbp=3D<optimized out>, key=3D<opti=
mized out>, flags=3D<optimized out>) at bt_delete.c:114
> #2  0x0000555555573356 in dbop_delete (dbop=3D<optimized out>, path=3Dpat=
h@entry=3D0x0) at dbop.c:506
> #3  0x0000555555578ce3 in gtags_delete (gtop=3D0x555555693660, deleteset=
=3Ddeleteset@entry=3D0x55555565a090) at gtagsop.c:592
> #4  0x000055555556553f in updatetags (dbpath=3Ddbpath@entry=3D0x7fffffffc=
1f0 "/home/scott/var/vim/tags/home-scott-.vim",
>     root=3Droot@entry=3D0x7fffffffd1f0 "/home/scott/.vim", deleteset=3Dde=
leteset@entry=3D0x55555565a090, addlist=3Daddlist@entry=3D0x55555567e680) a=
t gtags.c:957
> #5  0x0000555555565aa1 in incremental (dbpath=3Ddbpath@entry=3D0x7fffffff=
c1f0 "/home/scott/var/vim/tags/home-scott-.vim",
>     root=3Droot@entry=3D0x7fffffffd1f0 "/home/scott/.vim") at gtags.c:808
> #6  0x00005555555647c0 in main (argc=3D<optimized out>, argv=3D<optimized=
 out>) at gtags.c:576



--=20
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB