The libgit2 library must be properly initialised before use. See the URL for the relevant libgit2 documentation. Attached is a patch that fixes the project plugin so it does not crash when opening files tracked by git. Reproducible: Always Steps to Reproduce: 1. Clone a git repository. 2. Enable the Kate project plugin, and ensure it was built with libgit2. 3. Open any file in the git repository. Actual Results: *** Error in `/usr/bin/kate': free(): invalid pointer: 0x00007ffff50f7840 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x712cf)[0x7ffff7ab62cf] /lib64/libc.so.6(+0x7671e)[0x7ffff7abb71e] /lib64/libc.so.6(+0x77456)[0x7ffff7abc456] /usr/lib64/libgit2.so.23(+0x349da)[0x7fffe3d669da] /usr/lib64/libgit2.so.23(+0x34b12)[0x7fffe3d66b12] /usr/lib64/libgit2.so.23(+0x20658)[0x7fffe3d52658] /usr/lib64/libgit2.so.23(+0x49753)[0x7fffe3d7b753] /usr/lib64/libgit2.so.23(git_repository_config_snapshot+0x12)[0x7fffe3d7bd52] /usr/lib64/libgit2.so.23(git_repository_open_ext+0x117)[0x7fffe3d7be87] /usr/lib64/qt5/plugins/ktexteditor/kateprojectplugin.so(+0x21d64)[0x7fffe87b7d64] /usr/lib64/qt5/plugins/ktexteditor/kateprojectplugin.so(+0x251ae)[0x7fffe87bb1ae] /usr/lib64/qt5/plugins/ktexteditor/kateprojectplugin.so(+0x254f9)[0x7fffe87bb4f9] /usr/lib64/qt5/plugins/ktexteditor/kateprojectplugin.so(+0x263ef)[0x7fffe87bc3ef] /usr/lib64/qt5/plugins/ktexteditor/kateprojectplugin.so(+0x2687a)[0x7fffe87bc87a] /usr/lib64/libKF5ThreadWeaver.so.5(_ZN12ThreadWeaver8Executor3runERK14QSharedPointerINS_12JobInterfaceEEPNS_6ThreadE+0x40)[0x7fffe8309e50] /usr/lib64/libKF5ThreadWeaver.so.5(_ZN12ThreadWeaver3Job7executeERK14QSharedPointerINS_12JobInterfaceEEPNS_6ThreadE+0x40)[0x7fffe8308cb0] /usr/lib64/libKF5ThreadWeaver.so.5(_ZN12ThreadWeaver6Thread3runEv+0x7a)[0x7fffe830828a] /usr/lib64/libQt5Core.so.5(+0xa346b)[0x7ffff4e3846b] /lib64/libpthread.so.0(+0x8314)[0x7ffff2f14314] /lib64/libc.so.6(clone+0x6d)[0x7ffff7b2bbbd] (gdb) bt #0 0x00007ffff7a78157 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55 #1 0x00007ffff7a794ba in __GI_abort () at abort.c:89 #2 0x00007ffff7ab62d4 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff7ba7988 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #3 0x00007ffff7abb71e in malloc_printerr (action=3, str=0x7ffff7ba3bc7 "free(): invalid pointer", ptr=<optimized out>) at malloc.c:4960 #4 0x00007ffff7abc456 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3831 #5 0x00007fffe3d669da in git__free (ptr=<optimized out>) at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/util.h:240 #6 set_error (error_class=error_class@entry=2, string=0x7fffdc003aa0 "The global/xdg file 'config' doesn't exist: No such file or directory") at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/errors.c:26 #7 0x00007fffe3d66b12 in giterr_set (error_class=error_class@entry=2, string=string@entry=0x7fffe3dd4290 "The %s file '%s' doesn't exist") at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/errors.c:76 #8 0x00007fffe3d52658 in git_sysdir_find_in_dirlist (path=path@entry=0x7fffe3821810, name=name@entry=0x7fffe3dd5530 "config", which=which@entry=GIT_SYSDIR_XDG, label=label@entry=0x7fffe3dd4253 "global/xdg") at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/sysdir.c:225 #9 0x00007fffe3d528f1 in git_sysdir_find_xdg_file (path=path@entry=0x7fffe3821810, filename=filename@entry=0x7fffe3dd5530 "config") at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/sysdir.c:243 #10 0x00007fffe3d68139 in git_config_find_xdg (path=path@entry=0x7fffe3821810) at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/config.c:1079 #11 0x00007fffe3d7b753 in git_repository_config__weakptr (out=out@entry=0x7fffe38218b8, repo=repo@entry=0x7fffdc003850) at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/repository.c:657 #12 0x00007fffe3d7bd52 in git_repository_config_snapshot (out=out@entry=0x7fffe38218e0, repo=repo@entry=0x7fffdc003850) at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/repository.c:702 #13 0x00007fffe3d7be87 in git_repository_open_ext (repo_ptr=0x7fffe3821a08, start_path=<optimized out>, flags=0, ceiling_dirs=<optimized out>) at /var/tmp/portage/dev-libs/libgit2-0.23.1/work/libgit2-0.23.1/src/repository.c:520 #14 0x00007fffe87b7d64 in KateProjectWorker::filesFromGit (this=this@entry=0x86b4d0, dir=..., recursive=recursive@entry=true) at /var/tmp/portage/kde-apps/kate-15.08.0/work/kate-15.08.0/addons/project/kateprojectworker.cpp:279 #15 0x00007fffe87bb1ae in KateProjectWorker::findFiles (this=this@entry=0x86b4d0, dir=..., filesEntry=...) at /var/tmp/portage/kde-apps/kate-15.08.0/work/kate-15.08.0/addons/project/kateprojectworker.cpp:226 #16 0x00007fffe87bb4f9 in KateProjectWorker::loadFilesEntry (this=this@entry=0x86b4d0, parent=parent@entry=0x7fffdc003480, filesEntry=..., file2Item=file2Item@entry=0x7fffdc0034c0) at /var/tmp/portage/kde-apps/kate-15.08.0/work/kate-15.08.0/addons/project/kateprojectworker.cpp:170 #17 0x00007fffe87bc3ef in KateProjectWorker::loadProject (this=this@entry=0x86b4d0, parent=parent@entry=0x7fffdc003480, project=..., file2Item=file2Item@entry=0x7fffdc0034c0) at /var/tmp/portage/kde-apps/kate-15.08.0/work/kate-15.08.0/addons/project/kateprojectworker.cpp:101 #18 0x00007fffe87bc87a in KateProjectWorker::run (this=0x86b4d0) at /var/tmp/portage/kde-apps/kate-15.08.0/work/kate-15.08.0/addons/project/kateprojectworker.cpp:56 #19 0x00007fffe8309e50 in ThreadWeaver::Executor::run (this=<optimized out>, job=..., thread=<optimized out>) at /var/tmp/portage/kde-frameworks/threadweaver-5.13.0/work/threadweaver-5.13.0/src/executor.cpp:52 #20 0x00007fffe8308cb0 in ThreadWeaver::Job::execute (this=<optimized out>, self=..., th=0x86bda0) at /var/tmp/portage/kde-frameworks/threadweaver-5.13.0/work/threadweaver-5.13.0/src/job.cpp:83 #21 0x00007fffe830828a in ThreadWeaver::Thread::run (this=0x86bda0) at /var/tmp/portage/kde-frameworks/threadweaver-5.13.0/work/threadweaver-5.13.0/src/thread.cpp:114 #22 0x00007ffff4e3846b in QThreadPrivate::start (arg=0x86bda0) at thread/qthread_unix.cpp:337 #23 0x00007ffff2f14314 in start_thread (arg=0x7fffe3822700) at pthread_create.c:333 #24 0x00007ffff7b2bbbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 Expected Results: Opened the file. Linux kernel: 4.1 Qt: 5.4.2 KDE Frameworks: 5.13.0 Kate: 15.08.0
Created attachment 94524 [details] Patch that implements proper initialisation of libgit2 in the project plugin
Please note that bug #346101 bug #346102 and bug #345602 are all duplicates of this and should be fixed with this patch.
*** Bug 346101 has been marked as a duplicate of this bug. ***
*** Bug 346102 has been marked as a duplicate of this bug. ***
*** Bug 345602 has been marked as a duplicate of this bug. ***
Git commit 4af72bae2bc95e87475d52fe84a67eca94ea0857 by Dominik Haumann. Committed on 13/09/2015 at 08:33. Pushed by dhaumann into branch 'master'. properly handle ligbit2 resource Thanks to Andrew Wilcox for the patch! FIXED-IN: 15.12 CHANGELOG: fixed bug #352627: properly use libgit2 resource M +6 -0 addons/project/kateprojectworker.cpp http://commits.kde.org/kate/4af72bae2bc95e87475d52fe84a67eca94ea0857
Git commit 09b640fccccdae8a24ae09144b7cffeb966900f8 by Dominik Haumann. Committed on 13/09/2015 at 08:35. Pushed by dhaumann into branch 'Applications/15.08'. properly handle ligbit2 resource Thanks to Andrew Wilcox for the patch! FIXED-IN: 15.12 CHANGELOG: fixed bug #352627: properly use libgit2 resource M +6 -0 addons/project/kateprojectworker.cpp http://commits.kde.org/kate/09b640fccccdae8a24ae09144b7cffeb966900f8
Just hit this bug on Debian Stretch. kate (4:15.08.1-1) unstable; urgency=medium * Drop fake katepart dependency, it wasnt really needed. (Closes: 799294) Thanks to Ralf Jung * New upstream release (15.08.1). -- Maximiliano Curia <maxy@debian.org> Sat, 19 Sep 2015 02:44:53 +0200 kate (4:15.08.0-1) unstable; urgency=medium * New upstream release (15.08.0). * Add fake dependency for the kde4 katepapart package. -- Maximiliano Curia <maxy@debian.org> Tue, 08 Sep 2015 17:18:25 +0200 kate (4:15.08.0-0ubuntu1) wily; urgency=medium * new upstream release -- Clive Johnston <clivejo@aol.com> Wed, 26 Aug 2015 17:08:02 +0100 kate (4:15.07.90-0ubuntu1) wily; urgency=medium * New upstream release * Add missing QML dependencies * new upstream beta release -- Jonathan Riddell <jriddell@ubuntu.com> Tue, 18 Aug 2015 09:34:00 +0100