Bug 362613

Summary: Crash when opening files with double-quote(s) in name.
Product: [Applications] kdevelop Reporter: Francis Herne <mail>
Component: file selectorAssignee: kdevelop-bugs-null
Status: RESOLVED DUPLICATE    
Severity: crash    
Priority: NOR    
Version: 4.90.91   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Francis Herne 2016-05-03 09:25:46 UTC
When opening files containing one or more double-quote characters:
e.g. «Testfile("Word").txt» or «Test\"word.txt»
via the file selector, KDevelop crashes.

Opening such a file by itself via the file selector is impossible, when clicking on the 'Open' button nothing happens. When ctrl-clicking or dragging to select multiple files, one or more of which have a double-quote character in their name, the result below occurs.

If doing this in a session, all future attempts to load that session will crash KDevelop in the same way.  The session must be deleted and recreated.

Opening such a file via the Filesystem pane, or from a CLI argument, is successful.

KATE also fails to open such files, either reporting that parts of the filename aren't files or opening the wrong file, but doesn't crash.

Gwenview and other KDE applications fail to open such files, but also don't crash.

Hmm, this bug probably shouldn't be here. But I typed it now. :P

Reproducible: Always

Steps to Reproduce:
1. Create a file named 'Test-"File".txt'.
2. In the file selector, attempt to open that file.
 - Clicking 'Open' will have no effect.
3. In the file selector, attempt to open that file along with at least one other file.
 - KDevelop will crash.
4. Restart KDevelop using the same session.
 - KDevelop will crash again.

Actual Results:  
ASSERT: "!inputUrl.fileName().isEmpty()" in file /home/flh/projects/src/kdevplatform/shell/documentcontroller.cpp, line 226

On another occasion I got:
kdevplatform.language: INVALID URL ENCOUNTERED: "/home/flh/ " QUrl("file:///home/flh/")
ASSERT: "isValidURL(url)" in file /home/flh/projects/src/kdevplatform/language/backgroundparser/backgroundparser.cpp, line 534


Backtrace:
=========

Thread 1 "kdevelop" received signal SIGABRT, Aborted.
0x00007ffff43ac2a8 in raise () from /usr/lib/libc.so.6
(gdb) bt full
#0  0x00007ffff43ac2a8 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff43ad72a in abort () from /usr/lib/libc.so.6
No symbol table info available.
#2  0x00007ffff4b2ef41 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#3  0x00007ffff4b2a26e in qt_assert(char const*, char const*, int) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#4  0x00007ffff22cee7e in KDevelop::BackgroundParser::addDocument (this=<optimized out>, url=..., features=features@entry=KDevelop::TopDUContext::AllDeclarationsContextsAndUses, priority=priority@entry=0, 
    notifyWhenReady=notifyWhenReady@entry=0x0, flags=..., flags@entry=...) at /home/flh/projects/src/kdevplatform/language/backgroundparser/backgroundparser.cpp:534
        lock = <optimized out>
#5  0x00007ffff22ef4a1 in KDevelop::DUChain::documentLoadedPrepare (this=<optimized out>, doc=0x2433570) at /home/flh/projects/src/kdevplatform/language/duchain/duchain.cpp:1534
        url = {m_index = 495347}
        lock = {m_lock = 0x7ffff2afbba0 <KDevelop::(anonymous namespace)::Q_QGS_sdDUChainPrivate::innerFunction()::holder+32>, m_locked = true, m_timeout = 0}
        l = {val = 140737264991105}
        standardContext = 0x0
        chains = {<QListSpecialMethods<KDevelop::TopDUContext*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, 
                        _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        languages = {<QListSpecialMethods<KDevelop::ILanguageSupport*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, 
                        _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}
        __PRETTY_FUNCTION__ = "void KDevelop::DUChain::documentLoadedPrepare(KDevelop::IDocument*)"
#6  0x00007ffff4d46bae in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#7  0x00007ffff6da0252 in KDevelop::IDocumentController::documentLoadedPrepare (this=<optimized out>, _t1=_t1@entry=0x2433570) at /home/flh/projects/src/build/interfaces/moc_idocumentcontroller.cpp:565
        _a = {0x0, 0x7fffffffc3a8}
#8  0x00007ffff6d93db0 in KDevelop::IDocument::notifyLoaded (this=0x2433570) at /home/flh/projects/src/kdevplatform/interfaces/idocument.cpp:130
No locals.
#9  0x00007ffff4d46bae in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#10 0x00007ffff0a7c962 in KTextEditor::Document::textChanged(KTextEditor::Document*) () from /usr/lib/libKF5TextEditor.so.5
No symbol table info available.
#11 0x00007ffff08e932b in KTextEditor::DocumentPrivate::openFile() () from /usr/lib/libKF5TextEditor.so.5
No symbol table info available.
#12 0x00007ffff0580fc1 in ?? () from /usr/lib/libKF5Parts.so.5
No symbol table info available.
#13 0x00007ffff0581edc in KParts::ReadOnlyPart::openUrl(QUrl const&) () from /usr/lib/libKF5Parts.so.5
No symbol table info available.
#14 0x00007ffff08d5e79 in KTextEditor::DocumentPrivate::openUrl(QUrl const&) () from /usr/lib/libKF5TextEditor.so.5
No symbol table info available.
#15 0x00007ffff7ad546b in KDevelop::TextDocument::createViewWidget (this=0x2433550, parent=0xd45bb0) at /home/flh/projects/src/kdevplatform/shell/textdocument.cpp:307
        view = 0x0
#16 0x00007ffff7ad3880 in KDevelop::TextView::createWidget (this=0x20cff00, parent=0xd45bb0) at /home/flh/projects/src/kdevplatform/shell/textdocument.cpp:578
        widget = <optimized out>
#17 0x00007ffff1810fa1 in Sublime::View::widget (this=0x20cff00, parent=parent@entry=0xd45bb0) at /home/flh/projects/src/kdevplatform/sublime/view.cpp:76
No locals.
#18 0x00007ffff1809848 in Sublime::MainWindowPrivate::ViewCreator::operator() (this=this@entry=0x7fffffffcbc0, index=index@entry=0xf296c0) at /home/flh/projects/src/kdevplatform/sublime/mainwindow_p.cpp:407
        widget = <optimized out>
        view = 0x20cff00
        _container_ = {c = {<QListSpecialMethods<Sublime::View*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, 
                          _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x2d0a640}, d = 0x2d0a640}}, i = {i = 0x2d0a658}, e = {i = 0x2d0a660}, control = 1}
        container = 0xd45bb0
        position = 1
        hadActiveView = true
        activeView = 0xdf05d0
        splitter = <optimized out>
        __PRETTY_FUNCTION__ = "Sublime::Area::WalkerMode Sublime::MainWindowPrivate::ViewCreator::operator()(Sublime::AreaIndex*)"
#19 0x00007ffff1810215 in Sublime::Area::walkViewsInternal<Sublime::MainWindowPrivate::ViewCreator> (this=0x6c45e0, op=..., index=index@entry=0xf296c0) at /home/flh/projects/src/kdevplatform/sublime/areawalkers.h:32
---Type <return> to continue, or q <return> to quit---
        mode = <optimized out>
#20 0x00007ffff180bd34 in Sublime::Area::walkViews<Sublime::MainWindowPrivate::ViewCreator> (index=0xf296c0, op=..., this=<optimized out>) at /home/flh/projects/src/kdevplatform/sublime/areawalkers.h:48
No locals.
#21 Sublime::MainWindowPrivate::viewAdded (this=0xe1ab50, index=0xf296c0, view=0x20cff00) at /home/flh/projects/src/kdevplatform/sublime/mainwindow_p.cpp:582
        viewCreator = {d = 0xe1ab50, topViews = {q_hash = {{d = 0x3f57c20, e = 0x3f57c20}}}}
#22 0x00007ffff4d46bae in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#23 0x00007ffff18214b8 in Sublime::Area::viewAdded (this=this@entry=0x6c45e0, _t1=_t1@entry=0xf296c0, _t2=_t2@entry=0x20cff00) at /home/flh/projects/src/build/sublime/moc_area.cpp:276
        _a = {0x0, 0x7fffffffcd28, 0x7fffffffcd20}
#24 0x00007ffff17ebc41 in Sublime::Area::addView (this=this@entry=0x6c45e0, view=view@entry=0x20cff00, index=0xf296c0, after=<optimized out>, after@entry=0x0) at /home/flh/projects/src/kdevplatform/sublime/area.cpp:177
        __PRETTY_FUNCTION__ = "void Sublime::Area::addView(Sublime::View*, Sublime::AreaIndex*, Sublime::View*)"
#25 0x00007ffff17ec90d in Sublime::Area::addView (this=this@entry=0x6c45e0, view=view@entry=0x20cff00, after=after@entry=0xdf05d0) at /home/flh/projects/src/kdevplatform/sublime/area.cpp:189
        index = <optimized out>
#26 0x00007ffff7ae0e77 in KDevelop::DocumentControllerPrivate::openDocumentInternal (this=this@entry=0x242b5b0, doc=doc@entry=0x2433570, range=..., activationParams=..., activationParams@entry=..., buddy=<optimized out>, 
    buddy@entry=0x0) at /home/flh/projects/src/kdevplatform/shell/documentcontroller.cpp:495
        activeAreaIndex = <optimized out>
        afterActiveDoc = <optimized out>
        pos = <optimized out>
        activeDoc = <optimized out>
        activeView = 0xdf05d0
        activeDoc = <optimized out>
        buddyFinder = <optimized out>
        buddyView = 0x0
        placeAfterBuddy = <optimized out>
        partView = <optimized out>
        activeViewIdx = <optimized out>
        addView = true
        previousActiveDocument = 0x2d17a00
        previousActiveTextView = <optimized out>
        previousActivePosition = {m_line = 0, m_column = 0}
        url = {d = 0x242b190}
        uiController = 0x7f75a0
        area = <optimized out>
        sdoc = <optimized out>
        emitOpened = true
        activePosition = <optimized out>
#27 0x00007ffff7ae192b in KDevelop::DocumentControllerPrivate::openDocumentInternal (this=this@entry=0x242b5b0, inputUrl=..., prefName=..., range=..., encoding=..., activationParams=..., activationParams@entry=..., 
    buddy=0x0) at /home/flh/projects/src/kdevplatform/shell/documentcontroller.cpp:341
        _encoding = {static null = {<No data fields>}, d = 0x2497040}
        url = {d = 0x242b190}
        doc = 0x2433570
        __PRETTY_FUNCTION__ = "KDevelop::IDocument* KDevelop::DocumentControllerPrivate::openDocumentInternal(const QUrl&, const QString&, const KTextEditor::Range&, const QString&, KDevelop::IDocumentController::DocumentActivation"...
#28 0x00007ffff7ae23b6 in KDevelop::DocumentControllerPrivate::chooseDocument (this=0x242b5b0) at /home/flh/projects/src/kdevplatform/shell/documentcontroller.cpp:159
        _container_ = {c = {<QListSpecialMethods<QUrl>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, 
                  alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x29f6b90}, d = 0x29f6b90}}, i = {i = 0x29f6ba8}, e = {i = 0x29f6bb0}, control = 1}
        encoding = {static null = {<No data fields>}, d = 0x2497040}
        res = {urls = {<QListSpecialMethods<QUrl>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, 
                  alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x29f6b90}, d = 0x29f6b90}}, encoding = {static null = {<No data fields>}, d = 0x2497040}}
#29 0x00007ffff4d46bae in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#30 0x00007ffff5a353d2 in QAction::triggered(bool) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#31 0x00007ffff5a37ef0 in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#32 0x00007ffff5a3884f in QAction::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#33 0x00007ffff5a3e68c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#34 0x00007ffff5a438f6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
No symbol table info available.
#35 0x00007ffff4d1a518 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#36 0x00007ffff528f826 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#37 0x00007ffff528f8d9 in QShortcutMap::tryShortcut(QKeyEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#38 0x00007ffff5248716 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) ()
   from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#39 0x00007ffff5260a14 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#40 0x00007ffff5265b65 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#41 0x00007ffff5242d6b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
No symbol table info available.
#42 0x00007fffd7a72e60 in ?? () from /usr/lib/libQt5XcbQpa.so.5
No symbol table info available.
#43 0x00007fffec105f07 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#44 0x00007fffec106160 in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#45 0x00007fffec10620c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#46 0x00007ffff4d6fc8f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#47 0x00007ffff4d186fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#48 0x00007ffff4d20b7c in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
No symbol table info available.
#49 0x000000000040cbfa in main (argc=2, argv=<optimized out>) at /tmp/yaourt-tmp-flh/aur-kdevelop-git/src/kdevelop/app/main.cpp:680
        timer = {t1 = -9223372036854775808, t2 = -9223372036854775808}
        description = "The KDevelop Integrated Development Environment"
        aboutData = {d = 0x63b240}
        debugArgs = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4,
                          _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}, <No data fields>}
        debugeeName = {static null = {<No data fields>}, d = 0x7ffff4dc7ee0 <QArrayData::shared_null>}
        app = {<QApplication> = {<No data fields>}, <No data fields>}
        migrator = {d = 0x690d90}
        __PRETTY_FUNCTION__ = "int main(int, char**)"
        parser = {d = 0x6492f0}
        initialFiles = {d = 0x7ffff4dc7ee0 <QArrayData::shared_null>}
        session = {static null = {<No data fields>}, d = 0x9712c0}
        nRunningSessions = <optimized out>
        splash = <optimized out>
        core = 0xf2e9a0
        projectNames = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4,
                          _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7ffff4dc9d40 <QListData::shared_null>}, d = 0x7ffff4dc9d40 <QListData::shared_null>}}, <No data fields>}
Comment 1 Francis Herne 2016-05-03 09:30:43 UTC
Correction: Steps to reproduce are true for a file with one doublequote, not two as shown.

In case of two, opening a single file, KDevelop will open (create) a file with the fragment of the filename between the quotes.

When opening multiple files, KDevelop may open/create files with the end fragments instead.

Everything is wrong, anyway.
Comment 2 Francis Herne 2016-05-03 09:53:15 UTC
I suppose this is the right bug, unfixed for seven years: https://bugs.kde.org/show_bug.cgi?id=185433

Opening different files to the one requested seems seriously wrong to me. :-/
Comment 3 Francis Herne 2017-03-11 03:57:37 UTC

*** This bug has been marked as a duplicate of bug 185433 ***