KF6: Broken error codes in file_unix.cpp
After the conversion of file_unix to make use of WorkerResult
, it mixes up KIO error codes and errno:
Coincidentially EPERM
is 1 and thus maps to KIO::ERR_USER_CANCELED
which is returned directly for most operations (and just the wrong error), but in the chown
case actually worse: There is a missing return result;
and thus it return success by accident.
Fixing the chown issue in particular is trivial, but I think this is a bigger design issue with execWithElevatedPrivilege
. Should PrivilegeOperationReturnValue
be brought back?
Discovered while running the kio-fuse test suite with KF6 (system/kio-fuse!75 (merged)):
FAIL! : FileOpsTest::testLocalFileOps() Compared values are not the same
Actual (chown(mirroredFile.fileName().toUtf8().data(), getuid(), 0)): 0
Expected (-1) : -1
Loc: [/home/abuild/rpmbuild/BUILD/kio-fuse-5.1.0git.20231024T201554~2e127bd/tests/fileopstest.cpp(265)]
FAIL! : FileOpsTest::testLocalDirOps() Compared values are not the same
Actual (chown(mirrorDir.path().toUtf8().data(), getuid(), 0)): 0
Expected (-1) : -1
Loc: [/home/abuild/rpmbuild/BUILD/kio-fuse-5.1.0git.20231024T201554~2e127bd/tests/fileopstest.cpp(370)]
CC @asaoutkin @meven