[sftp] treat all errors as errors

Authored by sitter on Sep 13 2018, 8:28 AM.

Description

[sftp] treat all errors as errors

Summary:
certain libssh versions sometimes give out bogus errors. namely SSH_FX_OK
can sometimes be the current err even after a function returned with an
"something errord" return value. when converting these bogus errors
to KIO errors we'd sometimes end up reporting NoError when in fact there
was an error, we just don't know what it was because err is incorrect.
this ultimately resulted in KIO ending up in infinite loops because a job
neither errors nor correctly finishes

a scenario where this happens a lot is using dolphin to enter an sftp dir,
then deleting that dir on the CLI. dolphin would keep on querying
sftpProtocol::fileSystemFreeSpace which would run into server errors get
correctly reported by libssh 0.6 but 99% of the time err is SSH_FX_OK which
then locks KIO into an infinite loop of asking for freespace and getting
no answer but also no error. once this happens sftp will be broken from
a user's perspective as opening a new tab/dolphin will not work because
the slave is locked in this infinite loop.

to prevent this and similar issues we'll not let toKIOError ever return
NoError. toKIOError is only called after errors actually happend, so
NoError is not ever correct even when technically mapping the SSH err to
KIO would be NoError. for KIO we need a definitive result, and the
definitive result is always an error.

Reviewers: broulik

Reviewed By: broulik

Subscribers: leszeklesner

Differential Revision: https://phabricator.kde.org/D15454

Details

Committed
sitterSep 14 2018, 9:18 AM
Reviewer
broulik
Differential Revision
D15454: [sftp] treat all errors as errors
Parents
R320:a1458714bb00: [sftp] use qEnvironmentVariableIntValue instead of manual atoi checking
Branches
Unknown
Tags
Unknown