[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Review Request 111335: Fix for one of the oldest KIO bugs: multiple dialogs when KIO encounters
From: "Andreas Hartmetz" <ahartmetz () gmail ! com>
Date: 2013-07-03 10:47:59
Message-ID: 20130703104759.8337.86714 () vidsolbach ! de
[Download RAW message or body]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111335/#review35497
-----------------------------------------------------------
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26051>
Just return a QString. With the pointer you have more verbosity in the caller, \
and the state of key is unclear after the call because it may or may not have been \
changed.
The Request could be passed as a const reference here, so why not do that?
Would it make sense to have this method in the Request class as
QString key() const ?
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26055>
braces
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26043>
kdelibs style: always use braces (even if this code is copied from somewhere \
else)
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26050>
What the heck did I do there? :O
(/*H4X*/ is something I use to mark temporary hacks)
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26046>
m_cachedResults is never cleaned - I admit that this is not much different from \
the SSL config file never losing exceptions stored there.
So I suggest cleaning m_cachedResults, but the current patch is not significantly \
worse than what we have.
This is related to making an SSL exception for "current sessions only", which is \
actually for 30 minutes. Unless you also make it really for current sessions, after \
30 minutes would be a good time to clear such entries.
kio/kio/scheduler.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26048>
Should be easier to just make it a child of the public class.
kio/kio/slaveinterface.cpp
<http://git.reviewboard.kde.org/r/111335/#comment26049>
Early return for less nesting
- Andreas Hartmetz
On July 1, 2013, 5:10 a.m., Dawit Alemayehu wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111335/
> -----------------------------------------------------------
>
> (Updated July 1, 2013, 5:10 a.m.)
>
>
> Review request for kdelibs.
>
>
> Description
> -------
>
> The attached patch addresses one of the oldest bugs in KIO. Due to the muti-process \
> nature of KIO, if any of the ioslaves encounter something that requires user input, \
> the user might end up getting prompted multiple times. The best example of this is \
> SSL error warnings sent to the client by kio_http. The patch completely resolves \
> this problem using the same approach as kpasswdserver, but without the need for an \
> additional kded process.
>
> This addresses bugs 154100 and 265228.
> http://bugs.kde.org/show_bug.cgi?id=154100
> http://bugs.kde.org/show_bug.cgi?id=265228
>
>
> Diffs
> -----
>
> kio/kio/scheduler.h 04edb40
> kio/kio/scheduler.cpp 802f8b8
> kio/kio/scheduler_p.h d68f645
> kio/kio/slaveinterface.h 4bfcec8
> kio/kio/slaveinterface.cpp aa0fc44
> kio/kio/slaveinterface_p.h e31ec5e
>
> Diff: http://git.reviewboard.kde.org/r/111335/diff/
>
>
> Testing
> -------
>
> Visit a site that throws up SSL warnings and causes KIO to show more than one error \
> dialog.
>
> Thanks,
>
> Dawit Alemayehu
>
>
[Attachment #3 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/111335/">http://git.reviewboard.kde.org/r/111335/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line660" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">660</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span \
class="k">static</span> <span class="kt">void</span> <span \
class="n">extractMessageBoxRequestKey</span><span class="p">(</span><span \
class="n">UserNotificationHandler</span><span class="o">::</span><span \
class="n">Request</span><span class="o">*</span> <span class="n">r</span><span \
class="p">,</span> <span class="n">QString</span><span class="o">*</span> <span \
class="n">key</span><span class="p">)</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Just return \
a QString. With the pointer you have more verbosity in the caller, and the state of \
key is unclear after the call because it may or may not have been changed.
The Request could be passed as a const reference here, so why not do that?
Would it make sense to have this method in the Request class as
QString key() const ?</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line689" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">689</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span \
class="n">m_pendingRequests</span><span class="p">.</span><span \
class="n">count</span><span class="p">()</span> <span class="o">==</span> <span \
class="mi">1</span><span class="p">)</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">braces</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line726" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">726</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">buttonYes</span> <span \
class="o">==</span> <span class="n">i18n</span><span class="p">(</span><span \
class="s">"&Details"</span><span class="p">))</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">kdelibs \
style: always use braces (even if this code is copied from somewhere else)</pre> \
</div> <br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line781" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">781</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">if</span> <span class="p">(</span><span class="n">decodedOk</span> \
<span class="o">||</span> <span class="nb">true</span><span \
class="cm">/*H4X*/</span><span class="p">)</span> <span class="p">{</span></pre></td> \
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">What the \
heck did I do there? :O (/*H4X*/ is something I use to mark temporary hacks)</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line808" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">808</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">m_cachedResults</span><span class="p">.</span><span \
class="n">insert</span><span class="p">(</span><span class="n">key</span><span \
class="p">,</span> <span class="n">result</span><span class="p">);</span> <span \
class="c1">// store result for later use</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">m_cachedResults is never cleaned - I admit that this is not much \
different from the SSL config file never losing exceptions stored there.
So I suggest cleaning m_cachedResults, but the current patch is not significantly \
worse than what we have.
This is related to making an SSL exception for "current sessions only", \
which is actually for 30 minutes. Unless you also make it really for current \
sessions, after 30 minutes would be a good time to clear such entries.</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166900#file166900line833" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/scheduler.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
ProtoQueue::startAJob()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">833</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">delete</span> <span class="n">userNotificationHandler</span><span \
class="p">;</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Should be \
easier to just make it a child of the public class.</pre> </div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/111335/diff/1/?file=166903#file166903line384" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kio/kio/slaveinterface.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">381</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="n">d</span><span \
class="o">-></span><span class="n">connection</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Early \
return for less nesting</pre> </div>
<br />
<p>- Andreas</p>
<br />
<p>On July 1st, 2013, 5:10 a.m. UTC, Dawit Alemayehu wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for kdelibs.</div>
<div>By Dawit Alemayehu.</div>
<p style="color: grey;"><i>Updated July 1, 2013, 5:10 a.m.</i></p>
<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;">The attached patch addresses one of the oldest bugs in KIO. Due to the \
muti-process nature of KIO, if any of the ioslaves encounter something that requires \
user input, the user might end up getting prompted multiple times. The best example \
of this is SSL error warnings sent to the client by kio_http. The patch completely \
resolves this problem using the same approach as kpasswdserver, but without the need \
for an additional kded process.</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;">Visit a site that throws up SSL warnings and causes KIO to show more \
than one error dialog. </pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=154100">154100</a>,
<a href="http://bugs.kde.org/show_bug.cgi?id=265228">265228</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>kio/kio/scheduler.h <span style="color: grey">(04edb40)</span></li>
<li>kio/kio/scheduler.cpp <span style="color: grey">(802f8b8)</span></li>
<li>kio/kio/scheduler_p.h <span style="color: grey">(d68f645)</span></li>
<li>kio/kio/slaveinterface.h <span style="color: grey">(4bfcec8)</span></li>
<li>kio/kio/slaveinterface.cpp <span style="color: grey">(aa0fc44)</span></li>
<li>kio/kio/slaveinterface_p.h <span style="color: grey">(e31ec5e)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/111335/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic