~roguescholar/kdevelop/+git/trunk:work/debug-relative-bp-url-path-crash

Last commit made on 2024-04-21
Get this branch:
git clone -b work/debug-relative-bp-url-path-crash https://git.launchpad.net/~roguescholar/kdevelop/+git/trunk

Branch merges

Branch information

Name:
work/debug-relative-bp-url-path-crash
Repository:
lp:~roguescholar/kdevelop/+git/trunk

Recent commits

93ac824... by Igor Kushnir <email address hidden>

Debug relative breakpoint URL path crash

OUTPUT:
setData QUrl("file:noprefix") true "noprefix" false false "noprefix"
setLocation QUrl("file:noprefix") 0
open document: QUrl("file:noprefix") true "noprefix" false false "noprefix" false
createViewWidget QUrl("file:noprefix") true true "noprefix" false false "noprefix" "file"
empty normalized
"" QUrl("")
toUrl() QUrl("http://noprefix") "noprefix"
toUrl() QUrl("http://noprefix") "noprefix"
toUrl() QUrl("http://noprefix") "noprefix"
toUrl() QUrl("http://noprefix") "noprefix"
setData QUrl("file:./dotslash") true "./dotslash" false false "./dotslash"
setLocation QUrl("file:./dotslash") 0
open document: QUrl("file:dotslash") true "dotslash" false false "dotslash" false
createViewWidget QUrl("file:dotslash") true true "dotslash" false false "dotslash" "file"
empty normalized
"" QUrl("")
toUrl() QUrl("http://dotslash") "dotslash"
toUrl() QUrl("http://dotslash") "dotslash"
toUrl() QUrl("http://dotslash") "dotslash"
toUrl() QUrl("http://dotslash") "dotslash"
setData QUrl("file:../dotdotslash") true "../dotdotslash" false false "../dotdotslash"
setLocation QUrl("file:../dotdotslash") 0
open document: QUrl("file:../dotdotslash") true "../dotdotslash" false false "../dotdotslash" false
createViewWidget QUrl("file:../dotdotslash") true true "../dotdotslash" false false "../dotdotslash" "file"
empty normalized
"" QUrl("")
toUrl() QUrl("") "../dotdotslash"
ASSERT: "!ret.isRelative()" in file /path/to/kdevelop/kdevplatform/serialization/indexedstring.cpp, line 330
*** Program received signal SIGABRT (Aborted) ***

ANALYSIS:
1. See https://doc.qt.io/qt-5/qurl.html#relative-urls-vs-relative-paths
2. An IndexedString assertion fails given a relative ../ URL path.
3. IndexedString produces a wrong URL scheme (http) given a relative ./
   URL path.

PROPOSED FIX:
Sanitize breakpoint URLs constructed from user input and read from
config:
1. Add `&& QFileInfo(url.path()).isAbsolute()` into
   isSupportedBreakpointUrl().
2. If an URL read from config is unsupported (a relative URL path or a
   user edited the config file
   ~/.local/share/kdevelop/sessions/{session-UUID}/sessionrc and
   produced a relative URL or an URL with an empty filename), set it to
   an empty URL.
3. Is there any other way to assign an unsupported URL to a breakpoint
   that needs to be prevented?

c6f307b... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn

3460acc... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn

77583ef... by Jarmo

BreakpointModel: add support for renaming documents with breakpoints

If an open document is renamed or saved as in KDevelop, its URL
changes. Currently, any breakpoints associated with the previous URL
are not updated to use the new URL of the document. Consequently, the
breakpoints can no longer be accessed at the document border and can
only be further interacted with in the Breakpoints tool view. Thus,
most user interactions with the document's breakpoints break after the
renaming.

BreakpointModel also wrongly acts as if the renamed document no longer
contains any of its former breakpoints, even though none of them has
been removed. The abandoned breakpoints' moving cursors usually keep
pointing to the renamed document, and so the moving cursors' document
URLs no longer match the out-of-date Breakpoint::url() values. This
inconsistency can cause further bugs down the road.

Fix these bugs by reassigning the breakpoints' URLs in the new
BreakpointModel::documentUrlChanged() slot.

e1b1b7e... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn

a6f5f5b... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn

ea2b24e... by Jarmo

BreakpointModel: inform the user when toggling fails

53b5e10... by Jarmo

BreakpointModel: prevent breakpoints in untitled documents

For an untitled/unsaved document, IDocument::url() returns
"file:///Untitled"* but KTextEditor::Document::url() returns an empty
URL. This difference causes bugs in BreakpointModel, because it assumes
the two functions are the same and uses whichever is more convenient.

Breakpoints in an untitled document are useless, because a debugger
cannot work with a KTextEditor buffer, only with a file on disk.

Implement a simple fix: prevent adding breakpoints to untitled
documents. First of all, do not enable breakpoint marks for an untitled
document in textDocumentCreated(). This leaves only bookmarks in the
untitled document border mark user interface, and therefore ensures
that markChanged() is never invoked with a breakpoint mark in an
untitled document.

In order to allow adding breakpoints as soon as an untitled document is
saved, enable breakpoint marks in documentSaved(). Optimize
documentSaved() along the way by returning early if a non-text document
is saved.

Prevent toggleBreakpoint() and markContextMenuRequested() from adding a
breakpoint to an untitled document by early-returning if breakpoint
marks are not enabled.

45c8785... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn

788055c... by l10n daemon script <email address hidden>

GIT_SILENT Sync po/docbooks with svn