<table><tr><td style="">chinmoyr updated this revision to Diff 24583.<br />chinmoyr 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/D6830" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Changes:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">Added method tryChangeAttr. This will call chown/chmod/utime in copy with elevated privileges only during the brief period authorization is kept.</li>
</ol>
<p>2.Added check for unit test mode at beginning of copy. "copy" calls execWihElevatedPrivileges number of times but for unit test once is enough.<br />
3.Replaced dest_file.setPermissions(...) with the static version. This will ensure that the error code set when using file decriptor is either EACCES or EPERM.</p>
<p><a href="https://phabricator.kde.org/p/dfaure/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@dfaure</a> I was curious about this block of code</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 (!src_file.open(QIODevice::ReadOnly)) {
if (auto err = tryOpen(src_file, _src, O_RDONLY, S_IRUSR)) {
if (!err.wasCanceled()) {
error(KIO::ERR_CANNOT_OPEN_FOR_READING, src);
}
return;
}
}</pre></div>
<p>In case the operation is canceled the function returns without calling error or finished. While testing these changes with dolphin I never got any warning so I ignored.<br />
But isn't it wrong? If that's the case then I have fix every block similar to this and with "copy" and "put" changes will definitely look ugly.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D6830?vs=20366&id=24583" rel="noreferrer">https://phabricator.kde.org/D6830?vs=20366&id=24583</a></div></div><br /><div><strong>BRANCH</strong><div><div>6830</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D6830" rel="noreferrer">https://phabricator.kde.org/D6830</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/ioslaves/file/file.h<br />
src/ioslaves/file/file_unix.cpp<br />
src/ioslaves/file/file_win.cpp</div></div></div><br /><div><strong>To: </strong>chinmoyr, dfaure, Frameworks<br /><strong>Cc: </strong>elvisangelaccio, Frameworks<br /></div>