Bug 243424 - kdevelop crashes while parsing cmake list containing execute_process with unset variable
Summary: kdevelop crashes while parsing cmake list containing execute_process with uns...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-02 12:51 UTC by Nikita Krupenko
Modified: 2010-09-27 14:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Krupenko 2010-07-02 12:51:17 UTC
Application that crashed: kdevelop.bin
Version of the application: 4.0.0 (using KDevPlatform 1.0.0)
KDE Version: 4.3.5 (KDE 4.3.5)
Qt Version: 4.5.3
Operating System: Linux 2.6.31.13-desktop-1mnb x86_64
Distribution: "Mandriva Linux 2010.0"

What I was doing when the application crashed:
I'm using KDevelop 4.0.0 on Mandriva 2010.0 with KDE 4.3.5. The following fragment of the CMakeLists.txt cause the program to crash:

#set(cmd ls)
execute_process(COMMAND "${cmd}")

Though, the following code works fine:

set(cmd ls)
unset(cmd)
execute_process(COMMAND "${cmd}")


 -- Backtrace:
Application: KDevelop (kdevelop.bin), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f3a90625710 (LWP 3076))]

Thread 9 (Thread 0x7f3a7bdcb910 (LWP 3077)):
#0  0x00007f3a8d9de0dd in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee52cc2 in QWaitCondition::wait () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a8ab1266e in KDevelop::DUChainPrivate::CleanupThread::run (this=0x1f5bb60) at /usr/src/debug/kdevplatform-1.0.0/language/duchain/duchain.cpp:286
#3  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#4  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#5  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7f3a75769910 (LWP 3078)):
#0  0x00007f3a8d9dde59 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee52d5b in QWaitCondition::wait () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a866b1a66 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x2086ee0, th=0x2093dc0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WeaverImpl.cpp:365
#3  0x00007f3a866b3b9b in ThreadWeaver::WorkingHardState::applyForWork (this=0x20a5630, th=0x2093dc0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WorkingHardState.cpp:71
#4  0x00007f3a866b219f in ThreadWeaver::ThreadRunHelper::run (this=0x7f3a75769090, parent=0x2086ee0, th=0x2093dc0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:87
#5  0x00007f3a866b25f8 in ThreadWeaver::Thread::run (this=0x2093dc0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:142
#6  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#7  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#8  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#9  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7f3a74f68910 (LWP 3079)):
[KCrash Handler]
#5  CMakeProjectVisitor::visit (this=<value optimized out>, exec=0x3300ec0) at /usr/lib/qt4/include/QtCore/qatomic_x86_64.h:121
#6  0x00007f3a7ad64ff2 in CMakeProjectVisitor::walk (this=0x7f3a74f673f0, fc=@0x7f3a74f67ec0, line=0, isClean=<value optimized out>)
    at /usr/src/debug/kdevelop-4.0.0/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp:2092
#7  0x00007f3a7aaf8edb in CMakeManager::parse (this=<value optimized out>, item=0x2fce550) at /usr/src/debug/kdevelop-4.0.0/projectmanagers/cmake/cmakemanager.cpp:399
#8  0x00007f3a8b0eb807 in KDevelop::ImportProjectJobPrivate::import (this=0x3592a70, folder=0x0) at /usr/src/debug/kdevplatform-1.0.0/project/importprojectjob.cpp:53
#9  0x00007f3a8b0eb676 in QtConcurrent::RunFunctionTask<void>::run (this=0x2128800) at /usr/lib/qt4/include/QtCore/qtconcurrentrunbase.h:120
#10 0x00007f3a8ee48d24 in ?? () from /usr/lib64/libQtCore.so.4
#11 0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#12 0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#13 0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#14 0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7f3a6fc8e910 (LWP 3146)):
#0  0xffffffffff60017b in ?? ()
#1  0x00007f3a6fc8dda0 in ?? ()
#2  0x00007fff0f39e782 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 5 (Thread 0x7f3a7048f910 (LWP 3147)):
#0  0x00007f3a888f1677 in g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
#1  0x00007f3a888f1a91 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f3a888f1fc0 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f3a8ef5fcc6 in QEventDispatcherGlib::processEvents () from /usr/lib64/libQtCore.so.4
#4  0x00007f3a8ef35fe2 in QEventLoop::processEvents () from /usr/lib64/libQtCore.so.4
#5  0x00007f3a8ef363b4 in QEventLoop::exec () from /usr/lib64/libQtCore.so.4
#6  0x00007f3a8ee4ef2b in QThread::exec () from /usr/lib64/libQtCore.so.4
#7  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#8  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#9  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#10 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f3a6bab1910 (LWP 3148)):
#0  0x00007f3a8d9de0dd in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee51735 in ?? () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a8ee518a0 in QThread::msleep () from /usr/lib64/libQtCore.so.4
#3  0x00007f3a6ca79611 in UIBlockTester::UIBlockTesterThread::run (this=0x2e9dc50) at /usr/src/debug/kdevelop-4.0.0/languages/cpp/cpplanguagesupport.cpp:678
#4  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#5  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#6  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f3a6aeae910 (LWP 3149)):
#0  0x00007f3a8d9dde59 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee52d5b in QWaitCondition::wait () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a866b1a66 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1e27910, th=0x24b8e40) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WeaverImpl.cpp:365
#3  0x00007f3a866b3b9b in ThreadWeaver::WorkingHardState::applyForWork (this=0x1dcd2f0, th=0x24b8e40) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WorkingHardState.cpp:71
#4  0x00007f3a866b219f in ThreadWeaver::ThreadRunHelper::run (this=0x7f3a6aeae090, parent=0x1e27910, th=0x24b8e40) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:87
#5  0x00007f3a866b25f8 in ThreadWeaver::Thread::run (this=0x24b8e40) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:142
#6  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#7  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#8  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#9  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f3a6a6ad910 (LWP 3150)):
#0  0x00007f3a8d9dde59 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee52d5b in QWaitCondition::wait () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a866b1a66 in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned (this=0x1e27910, th=0x29f64c0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WeaverImpl.cpp:365
#3  0x00007f3a866b3b9b in ThreadWeaver::WorkingHardState::applyForWork (this=0x1dcd2f0, th=0x29f64c0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/WorkingHardState.cpp:71
#4  0x00007f3a866b219f in ThreadWeaver::ThreadRunHelper::run (this=0x7f3a6a6ad090, parent=0x1e27910, th=0x29f64c0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:87
#5  0x00007f3a866b25f8 in ThreadWeaver::Thread::run (this=0x29f64c0) at /usr/src/debug/kdelibs-4.3.5/threadweaver/Weaver/Thread.cpp:142
#6  0x00007f3a8ee51ca5 in ?? () from /usr/lib64/libQtCore.so.4
#7  0x00007f3a8d9d97cd in start_thread () from /lib64/libpthread.so.0
#8  0x00007f3a8dcc53ed in clone () from /lib64/libc.so.6
#9  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f3a90625710 (LWP 3076)):
#0  0x00007f3a8d9dde59 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3a8ee52d5b in QWaitCondition::wait () from /usr/lib64/libQtCore.so.4
#2  0x00007f3a8ee47916 in ?? () from /usr/lib64/libQtCore.so.4
#3  0x00007f3a8ee47e8f in QThreadPool::~QThreadPool () from /usr/lib64/libQtCore.so.4
#4  0x00007f3a8ee49165 in ?? () from /usr/lib64/libQtCore.so.4
#5  0x00007f3a8dc22242 in ?? () from /lib64/libc.so.6
#6  0x00007f3a8dc22295 in exit () from /lib64/libc.so.6
#7  0x00007f3a8e4414d8 in ?? () from /usr/lib64/libQtGui.so.4
#8  0x00007f3a8f43bdd8 in KApplication::xioErrhandler (this=0x7fff0f346330, dpy=0x1c27580) at /usr/src/debug/kdelibs-4.3.5/kdeui/kernel/kapplication.cpp:408
#9  0x00007f3a897ebbee in _XIOError () from /usr/lib64/libX11.so.6
#10 0x00007f3a897f3495 in ?? () from /usr/lib64/libX11.so.6
#11 0x00007f3a897f3d47 in _XEventsQueued () from /usr/lib64/libX11.so.6
#12 0x00007f3a897dcc5b in XEventsQueued () from /usr/lib64/libX11.so.6
#13 0x00007f3a8e47980c in ?? () from /usr/lib64/libQtGui.so.4
#14 0x00007f3a888f13aa in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#15 0x00007f3a888f1b90 in ?? () from /usr/lib64/libglib-2.0.so.0
#16 0x00007f3a888f1fc0 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#17 0x00007f3a8ef5fc73 in QEventDispatcherGlib::processEvents () from /usr/lib64/libQtCore.so.4
#18 0x00007f3a8e47964e in ?? () from /usr/lib64/libQtGui.so.4
#19 0x00007f3a8ef35fe2 in QEventLoop::processEvents () from /usr/lib64/libQtCore.so.4
#20 0x00007f3a8ef363b4 in QEventLoop::exec () from /usr/lib64/libQtCore.so.4
#21 0x00007f3a8ef38569 in QCoreApplication::exec () from /usr/lib64/libQtCore.so.4
#22 0x000000000040868f in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/kdevelop-4.0.0/app/main_internal.cpp:232

Reported using DrKonqi
Comment 1 Milian Wolff 2010-09-27 14:52:37 UTC
commit eef815585a4271d80220394556ed44af643e03f9
Author: Milian Wolff <mail@milianw.de>
Date:   Mon Sep 27 14:46:07 2010 +0200

    don't try to execute empty command
    
    BUG: 243424

diff --git a/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp b/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp
index 67bfdbf..b9c5379 100644
--- a/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp
+++ b/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp
@@ -1327,6 +1327,11 @@ int CMakeProjectVisitor::visit(const ExecuteProcessAst *exec)
     QList<KProcess*> procs;
     foreach(const QStringList& _args, exec->commands())
     {
+        if (_args.isEmpty())
+        {
+            kDebug(9032) << "Error: trying to execute empty command";
+            break;
+        }
         QStringList args(_args);
         KProcess *p=new KProcess(), *prev=0;
         if(!procs.isEmpty())