Commit b1dfbaa6 authored by Fabian Vogt's avatar Fabian Vogt

Error out when ioslaves state that / is a regular file

Reject mounting slaves with this incompatible behaviour, it can't be mapped
to FUSE semantics completely.

BUG: 433300
parent 74905b94
......@@ -392,6 +392,17 @@ void KIOFuseVFS::findAndCreateOrigin(QUrl url, QStringList pathElements, std::fu
qWarning(KIOFUSE_LOG) << "Unable to create a valid final node for" << url.toDisplayString() << "from its UDS Entry";
return callback({}, EIO);
// Some ioslaves like man:/ implement "index files" for folders (including /) by making
// them look as regular file when stating, but they also support listDir for directory
// functionality. This behaviour is not compatible, so just reject it outright.
if((url.path().isEmpty() || url.path() == QStringLiteral("/"))
&& !S_ISDIR(finalNode->m_stat.st_mode))
qWarning(KIOFUSE_LOG) << "Root of mount at" << url.toDisplayString() << "not a directory";
return callback({}, ENOTDIR);
......@@ -39,6 +39,7 @@ private Q_SLOTS:
void testRenameOps();
void testDeletionOps();
void testArchiveOps();
void testManWorkaround();
void testKioErrorMapping();
void testRootLookup();
void testFilenameEscaping();
......@@ -621,6 +622,25 @@ void FileOpsTest::testArchiveOps()
void FileOpsTest::testManWorkaround()
// The man ioslave has "hybrid" directories which stat as regular files but also support
// listDir. This behaviour is not supported and mounting has to fail.
if (!KProtocolInfo::isKnownProtocol(QStringLiteral("man")))
QSKIP("Test requires man protocol to be supported. See README for packages required.");
QDBusPendingReply<QString> reply = m_kiofuse_iface.mountUrl(QStringLiteral("man:foo"));
QCOMPARE(reply.error().name(), QStringLiteral("org.kde.KIOFuse.VFS.Error.CannotMount"));
reply = m_kiofuse_iface.mountUrl(QStringLiteral("man:/"));
QCOMPARE(reply.error().name(), QStringLiteral("org.kde.KIOFuse.VFS.Error.CannotMount"));
void FileOpsTest::testKioErrorMapping()
QTemporaryFile localFile;
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