<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/125613/">https://git.reviewboard.kde.org/r/125613/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On Octubre 12th, 2015, 7:29 p.m. UTC, <b>Albert Astals Cid</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="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;">Do you think you can add an unittest for this or is it hard to recreate the conditionts?</p></pre>
 </blockquote>




 <p>On Octubre 12th, 2015, 7:43 p.m. UTC, <b>Alberto Jiménez Ruiz</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="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;">It happens to very few people. Most developers tried to reproduce bug 333436 and bug 162211(I believe they are closely related) with no luck. The heart of this bug is that sometimes a child ListJob fails silently and I emulated an "error" making an unaccessable folder. A unit test for this would need root privileges.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">When I ran across this bug copying stuff with dolphin, I tried to recreate it copying folders thousands of times. I couldn't.</p></pre>
 </blockquote>





 <p>On Octubre 12th, 2015, 7:48 p.m. UTC, <b>Albert Astals Cid</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="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;">Why would you need test privileges to create a folder you can't access, that's doable without being root, no?</p></pre>
 </blockquote>





 <p>On Octubre 12th, 2015, 7:53 p.m. UTC, <b>Thomas Lübking</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="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;">"Depends" - your file, your control.
You can remove and re-add permissions at will; kio might be too "smart to" be challenged by permissions, but chattr might come to the rescue (ie. turn the inaccessible file immutable - kio not smart enough for /that/ ;-)</p></pre>
 </blockquote>








</blockquote>

<pre style="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;">chmodding to 000 works. I'm writing a unittest.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">For completion, here's how I emulated it in KDE Plasma 5 (Kubuntu 15.10 beta) and KDE 4.X (It also happens)</p>
<h1 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">Perform on empty folder</h1>
<h1 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">Activate in kdebugdialog kio (7007)</h1>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">mkdir src
mkdir src/c
mkdir src/c/b
dd if=/dev/urandom of=src/c/a bs=1M count=10
dd if=/dev/urandom of=src/c/b/d bs=1M count=10
chmod 000 src/c/b</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">kioclient copy src dst</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">You should see:
klauncher(1553)/kio (KLauncher) KLauncher::requestSlave: KLauncher: launching new slave  "kio_file"  with protocol= "file"  args= ("file", "local:/run/user/1000/ksocket-alberto/klauncherhX1553.slave-socket", "local:/run/user/1000/ksocket-alberto/kioclientZT1614.slave-socket")
klauncher(1553)/kio (KLauncher) KLauncher::processRequestReturn: "kio_file" (pid 1615) up and running.
kioclient(1614)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  111   "/home/alberto/prueba2/dst"
klauncher(1553)/kio (KLauncher) KLauncher::requestSlave: KLauncher: launching new slave  "kio_file"  with protocol= "file"  args= ("file", "local:/run/user/1000/ksocket-alberto/klauncherhX1553.slave-socket", "local:/run/user/1000/ksocket-alberto/kioclientCj1614.slave-socket")
klauncher(1553)/kio (KLauncher) KLauncher::processRequestReturn: "kio_file" (pid 1616) up and running.
kioclient(1614)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  117   "/home/alberto/prueba2/src/c/b"
kioclient(1614)/kio (KIOJob) KIO::CopyJobPrivate::statCurrentSrc: Stating finished. To copy: 10506240 , available: 21012074496
kioclient(1614)/kio (KIOJob) KIO::SimpleJob::~SimpleJob: Killing job KIO::SimpleJob(0xf98e00) in destructor! "[
0: /usr/lib/libkdecore.so.5(kRealBacktrace(int)+0x50) [0x7f6948647c20]
1: /usr/lib/libkio.so.5(KIO::SimpleJob::~SimpleJob()+0xb7) [0x7f69491984f7]
2: /usr/lib/libkio.so.5(KIO::ListJob::~ListJob()+0x9) [0x7f6949198809]
3: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QObject::event(QEvent<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">)+0x1f8) [0x7f6947f76d28]
4: /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QApplicationPrivate::notify_helper(QObject</em>, QEvent<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">)+0x8c) [0x7f69472a5cdc]
5: /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QApplication::notify(QObject</em>, QEvent<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">)+0x2b6) [0x7f69472acc16]
6: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QCoreApplication::notifyInternal(QObject</em>, QEvent<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">)+0x8d) [0x7f6947f5c85d]
7: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QCoreApplicationPrivate::sendPostedEvents(QObject</em>, int, QThreadData*)+0x376) [0x7f6947f60316]
8: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(+0x1bb07e) [0x7f6947f8d07e]
9: /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2a7) [0x7f6943111ff7]
10: /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4a250) [0x7f6943112250]
11: /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7f69431122fc]
12: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)+0x7e) [0x7f6947f8d1ee]
13: /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x26fc26) [0x7f6947350c26]
14: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)+0x41) [0x7f6947f5b0d1]
15: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)+0x1b5) [0x7f6947f5b445]
16: /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QCoreApplication::exec()+0x99) [0x7f6947f61429]
17: kioclient() [0x404d64]
18: kioclient() [0x405faf]
19: kioclient() [0x403b5e]
20: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f69469b5a40]
21: kioclient(_start+0x29) [0x404599]
]
"</p></pre>
<br />










<p>- Alberto</p>


<br />
<p>On Octubre 12th, 2015, 7:11 p.m. UTC, Alberto Jiménez Ruiz wrote:</p>








<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 kdelibs.</div>
<div>By Alberto Jiménez Ruiz.</div>


<p style="color: grey;"><i>Updated Oct. 12, 2015, 7:11 p.m.</i></p>







<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=333436">333436</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs
</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Race condition and error notification loss in ListJob</p></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;">Tests done on Kubuntu 15.10:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With this folder structure in ~:
src</p>
<h6 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">c (Folder)</h6>
<h6 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">########b (Folder chmod'ed to 700 and owned by root)</h6>
<h6 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">#################d (10MB file made of /dev/urandom data)</h6>
<h6 style="font-size: 100%;text-rendering: inherit;padding: 0;white-space: normal;margin: 0;line-height: inherit;">########a (10MB file made of /dev/urandom data)</h6>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Then, (as a normal user execute: "kioclient ~/src ~/dst")</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Expected result: Notification that some files were not able to be copied (Cannot access "b" folder)
Result with latest kdelibs: Silent copying where b folder is owned by user but nothing inside.
---When all kdebugdialog flags are set, a backtrace is also seen.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">subError notifications for listjob subjobs are lost, Copyjob uses this signal to skip data.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Also, this fix prevents a race condition. </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">ListJob has another ListJob as a subjob.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Chaild fails for whatever reason and calls error, which calls slotError, which calls slotsFinished and emitResult.
The result of the child gets collected by parent. slotResult of parent gets called, removes subjob and emitsresult because there are no subjobs left.
---That's fine as long as the slave associated with the parent emits finished before the child fails. If it doesn't, parent calls emitsResult twice.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Result after patch: kioclient shows a MessageBox telling the copy operation could not be completed.</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>kio/kio/job.cpp <span style="color: grey">(91712e3)</span></li>

 <li>kio/kio/jobclasses.h <span style="color: grey">(d771cfe)</span></li>

</ul>

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






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







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