Bug 387829 - Discover segfaults on launch with current git master; introduced with da846ebf85f3cfcdd30df5a977e6a2b7e1320d28
Summary: Discover segfaults on launch with current git master; introduced with da846eb...
Status: RESOLVED NOT A BUG
Alias: None
Product: Discover
Classification: Applications
Component: discover (show other bugs)
Version: 5.11.4
Platform: Neon Linux
: NOR critical
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-12 14:12 UTC by Nate Graham
Modified: 2017-12-12 15:26 UTC (History)
0 users

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 Nate Graham 2017-12-12 14:12:31 UTC
Discover compiled from current git master (HEAD at 7202c8ed8dab3003f6e2804aea823f91ac766181) segfaults on launch.

The issue appears to have been introduced with commit 	da846ebf85f3cfcdd30df5a977e6a2b7e1320d28. Everything after that commit segfaults for me; everything before it works fine. Here is the backtrace:


$ gdb plasma-discover 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from plasma-discover...(no debugging symbols found)...done.
(gdb) start
Temporary breakpoint 1 at 0x415175
Starting program: /usr/local/bin/plasma-discover 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, 0x0000000000415175 in main ()
(gdb) bt
#0  0x0000000000415175 in main ()
(gdb) c
Continuing.
[New Thread 0x7fffe571c700 (LWP 5076)]
[New Thread 0x7fffdcbda700 (LWP 5077)]
[New Thread 0x7fffd75ef700 (LWP 5078)]
[New Thread 0x7fffc8f18700 (LWP 5079)]
[New Thread 0x7fffbe9eb700 (LWP 5080)]

Thread 1 "plasma-discover" received signal SIGSEGV, Segmentation fault.
0x00007ffff3d6c0f0 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
(gdb) bt
#0  0x00007ffff3d6c0f0 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#1  0x00007ffff3d7336c in QRegExp::operator=(QRegExp const&) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#2  0x00007ffff3d734dd in QRegExp::QRegExp(QRegExp const&) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff3df372d in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff3df4907 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff3df59a4 in QDirIterator::next() ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffbd954a7d in ?? ()
   from /usr/lib/x86_64-linux-gnu/qt5/plugins/discover/kns-backend.so
#7  0x00007ffff6be2985 in DiscoverBackendsFactory::backendForFile(QString const&, QString const&) const ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#8  0x00007ffff6be26d4 in DiscoverBackendsFactory::backend(QString const&) const () from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#9  0x00007ffff6be2f83 in DiscoverBackendsFactory::allBackends() const::{lambda(QString const&)#1}::operator()(QString const&) const ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#10 0x00007ffff6be3630 in QVector<AbstractResourcesBackend*> kTransform<QVector<AbstractResourcesBackend*>, QStringList, DiscoverBackendsFactory::allBackends() const::{lambda(QString const&)#1}>(QStringList const&, DiscoverBackendsFactory::allBackends() const::{lambda(QString const&)#1}) ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#11 0x00007ffff6be2fee in DiscoverBackendsFactory::allBackends() const ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#12 0x00007ffff6bc1fce in ResourcesModel::registerAllBackends() ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#13 0x00007ffff6bf6d7b in ResourcesModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
   from /usr/local/lib/x86_64-linux-gnu/plasma-discover/libDiscoverCommon.so
#14 0x00007ffff3f09e49 in QObject::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff54eeb7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff54f6587 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff3edc988 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
Comment 1 Aleix Pol 2017-12-12 14:43:07 UTC
Can you see if this solves your issue? I'ts a very weird crash in QRegExp... :/

diff --git a/libdiscover/backends/KNSBackend/KNSBackend.cpp b/libdiscover/backends/KNSBackend/KNSBackend.cpp
index 0ea70dcd..883cb729 100644
--- a/libdiscover/backends/KNSBackend/KNSBackend.cpp
+++ b/libdiscover/backends/KNSBackend/KNSBackend.cpp
@@ -65,12 +65,9 @@ class KNSBackendFactory : public AbstractResourcesBackendFactory {
         {
             QVector<AbstractResourcesBackend*> ret;
             for (const QString &path: QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
-                QDirIterator dirIt(path, {QStringLiteral("*.knsrc")}, QDir::Files);
-                for(; dirIt.hasNext(); ) {
-                    dirIt.next();
-
-                    auto bk = new KNSBackend(parent, QStringLiteral("plasma"), dirIt.filePath());
-                    ret += bk;
+                QDir dir(path);
+                for(auto file: dir.entryInfoList({QStringLiteral("*.knsrc")}, QDir::Files)) {
+                    ret += new KNSBackend(parent, QStringLiteral("plasma"), file.absolutePath());
                 }
             }
             return ret;
Comment 2 Aleix Pol 2017-12-12 14:47:24 UTC
You have two discover installed, your master one is loading plugins from the one from 5.11.
Comment 3 Nate Graham 2017-12-12 15:26:01 UTC
You're right, sorry for wasting time.