https://bugs.kde.org/show_bug.cgi?id=477096

            Bug ID: 477096
           Summary: KJob::NoError when KIO::Overwrite with KIO::file_copy
                    a file that is chattr +i
    Classification: Frameworks and Libraries
           Product: frameworks-kio
           Version: 5.105.0
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kio-bugs-n...@kde.org
          Reporter: phi...@codeminded.be
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to