<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D14376">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">What is your own answer to this? ;)</pre></div></blockquote>
<p>Would I ask the question if I had the answer?<br />
Given that this issue doesn't occur in KDevelop itself (nor in the test on Linux) I'd say one would either handle the error situation gracefully, or bail out from the test as soon as it's detected.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">Please try to investigate why the document is not returned from the controller as one would expect by the code.</pre></div></blockquote>
<p>On Linux, <tt style="background: #ebebeb; font-size: 13px;">Core::self()->documentController()->openDocument(url)</tt> returns the same pointer as <tt style="background: #ebebeb; font-size: 13px;">Core::self()->documentController()->documentForUrl(url)</tt> does later. On Mac the former returns a valid pointer, the latter returns NULL. It looks like this may well mean that the document isn't actually opened (or not registered in <tt style="background: #ebebeb; font-size: 13px;">DocumentCOntrollerPrivate::documents</tt> but that seems extremely unlikely).</p>
<p>Edit: this may be it:</p>
<p><tt style="background: #ebebeb; font-size: 13px;">DocumentControllerPrivate::openDocumentInternal</tt> is one of those functions that uses asserts instead of proper runtime checks that don't disappear in release builds:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">// The url in the document must equal the current url, else the housekeeping will get broken
Q_ASSERT(!doc || doc->url() == url);</pre></div>
<p>adding that comparison and trace output to test_assistants.cpp gives this on the terminal:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">QWARN : TestAssistants::testRenameAssistant(Prepend Text) openDocument QUrl("file:///var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T/test_assistants-OT8CTF/0.h") doc= 0x7fe1532bd6a0
QSYSTEM: TestAssistants::testRenameAssistant(Prepend Text) doc->url= QUrl("file:///private/var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T/test_assistants-OT8CTF/0.h") != QUrl("file:///var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T/test_assistants-OT8CTF/0.h")
QWARN : TestAssistants::testRenameAssistant(Prepend Text) docForUrl QUrl("file:///var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T/test_assistants-OT8CTF/0.h") (adjusted= QUrl("file:///var/folders/j1/1439ppj08xj8h6006s6drbq00000gs/T/test_assistants-OT8CTF/0.h") )= 0x0</pre></div>
<p>This is indeed a Mac-specific issue: /var is a symlink to /private/var and file name normalisation is almost unavoidable on Mac (and hardcoded here, I think).</p>
<p>That means the situation is to be expected and my fix isn't wrong in itself, but maybe we can avoid the cause by doing the normalisation step after generating the url and before using it(?).</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D14376">https://phabricator.kde.org/D14376</a></div></div><br /><div><strong>To: </strong>rjvbb, kossebau<br /><strong>Cc: </strong>kossebau, kdevelop-devel, antismap, iodelay, vbspam, njensen, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>