Commit 6ab34e5c authored by Harald Sitter's avatar Harald Sitter 🏳🌈
Browse files

smb: add some more topical debug output on opendir failure

the output seen in https://bugs.kde.org/show_bug.cgi?id=419038 isn't
nearly useful enough.

- log the actual errnum (i.e. errno) after opendir
- if the dirfd is negative log the approximate steps to recover

specifically we end up with errnum==0 in reportError which makes no sense
whatsoever and from the output it's not currently obvious which call
chain lead to that scenario. possibly should be changed to assert even,
not doing that for now though because I want this in 20.04
parent 8b011260
......@@ -373,7 +373,10 @@ void SMBSlave::listDir(const QUrl &kurl)
errNum = errno;
}
qCDebug(KIO_SMB_LOG) << "open " << m_current_url.toSmbcUrl() << " " << m_current_url.getType() << " " << dirfd;
qCDebug(KIO_SMB_LOG) << "open " << m_current_url.toSmbcUrl()
<< "url-type:" << m_current_url.getType()
<< "dirfd:" << dirfd
<< "errNum:" << errNum;
if (dirfd >= 0) {
#ifdef HAVE_READDIRPLUS2
// readdirplus2 improves performance by giving us a stat without separate call (Samba>=4.12)
......@@ -595,19 +598,23 @@ void SMBSlave::listDir(const QUrl &kurl)
smbc_closedir(dirfd);
} else {
if (errNum == EPERM || errNum == EACCES || workaroundEEXIST(errNum)) {
qCDebug(KIO_SMB_LOG) << "trying checkPassword";
const int passwordError = checkPassword(m_current_url);
if (passwordError == KJob::NoError) {
redirection(m_current_url);
finished();
} else if (passwordError == KIO::ERR_USER_CANCELED) {
qCDebug(KIO_SMB_LOG) << "user cancelled password request";
reportError(m_current_url, errNum);
} else {
qCDebug(KIO_SMB_LOG) << "generic password error:" << passwordError;
error(passwordError, m_current_url.toString());
}
return;
}
qCDebug(KIO_SMB_LOG) << "reporting generic error:" << errNum;
reportError(m_current_url, errNum);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment