<table><tr><td style="">Lekensteyn created this revision.<br />Restricted Application added a project: Frameworks.<br />Restricted Application added a subscriber: Frameworks.
</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/D4975" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>On Linux, even if slave activity is detected on a master fd, FIONREAD<br />
can still return zero available bytes in the buffer. Previously this<br />
would prevent further signals from being emitted even if new IO arrived<br />
(since the readNotifier is disabled) which in its turn prevented the<br />
Konsole output from being updated.</p>
<p>A race condition in the kernel is suspected, the first known broken<br />
kernel is v4.1.10-89-g5eb491ba5d06.</p>
<p>BUG: 372991</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested in conjunction with konsole v16.12.1-60-g151215a9 with this debug patch applied:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="diff" 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);"><span style="color: #000080">diff --git a/src/kptydevice.cpp b/src/kptydevice.cpp</span>
<span style="color: #000080">index 92b443b..4dfcd02 100644</span>
<span style="color: #a00000">--- a/src/kptydevice.cpp</span>
<span style="color: #00a000">+++ b/src/kptydevice.cpp</span>
<span style="color: #800080">@@ -273,6 +273,7 @@ struct KPtyDevicePrivate : public KPtyPrivate {</span>
KRingBuffer writeBuffer;
};
<span style="color: #00a000">+#include <cstdio></span>
bool KPtyDevicePrivate::_k_canRead()
{
Q_Q(KPtyDevice);
<span style="color: #800080">@@ -310,6 +311,9 @@ bool KPtyDevicePrivate::_k_canRead()</span>
// select() will trigger again anyway if an EOF condition was found, and
// only then we will accept it.
if (!available && !maybeEof) {
<span style="color: #00a000">+ FILE *fp = fopen("/tmp/EOF", "a");</span>
<span style="color: #00a000">+ fprintf(fp, "Maybe EOF!?\n");</span>
<span style="color: #00a000">+ fclose(fp);</span>
maybeEof = true;
return true;
} else if (available) {</pre></div>
<p>Indeed, the /tmp/EOF file is being written and the Konsole output no longer "hangs".</p>
<p>Closing a tab (via EOF in bash or closing the tab) somehow does not trigger this debug print, perhaps the watcher is disabled elsewhere. (This is an observation and not a problem.)</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R291 KPty</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D4975" rel="noreferrer">https://phabricator.kde.org/D4975</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/kptydevice.cpp</div></div></div><br /><div><strong>To: </strong>Lekensteyn, hindenburg, Konsole<br /><strong>Cc: </strong>Frameworks<br /></div>