<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/129984/">https://git.reviewboard.kde.org/r/129984/</a>
     </td>
    </tr>
   </table>
   <br />



<table bgcolor="#e0e0e0" width="100%" cellpadding="12" style="border: 1px gray solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>
   <h1 style="margin: 0; padding: 0; font-size: 10pt;">This change has been discarded.</h1>
  </td>
 </tr>
</table>
<br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for Konsole and Kurt Hindenburg.</div>
<div>By Peter Wu.</div>


<p style="color: grey;"><i>Updated March 8, 2017, 11:52 a.m.</i></p>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://bugs.kde.org/show_bug.cgi?id=372991">372991</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kpty
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">On Linux, even if slave activity is detected on a master fd, FIONREAD
can still return zero available bytes in the buffer. Previously this
would prevent further signals from being emitted even if new IO arrived
(since the readNotifier is disabled) which in its turn prevented the
Konsole output from being updated.

A race condition in the kernel is suspected, the first known broken
kernel is v4.1.10-89-g5eb491ba5d06.

BUG: 372991</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Tested in conjunction with konsole v16.12.1-60-g151215a9 with this debug patch applied:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #000080; font-weight: bold">diff --git a/src/kptydevice.cpp b/src/kptydevice.cpp</span>
<span style="color: #000080; font-weight: bold">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; font-weight: bold">@@ -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; font-weight: bold">@@ -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>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Indeed, the /tmp/EOF file is being written and the Konsole output no longer "hangs".</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">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></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/kptydevice.cpp <span style="color: grey">(22233a505d32d988795839cb592098c38f7fab33)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/129984/diff/" style="margin-left: 3em;">View Diff</a></p>






  </td>
 </tr>
</table>



  </div>
 </body>
</html>