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










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On August 6th, 2016, 12:13 p.m. UTC, <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  


<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="https://git.reviewboard.kde.org/r/128618/diff/1/?file=473180#file473180line1531" style="color: black; font-weight: bold; text-decoration: underline;">src/core/copyjob.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">1531</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="n">KIO</span><span class="o">::</span><span class="n">StatJob</span> <span class="o">*</span><span class="n">job</span> <span class="o">=</span> <span class="n">KIO</span><span class="o">::</span><span class="n">stat</span><span class="p">(</span><span class="n">uDest</span><span class="p">.</span><span class="n">adjusted</span><span class="p">(</span><span class="n">QUrl</span><span class="o">::</span><span class="n">RemoveFilename</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>

</table>

  <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;">CopyJob stats the destination already, no need to do it again.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">See line 410, the local path for the dest is even stored already:
m_dest = QUrl::fromLocalFile(sLocalPath);</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">So you should be able to just use if (m_dest.isLocalFile()) { ... } here.</p></pre>
 </blockquote>



 <p>On August 6th, 2016, 3:42 p.m. UTC, <b>Chinmoy Ranjan Pradhan</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;">In case of symlinks KIO::stat will fail because the destination doesn't exist at the time of stat.</p></pre>
 </blockquote>





 <p>On August 6th, 2016, 6:03 p.m. UTC, <b>David Faure</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;">Wrong, it's stating the destination <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">directory</em>.</p></pre>
 </blockquote>





 <p>On August 7th, 2016, 4:05 a.m. UTC, <b>Chinmoy Ranjan Pradhan</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;">CopyJob will stat the destination directory only if it has been passed as a parameter. But in KNewFileMenu the url of final link that is going to be created is passed to KIO::link(this is also the case with KIO::copyAs as well). That's why the stating fails.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">(I used bunch of debug statements to confirm this failure)</p></pre>
 </blockquote>





 <p>On August 7th, 2016, 8:11 a.m. UTC, <b>David Faure</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;">Then KNewFileMenu should use KIO::linkAs rather than KIO::link.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">(Not sure this will change what is being stat'ed though, please check)</p></pre>
 </blockquote>





 <p>On August 7th, 2016, 8:28 a.m. UTC, <b>Chinmoy Ranjan Pradhan</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;">I dont think using KIO::linkAs will make any difference. In its implementation <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">asMethod</em> is set to false. So its as good as KIO::link.</p></pre>
 </blockquote>







</blockquote>
<pre style="margin-left: 1em; 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;">Indeed, that was a copy/paste error. I now added unittests for KIO::link and KIO::linkAs, and fixed KIO::linkAs to work as advertised. So now I can say it for sure: KNewFileMenu should use KIO::linkAs (so that it fails when the user types the name of an existing directory, rather than create the link under that directory).</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">However this indeed doesn't help with the issue at hand, since CopyJob will stat the given dest URL, which doesn't exist yet (that's the whole point, checking if we can create it).</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">OK then for the additional KIO::stat, but it has to be done asynchronously, no exec() inside a job. I.e. move the code under the exec to a separate slot.</p></pre>
<br />




<p>- David</p>


<br />
<p>On August 6th, 2016, 11:53 a.m. UTC, Chinmoy Ranjan Pradhan 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 KDE Frameworks and David Faure.</div>
<div>By Chinmoy Ranjan Pradhan.</div>


<p style="color: grey;"><i>Updated Aug. 6, 2016, 11:53 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</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;">KIO::link creates symlink when either protocol+host+port+username+password of the source and the link are same or the link is going to be created locally. In case of plasma's folder view none of the above cases are true therefore creating a symlink in folder view plasmoid gives an error.<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
This patch aims to fix this issue.</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/core/copyjob.cpp <span style="color: grey">(c4c6b2c)</span></li>

</ul>

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



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>


 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/08/06/d4da6ff3-53d8-49d1-a826-0c8cf12d7aa0__symlink_folderview.png">error message</a></li>

</ul>




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







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