<table><tr><td style="">pino added a comment.
</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/D17816">View Revision</a></tr></table><br /><div><div><p>Nice progresses, thanks for the fixes. I added few more notes, just mentioning the first occurrence of each.<br />
One more thing is to print errno (and possibly its string representation using <tt style="background: #ebebeb; font-size: 13px;">strerror</tt>/<tt style="background: #ebebeb; font-size: 13px;">strerror_r</tt>) on failure, so that the debugging is easier.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98743">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:454</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">perms</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0666</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #74777d">// copy the file with file_copy</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">extra empty line</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98745">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:534</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d">     * Set xattrs on source file using default linux commandline</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d">     * TODO: port to multiplatfom</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d">     * TODO: write tests for copyAs</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">you can use <tt style="background: #ebebeb; font-size: 13px;">QStandardPaths::findExecutable()</tt> to check whether <tt style="background: #ebebeb; font-size: 13px;">setfattr</tt> is available, and QSKIP the test if not</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98744">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:540</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QString</span> <span class="n">command</span> <span style="color: #aa2211">=</span> <span class="n">QString</span><span class="p">(</span><span style="color: #766510">"setfattr -n user.baloo.rating -v 1 %1"</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">src</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">start</span><span class="p">(</span><span class="n">command</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">waitForFinished</span><span class="p">(</span><span style="color: #aa2211">-</span><span style="color: #601200">1</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">please use the <tt style="background: #ebebeb; font-size: 13px;">QProcess::start(QString,QStringList)</tt> variant, splitting the arguments; this way there is no need to manual quoting the paths, and thus avoid problems with spaces</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98746">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:540</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QString</span> <span class="n">command</span> <span style="color: #aa2211">=</span> <span class="n">QString</span><span class="p">(</span><span style="color: #766510">"setfattr -n user.baloo.rating -v 1 %1"</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">src</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">start</span><span class="p">(</span><span class="n">command</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">waitForFinished</span><span class="p">(</span><span style="color: #aa2211">-</span><span style="color: #601200">1</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">check using <tt style="background: #ebebeb; font-size: 13px;">QVERIFY</tt>/<tt style="background: #ebebeb; font-size: 13px;">QCOMPARE</tt> that the process was started correctly</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98747">View Inline</a><span style="color: #4b4d51; font-weight: bold;">jobtest.cpp:541</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">start</span><span class="p">(</span><span class="n">command</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">xattrwriter</span><span class="p">.</span><span class="n">waitForFinished</span><span class="p">(</span><span style="color: #aa2211">-</span><span style="color: #601200">1</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">command</span> <span style="color: #aa2211">=</span> <span class="n">QString</span><span class="p">(</span><span style="color: #766510">"setfattr -n user.fnoValue %1"</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">src</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">check using <tt style="background: #ebebeb; font-size: 13px;">QVERIFY</tt>/<tt style="background: #ebebeb; font-size: 13px;">QCOMPARE</tt> that the process ended correctly</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98748">View Inline</a><span style="color: #4b4d51; font-weight: bold;">CMakeLists.txt:5-6</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">check_include_files(sys/extattr.h HAVE_SYS_EXTATTR_H)
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">good checks, although they fit better in <tt style="background: #ebebeb; font-size: 13px;">ConfigureChecks.cmake</tt> (which is there for a reasons ;) )</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98749">View Inline</a><span style="color: #4b4d51; font-weight: bold;">copyjob.cpp:2192</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span style="color: #aa2211">!</span><span class="n">QFileInfo</span><span style="color: #aa2211">::</span><span class="n">exists</span><span class="p">(</span><span class="n">source</span><span class="p">.</span><span class="n">toLocalFile</span><span class="p">())</span> <span style="color: #aa2211">&&</span> <span style="color: #aa2211">!</span><span class="n">QFileInfo</span><span style="color: #aa2211">::</span><span class="n">exists</span><span class="p">(</span><span class="n">dest</span><span class="p">.</span><span class="n">toLocalFile</span><span class="p">()))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">qCWarning</span><span class="p">(</span><span class="n">KIO_COPYJOB_DEBUG</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"failed to open source and destiny"</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">return</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">destiny is another thing ;) "destination" in this case</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98750">View Inline</a><span style="color: #4b4d51; font-weight: bold;">copyjob.cpp:2205-2209</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">listlen</span> <span style="color: #aa2211"><</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">qCWarning</span><span class="p">(</span><span class="n">KIO_COPYJOB_DEBUG</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"libc failed to extract xattr from "</span> <span style="color: #aa2211"><<</span> <span class="n">xattrsrc</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}</span> <span style="color: #aa4000">else</span> <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">listlen</span> <span style="color: #aa2211">==</span> <span style="color: #601200">0</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">qCDebug</span><span class="p">(</span><span class="n">KIO_COPYJOB_DEBUG</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"File "</span> <span style="color: #aa2211"><<</span> <span class="n">xattrsrc</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">" don't have any xattr."</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">this is more of a personal taste rather than an issue: IMHO you can avoid the "if .. else if ... else" that adds a nesting level more, especially when all the checks lead to early return; so something like:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" 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);">if (listlen < 0) {
  if (errno != ENOTSUP) {
    qCWarning(KIO_COPYJOB_DEBUG) << "failed to extract xattr from" << xattrsrc;
  }
  return;

if (listlen == 0) {
  qCDebug(KIO_COPYJOB_DEBUG) << "File" << xattrsrc << "doesn't have any xattr.";
  return;
}
[etc..]</pre></div></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D17816#inline-98751">View Inline</a><span style="color: #4b4d51; font-weight: bold;">copyjob.cpp:2256</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">errno</span> <span style="color: #aa2211">==</span> <span class="n">ENOTSUP</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                    <span class="n">qCWarning</span><span class="p">(</span><span class="n">KIO_COPYJOB_DEBUG</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"destination filesystem don't support xattrs."</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">IMHO this is not a warning worth situation</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17816">https://phabricator.kde.org/D17816</a></div></div><br /><div><strong>To: </strong>cochise, dfaure<br /><strong>Cc: </strong>abika, pino, davidedmundson, ngraham, atha.kane, spoorun, nicolasfella, kde-frameworks-devel, michaelh, bruns<br /></div>