Bug 290843 - CMake variables with dashes cause crash
Summary: CMake variables with dashes cause crash
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-07 05:02 UTC by David E. Narvaez
Modified: 2012-01-18 00:19 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 David E. Narvaez 2012-01-07 05:02:53 UTC
Version:           git master (using KDE 4.7.4) 
OS:                Linux

Noticed this when working with a recent KDE Libs version, where the POLKITQT-1_INSTALL_DIR is defined.

Reproducible: Always

Steps to Reproduce:
0. Assuming you have Polkit-1
1. Take any CMake project that is working for you, and add the following two lines

find_package(PolkitQt-1)
string(REPLACE ${POLKITQT-1_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX} _KDE4_AUTH_POLICY_FILES_INSTALL_DIR ${POLKITQT-1_POLICY_FILES_INSTALL_DIR})

2. Try configuring the project

Actual Results:  
The project will crash after configuration. Then you won't be able to open the project again until you remove those added lines.

Expected Results:  
Dashed variables should be parsed properly.

I noticed Kate also doesn't parse these variables nicely. If I remove the dash from the variable name, it gets a variable color (yellow in my configuration) but with the dash in the variable name, it doesn't. Maybe related? Maybe a separate bug report?
Comment 1 David E. Narvaez 2012-01-07 05:29:19 UTC
Handy backtrace, notice the issue is that the expected number of arguments is not met due to parse errors:

Application: KDevelop (kdevelop), signal: Aborted
[Current thread is 1 (Thread 0x7f9dea87a760 (LWP 23904))]

Thread 11 (Thread 0x7f9dd24bb700 (LWP 23912)):
#0  0x00007f9de65216ab in pthread_cond_timedwait () from /lib64/libpthread.so.0
#1  0x00007f9de67b3dae in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007f9de30be30f in KDevelop::DUChainPrivate::CleanupThread::run (this=0xc8ab40) at /home/david/Projects/kdevplatform/language/duchain/duchain.cpp:282
#3  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#5  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 10 (Thread 0x7f9dc9a7a700 (LWP 23914)):
#0  0x00007f9de4bd21b3 in select () from /lib64/libc.so.6
#1  0x00007f9de68879b0 in QProcessManager::run() () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#3  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#4  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 9 (Thread 0x7f9dc2c9e700 (LWP 23916)):
#0  0x00007f9de4bcfc83 in poll () from /lib64/libc.so.6
#1  0x00007f9de00bdd50 in g_main_context_iterate.clone.6 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f9de00be201 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f9de68da9db in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de68abc82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f9de68abed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f9de67b09bf in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#9  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 8 (Thread 0x7f9dc249d700 (LWP 23917)):
#0  0x00007f9de4bcfc83 in poll () from /lib64/libc.so.6
#1  0x00007f9de00bdd50 in g_main_context_iterate.clone.6 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f9de00be201 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f9de68da9db in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de68abc82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f9de68abed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f9de67b09bf in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#9  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7f9dc0e8a700 (LWP 23922)):
#0  0x00007f9de652132c in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007f9de3d8ffd2 in QTWTF::TCMalloc_PageHeap::scavengerThread() () from /usr/lib64/qt4/libQtScript.so.4
#2  0x00007f9de3d90009 in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/qt4/libQtScript.so.4
#3  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#4  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7f9dbfe78700 (LWP 23928)):
#0  0x00007f9de4bcfc83 in poll () from /lib64/libc.so.6
#1  0x00007f9de00bdd50 in g_main_context_iterate.clone.6 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f9de00be201 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f9de68da9db in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de68abc82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f9de68abed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f9de67b09bf in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f9de688c65f in QInotifyFileSystemWatcherEngine::run() () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#10 0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7f9dbe62c700 (LWP 23945)):
#0  0x00007f9de652132c in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007f9dde97a794 in WTF::TCMalloc_PageHeap::scavengerThread() () from /usr/lib64/qt4/libQtWebKit.so.4
#2  0x00007f9dde97a8b9 in WTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/qt4/libQtWebKit.so.4
#3  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#4  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f9dbee2d700 (LWP 23946)):
#0  0x00007f9de4bcfc83 in poll () from /lib64/libc.so.6
#1  0x00007f9de00bdd50 in g_main_context_iterate.clone.6 () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f9de00be201 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f9de68da9db in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de68abc82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f9de68abed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f9de67b09bf in QThread::exec() () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#8  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#9  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f9d7d1e1700 (LWP 23987)):
#0  0x00007f9de652132c in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007f9de67b3e3b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007f9de8c06a2b in ThreadWeaver::WeaverImpl::blockThreadUntilJobsAreBeingAssigned(ThreadWeaver::Thread*) () from /usr/lib64/libthreadweaver.so.4
#3  0x00007f9de8c092fb in ThreadWeaver::WorkingHardState::applyForWork(ThreadWeaver::Thread*, ThreadWeaver::Job*) () from /usr/lib64/libthreadweaver.so.4
#4  0x00007f9de8c08157 in ThreadWeaver::ThreadRunHelper::run(ThreadWeaver::WeaverImpl*, ThreadWeaver::Thread*) () from /usr/lib64/libthreadweaver.so.4
#5  0x00007f9de8c081eb in ThreadWeaver::Thread::run() () from /usr/lib64/libthreadweaver.so.4
#6  0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#8  0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f9d7c9e0700 (LWP 24000)):
[KCrash Handler]
#6  0x00007f9de4b36615 in raise () from /lib64/libc.so.6
#7  0x00007f9de4b378ba in abort () from /lib64/libc.so.6
#8  0x00007f9de67a952c in qt_message_output(QtMsgType, char const*) () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f9de67a969b in qt_message(QtMsgType, char const*, __va_list_tag*) () from /usr/lib64/qt4/libQtCore.so.4
#10 0x00007f9de67a9804 in qFatal(char const*, ...) () from /usr/lib64/qt4/libQtCore.so.4
#11 0x00007f9dc878d38f in QList<CMakeFunctionArgument>::operator[] (this=0x7f9d7c9def28, i=3) at /usr/include/qt4/QtCore/qlist.h:473
#12 0x00007f9dc878ae84 in StringAst::parseFunctionInfo (this=0x2fa16d0, func=...) at /home/david/Projects/kdevelop/projectmanagers/cmake/parser/cmakeast.cpp:2951
#13 0x00007f9dc87a1254 in CMakeProjectVisitor::walk (this=0x7f9d7c9df300, fc=..., line=4, isClean=<optimized out>) at /home/david/Projects/kdevelop/projectmanagers/cmake/parser/cmakeprojectvisitor.cpp:2190
#14 0x00007f9dc87bae91 in CMakeParserUtils::includeScript (file=..., parent=..., data=0x16b6f28, sourcedir=..., env=...) at /home/david/Projects/kdevelop/projectmanagers/cmake/parser/cmakeparserutils.cpp:175
#15 0x00007f9dbfedf7a9 in CMakeManager::includeScript (this=<optimized out>, file=..., project=0x173ec70, dir=<optimized out>, parent=...) at /home/david/Projects/kdevelop/projectmanagers/cmake/cmakemanager.cpp:646
#16 0x00007f9dbfee1c4b in CMakeManager::parse (this=0x12570b0, item=0x1d02430) at /home/david/Projects/kdevelop/projectmanagers/cmake/cmakemanager.cpp:701
#17 0x00007f9de373c85e in KDevelop::ImportProjectJobPrivate::import (this=0x1b2c7e0, folder=<optimized out>) at /home/david/Projects/kdevplatform/project/importprojectjob.cpp:53
#18 0x00007f9de373c386 in QtConcurrent::RunFunctionTask<void>::run (this=0x1a4e4b0) at /usr/include/qt4/QtCore/qtconcurrentrunbase.h:134
#19 0x00007f9de67a7d98 in QThreadPoolThread::run() () from /usr/lib64/qt4/libQtCore.so.4
#20 0x00007f9de67b393b in QThreadPrivate::start(void*) () from /usr/lib64/qt4/libQtCore.so.4
#21 0x00007f9de651cc2c in start_thread () from /lib64/libpthread.so.0
#22 0x00007f9de4bd87bd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f9dea87a760 (LWP 23904)):
#0  0x00007f9de652132c in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007f9de67b3e3b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib64/qt4/libQtCore.so.4
#2  0x00007f9de67a6e1e in QThreadPoolPrivate::waitForDone(int) () from /usr/lib64/qt4/libQtCore.so.4
#3  0x00007f9de67a7764 in QThreadPool::~QThreadPool() () from /usr/lib64/qt4/libQtCore.so.4
#4  0x00007f9de67a77a9 in QThreadPool::~QThreadPool() () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f9de67a89a5 in QGlobalStaticDeleter<QThreadPool>::~QGlobalStaticDeleter() () from /usr/lib64/qt4/libQtCore.so.4
#6  0x00007f9de4b38ec9 in __run_exit_handlers () from /lib64/libc.so.6
#7  0x00007f9de4b38f15 in exit () from /lib64/libc.so.6
#8  0x00007f9de5ac4fd8 in qt_xio_errhandler () from /usr/lib64/qt4/libQtGui.so.4
#9  0x00007f9de70d66d8 in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib64/libkdeui.so.5
#10 0x00007f9de29b387e in _XIOError () from /usr/lib64/libX11.so.6
#11 0x00007f9de29b10fd in _XEventsQueued () from /usr/lib64/libX11.so.6
#12 0x00007f9de29a1c8f in XEventsQueued () from /usr/lib64/libX11.so.6
#13 0x00007f9de5afb32c in x11EventSourceCheck(_GSource*) () from /usr/lib64/qt4/libQtGui.so.4
#14 0x00007f9de00bd513 in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#15 0x00007f9de00bdd6a in g_main_context_iterate.clone.6 () from /usr/lib64/libglib-2.0.so.0
#16 0x00007f9de00be201 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#17 0x00007f9de68da9db in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#18 0x00007f9de5afb4ee in QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtGui.so.4
#19 0x00007f9de68abc82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#20 0x00007f9de68abed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/qt4/libQtCore.so.4
#21 0x00007f9de68b0855 in QCoreApplication::exec() () from /usr/lib64/qt4/libQtCore.so.4
#22 0x000000000040a804 in main (argc=<optimized out>, argv=<optimized out>) at /home/david/Projects/kdevelop/app/main.cpp:479
Comment 2 Aleix Pol 2012-01-18 00:19:10 UTC
Git commit 2097e88ab998dfd4e53791c2911ebad6eaaded2f by Aleix Pol.
Committed on 18/01/2012 at 01:17.
Pushed by apol into branch '4.3'.

When a variable is empty, resolve it as an empty argument

Doesn't have anything to do with the bug description but
it's what was going on there.

M  +3    -1    projectmanagers/cmake/parser/cmakelistsparser.cpp
M  +4    -0    projectmanagers/cmake/tests/cmake_cmakeprojectvisitor_test.cpp

http://commits.kde.org/kdevelop/2097e88ab998dfd4e53791c2911ebad6eaaded2f
Comment 3 Aleix Pol 2012-01-18 00:19:11 UTC
Git commit 02e743ee8639a6bc66b5b4f1d633cb541e9c44d0 by Aleix Pol.
Committed on 18/01/2012 at 01:17.
Pushed by apol into branch 'master'.

When a variable is empty, resolve it as an empty argument

Doesn't have anything to do with the bug description but
it's what was going on there.

M  +3    -1    projectmanagers/cmake/parser/cmakelistsparser.cpp
M  +4    -0    projectmanagers/cmake/tests/cmake_cmakeprojectvisitor_test.cpp

http://commits.kde.org/kdevelop/02e743ee8639a6bc66b5b4f1d633cb541e9c44d0