Bug 168434 - editing regexp while searching the scrollback buffer causes crash
Summary: editing regexp while searching the scrollback buffer causes crash
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-05 18:03 UTC by Jiri Palecek
Modified: 2008-08-13 05:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Palecek 2008-08-05 18:03:29 UTC
Version:            (using KDE 4.1.0)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When searching for regexp matches, konsole crashes. Steps to reproduce:

0. Choose "search scrollback" in the menu
1. Type "\b\S+\b" in the search box
2. Check "match regular expressions" [btw. nothing happens, which is another bug]
3. Append and delete a space at the end of the search box [words in the buffer should be highited now]
4. Substitute "+" for "*" in the regexp, so it is "\b\S*\b"
5. crash

In the stderr output, i see this:

ASSERT: "_searchText.matchedLength() > 0" in file /tmp/buildd/kdebase-4.1.0/apps/konsole/src/Filter.cpp, line 391
Comment 1 Dario Andres 2008-08-05 18:21:17 UTC
Version 2.1 Using KDE 4.1.1 (KDE 4.1.0 (4.1 >= 20080722)) (KDEmod) in ArchLinux i686:

I can reproduce this bug

Here is the full backtrace:

Aplicación: Konsole (konsole), señal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb6394700 (LWP 5856)]
[New Thread 0xb4bdcb90 (LWP 5857)]
[KCrash handler]
#6  0xb7f5e424 in __kernel_vsyscall ()
#7  0xb6714740 in raise () from /lib/libc.so.6
#8  0xb6716078 in abort () from /lib/libc.so.6
#9  0xb7409c8e in qt_message_output () from /usr/lib/libQtCore.so.4
#10 0xb7409d2e in qFatal () from /usr/lib/libQtCore.so.4
#11 0xb7409db9 in qt_assert () from /usr/lib/libQtCore.so.4
#12 0xb7ed7a09 in Konsole::RegExpFilter::process (this=0x928f660)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/Filter.cpp:391
#13 0xb7ed754e in Konsole::FilterChain::process (this=0x91728a0)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/Filter.cpp:84
#14 0xb7f20aaf in Konsole::TerminalDisplay::processFilters (this=0x9240528)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/TerminalDisplay.cpp:896
#15 0xb7f08890 in Konsole::SessionController::updateSearchFilter (
    this=0x9204688)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:165
#16 0xb7f113cc in Konsole::SessionController::qt_metacall (this=0x9204688, 
    _c=QMetaObject::InvokeMetaMethod, _id=40, _a=0xbf877ccc)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.moc:177
#17 0xb74ef8d7 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#18 0xb74efded in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0xb7f00d84 in Konsole::ScreenWindow::scrolled (this=0x920a838, _t1=0)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/ScreenWindow.moc:92
#20 0xb7f0f4e0 in Konsole::SearchHistoryTask::highlightResult (
    this=0x9349400, window={o = 0xbf877d9c}, findPos=0)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:1458
#21 0xb7f0f996 in Konsole::SearchHistoryTask::executeOnScreenWindow (
    this=0x9349400, session={o = 0xbf877e48}, window={o = 0xbf877e44})
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:1430
#22 0xb7f0fc22 in Konsole::SearchHistoryTask::execute (this=0x9349400)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:1322
#23 0xb7f094ef in Konsole::SessionController::beginSearch (this=0x9204688, 
    text=@0xbf877ff8, direction=0)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:908
#24 0xb7f095b2 in Konsole::SessionController::searchTextChanged (
    this=0x9204688, text=@0xbf877ff8)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.cpp:879
#25 0xb7f11499 in Konsole::SessionController::qt_metacall (this=0x9204688, 
    _c=QMetaObject::InvokeMetaMethod, _id=31, _a=0xbf877fcc)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/SessionController.moc:168
#26 0xb74ef8d7 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#27 0xb74efded in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#28 0xb7edcf96 in Konsole::IncrementalSearchBar::searchChanged (
    this=0x913a0e8, _t1=@0xbf877ff8)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/IncrementalSearchBar.moc:97
#29 0xb7edd1b6 in Konsole::IncrementalSearchBar::notifySearchChanged (
    this=0x913a0e8)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/IncrementalSearchBar.cpp:153
#30 0xb7edd23d in Konsole::IncrementalSearchBar::qt_metacall (this=0x913a0e8, 
    _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0xbf8780a8)
    at /home/jan/Source/packages/kde41/work/kdebase/src/kdebase-4.1.0/apps/konsole/src/IncrementalSearchBar.moc:86
#31 0xb74ef8d7 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#32 0xb74efded in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#33 0xb7523270 in QTimer::timeout () from /usr/lib/libQtCore.so.4
#34 0xb74f6adf in QTimer::timerEvent () from /usr/lib/libQtCore.so.4
#35 0xb74ec712 in QObject::event () from /usr/lib/libQtCore.so.4
#36 0xb6a68f13 in QApplicationPrivate::notify_helper ()
   from /usr/lib/libQtGui.so.4
#37 0xb6a6fa1c in QApplication::notify () from /usr/lib/libQtGui.so.4
#38 0xb7a8ef4c in KApplication::notify (this=0xbf8787e4, receiver=0x92057a0, 
    event=0xbf87854c)
    at /home/jan/Source/packages/kde41/work/kdelibs/src/kdelibs-4.1.0/kdeui/kernel/kapplication.cpp:311
#39 0xb74df30c in QCoreApplication::notifyInternal ()
   from /usr/lib/libQtCore.so.4
#40 0xb75068ce in ?? () from /usr/lib/libQtCore.so.4
#41 0xbf8787e4 in ?? ()
#42 0x092057a0 in ?? ()
#43 0xbf87854c in ?? ()
#44 0xb63f8bbc in ?? () from /usr/lib/libxcb.so.1
#45 0x090775f0 in ?? ()
#46 0xb6394700 in ?? ()
#47 0xbf878508 in ?? ()
#48 0x092057a0 in ?? ()
#49 0x090775fc in ?? ()
#50 0xb63fab48 in ?? () from /usr/lib/libxcb-xlib.so.0
#51 0x0000414a in ?? ()
#52 0x00000001 in ?? ()
#53 0x00000000 in ?? ()
#0  0xb7f5e424 in __kernel_vsyscall ()
Comment 2 Oliver Putz 2008-08-07 20:50:30 UTC
Confirming. Backtrace for KDE-4.1.0:

Application: Konsole (konsole), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb6299700 (LWP 7243)]
[New Thread 0xb4e39b90 (LWP 7244)]
[KCrash handler]
#6  0xffffe424 in __kernel_vsyscall ()
#7  0xb654db91 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#8  0xb654f378 in *__GI_abort () at abort.c:88
#9  0xb7485097 in qt_message_output (msgType=QtFatalMsg, 
    buf=0xbfcc20ac "ASSERT: \"_searchText.matchedLength() > 0\" in file /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/Filter.cpp, line 391") at global/qglobal.cpp:2058
#10 0xb748514f in qFatal (msg=0xb75d8ab4 "ASSERT: \"%s\" in file %s, line %d")
    at global/qglobal.cpp:2260
#11 0xb74855cb in qt_assert (
    assertion=0xb7f936d8 "_searchText.matchedLength() > 0", 
    file=0xb7f935fc "/var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/Filter.cpp", line=391) at global/qglobal.cpp:1828
#12 0xb7f2768a in Konsole::RegExpFilter::process (this=0x920e980)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/Filter.cpp:391
#13 0xb7f266a2 in Konsole::FilterChain::process (this=0x8ac4a38)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/Filter.cpp:84
#14 0xb7f6f1bb in Konsole::TerminalDisplay::processFilters (this=0x90a8cb0)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/TerminalDisplay.cpp:896
#15 0xb7f5c247 in Konsole::SessionController::updateSearchFilter (
    this=0x90a6140)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:165
#16 0xb7f5c5dd in Konsole::SessionController::qt_metacall (this=0x90a6140, 
    _c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbfcc42cc)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/SessionController.moc:177
#17 0xb7598530 in QMetaObject::activate (sender=0x90b8c48, 
    from_signal_index=<value optimized out>, to_signal_index=5, 
    argv=<value optimized out>) at kernel/qobject.cpp:3001
#18 0xb7598c92 in QMetaObject::activate (sender=0x90b8c48, m=0xb7fa1684, 
    local_signal_index=1, argv=0xbfcc42cc) at kernel/qobject.cpp:3071
#19 0xb7f4ece1 in Konsole::ScreenWindow::scrolled (this=0x90b8c48, _t1=2)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/ScreenWindow.moc:92
#20 0xb7f4ee24 in Konsole::ScreenWindow::scrollTo (this=0x90b8c48, line=2)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/ScreenWindow.cpp:232
#21 0xb7f55d1c in Konsole::SearchHistoryTask::highlightResult (
    this=0x91f4468, window=@0xbfcc43f4, findPos=2)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:1458
#22 0xb7f5643a in Konsole::SearchHistoryTask::executeOnScreenWindow (
    this=0x91f4468, session=@0xbfcc4448, window=@0xbfcc4444)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:1430
#23 0xb7f5651f in Konsole::SearchHistoryTask::execute (this=0x91f4468)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:1322
#24 0xb7f5816a in Konsole::SessionController::beginSearch (this=0x90a6140, 
    text=@0xbfcc45e8, direction=0)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:908
#25 0xb7f5839f in Konsole::SessionController::searchTextChanged (
    this=0x90a6140, text=@0xbfcc45e8)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/SessionController.cpp:879
#26 0xb7f5c522 in Konsole::SessionController::qt_metacall (this=0x90a6140, 
    _c=QMetaObject::InvokeMetaMethod, _id=40, _a=0xbfcc45bc)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/SessionController.moc:168
#27 0xb7598530 in QMetaObject::activate (sender=0x909c190, 
    from_signal_index=<value optimized out>, to_signal_index=27, 
    argv=<value optimized out>) at kernel/qobject.cpp:3001
#28 0xb7598c92 in QMetaObject::activate (sender=0x909c190, m=0xb7fa0c04, 
    local_signal_index=0, argv=0xbfcc45bc) at kernel/qobject.cpp:3071
#29 0xb7f2e403 in Konsole::IncrementalSearchBar::searchChanged (
    this=0x909c190, _t1=@0xbfcc45e8)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/IncrementalSearchBar.moc:97
#30 0xb7f2e54b in Konsole::IncrementalSearchBar::notifySearchChanged (
    this=0x909c190)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/IncrementalSearchBar.cpp:153
#31 0xb7f2e650 in Konsole::IncrementalSearchBar::qt_metacall (this=0x909c190, 
    _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0xbfcc4688)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/IncrementalSearchBar.moc:86
#32 0xb7598530 in QMetaObject::activate (sender=0x909da50, 
    from_signal_index=<value optimized out>, to_signal_index=4, 
    argv=<value optimized out>) at kernel/qobject.cpp:3001
#33 0xb7598c92 in QMetaObject::activate (sender=0x909da50, m=0xb766e924, 
    local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3071
#34 0xb75d7e8d in QTimer::timeout (this=0x909da50)
    at .moc/debug-shared/moc_qtimer.cpp:126
#35 0xb75a119a in QTimer::timerEvent (this=0x909da50, e=0xbfcc4b88)
    at kernel/qtimer.cpp:263
#36 0xb7594296 in QObject::event (this=0x909da50, e=0xbfcc4b88)
    at kernel/qobject.cpp:1096
#37 0xb688a8a4 in QApplicationPrivate::notify_helper (this=0x805cfd0, 
    receiver=0x909da50, e=0xbfcc4b88) at kernel/qapplication.cpp:3772
#38 0xb688ea75 in QApplication::notify (this=0xbfcc4e48, receiver=0x909da50, 
    e=0xbfcc4b88) at kernel/qapplication.cpp:3366
#39 0xb7b506c3 in KApplication::notify (this=0xbfcc4e48, receiver=0x909da50, 
    event=0xbfcc4b88)
    at /var/tmp/portage/kde-base/kdelibs-4.1.0/work/kdelibs-4.1.0/kdeui/kernel/kapplication.cpp:311
#40 0xb7582d59 in QCoreApplication::notifyInternal (this=0xbfcc4e48, 
    receiver=0x909da50, event=0xbfcc4b88) at kernel/qcoreapplication.cpp:587
#41 0xb75b085a in QTimerInfoList::activateTimers (this=0x805d71c)
    at kernel/qcoreapplication.h:215
#42 0xb75b09d0 in QEventDispatcherUNIX::activateTimers (this=0x805cdf0)
    at kernel/qeventdispatcher_unix.cpp:837
#43 0xb75b1f7e in QEventDispatcherUNIX::processEvents (this=0x805cdf0, 
    flags=@0xbfcc4d08) at kernel/qeventdispatcher_unix.cpp:899
#44 0xb691af61 in QEventDispatcherX11::processEvents (this=0x805cdf0, 
    flags=@0xbfcc4d38) at kernel/qeventdispatcher_x11.cpp:154
#45 0xb75820d3 in QEventLoop::processEvents (this=0xbfcc4db0, 
    flags=@0xbfcc4d78) at kernel/qeventloop.cpp:149
#46 0xb7582246 in QEventLoop::exec (this=0xbfcc4db0, flags=@0xbfcc4db8)
    at kernel/qeventloop.cpp:200
#47 0xb7584401 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:845
#48 0xb688a23f in QApplication::exec () at kernel/qapplication.cpp:3304
#49 0xb7f8f3c5 in kdemain (argc=1, argv=0xbfcc4f84)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole-4.1.0/apps/konsole/src/main.cpp:100
#50 0x08048872 in main (argc=)
    at /var/tmp/portage/kde-base/konsole-4.1.0/work/konsole_build/apps/konsole/src/konsole_dummy.cpp:3
#0  0xffffe424 in __kernel_vsyscall ()
Comment 3 Kurt Hindenburg 2008-08-10 22:10:09 UTC
Confirmed on trunk

If you click on match regexp first and then enter \b, it crashes

konsole(20003) Konsole::SearchHistoryTask::highlightResult: Found result at line  357
ASSERT: "_searchText.matchedLength() > 0" in file /mnt/hda6/KDE/svn/trunk/KDE/kdebase/apps/konsole/src/Filter.cpp, line 391
konsole(20003) Konsole::SessionManager::~SessionManager: Konsole SessionManager destroyed with sessions still alive
Comment 4 Kurt Hindenburg 2008-08-12 07:31:20 UTC
This code seems to have problems with \b which will cause _searchText.matchedLength() to be 0.

Robert, is there any reason you didn't just check for matchLength() == 0 and then set pos = -1 in place of the Q_ASSERT?

This prevents the crashing.
Comment 5 Robert Knight 2008-08-12 12:50:30 UTC
Hi Kurt,

Sure - please do.  The Q_ASSERT was used originally because I didn't think that matchLength() == 0 was possible.
Comment 6 Kurt Hindenburg 2008-08-12 17:12:18 UTC
SVN commit 845891 by hindenburg:

Fix crash for regexp's that return matchLength() == 0 such as \b

BUG: 168434


 M  +2 -1      Filter.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=845891
Comment 7 Kurt Hindenburg 2008-08-13 05:33:58 UTC
I committed this to the 4.1 branch also

SVN commit 845894 by hindenburg: