SUMMARY KIO::file_copy will not report 'Operation not permitted' as a result of chattr +i as not a KJob::NoError on job->error(). STEPS TO REPRODUCE 1. Make a file /home/user/test.txt 2. chattr +i /home/user/test.txt 3. Run this code snippet: QPointer<KIO::FileCopyJob> const moveJob = KIO::file_copy( QUrl::fromLocalFile( "/home/user/test.txt" ), QUrl::fromLocalFile( "/home/user/target.txt" ), -1, KIO::HideProgressInfo | KIO::Overwrite ); connect( moveJob.data(), &KJob::result, this, [ moveJob]( KJob* job ) { bool failed = false; if ( !moveJob ) { qWarning() << "Failed A"; } else { if ( moveJob->error() != KJob::NoError && job->error() != KJob::NoError ) { qWarning() << "Failed B"; } else { qWarning() << "Succeeded"; } } } ); OBSERVED RESULT * kf.kio.workers.file, Warning: Couldn't remove original dest "/home/user/test.txt" ( Operation not permitted ) * kf.kio.workers.file, Warning: Couldn't rename "/home/user/test.txt.part" to "/home/user/test.txt" ( Operation not permitted ) * Succeeded * a unexpected new file called /home/user/test.txt.part in /home/user EXPECTED RESULT Failed B SOFTWARE/OS VERSIONS KIO: kio-5.105.0-619.67 Windows: n/a macOS: n/a Linux/KDE Plasma: n/a KDE Plasma Version: n/a KDE Frameworks Version: n/a Qt Version: 5.8 ADDITIONAL INFORMATION
We had similar issues with KIO::file_move where there would be a .part file and yet it was reported as KJob::NoError. This I could however not reproduce by utilizing chattr +i. Whereas with KIO::file_copy I can. I suspect here it was an actual I/O problem. But KIO anyway didn't report it on job->error().
A log entry we still have from when this happened with KIO::file_move was the following: kf.kio.workers.file, Warning: Couldn't rename "/mnt/max/Testdateien/NeuSyntaxM19/Vorstellung/02_WHILE-Schleife.h.part" to "/mnt/max/Testdateien/NeuSyntaxM19/Vorstellung/02_WHILE-Schleife.h" ( No such file or directory ) (in :0, Fnc.: ) Noting that /mnt/max was a smbmounted Samba file share at the time (it could be that Vorstellung or Testdateien became temporarily unavailable). the warning 'Couldn't rename' however indicates that KIO::file_move saw it. It should have reported something different than KJob::NoError. Also here a .part file was left.
ps. In steps to reproduce I meant chattr +i /home/user/target.txt of course.