From 210a26b29ebe8af93da6c0b3c87cdbfe53c69899 Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Tue, 6 Oct 2026 16:26:42 +0200 Subject: [PATCH 1/2] Skip tst_unreadableelement where a file cannot be made unreadable anUnreadableSymbolIsNotACollision() takes every permission away from a symbol file to check that an unreadable symbol is reported as such, not as a collision. QFile::setPermissions() cannot do that on Windows, where Qt only knows the read-only flag, so it returns false and the test failed there. It now skips, as it already does when run as root, which reads the file anyway. Co-Authored-By: Claude Fable 5.1 --- tests/qttest/tst_unreadableelement.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qttest/tst_unreadableelement.cpp b/tests/qttest/tst_unreadableelement.cpp index 906b8da58..607ac210b 100644 --- a/tests/qttest/tst_unreadableelement.cpp +++ b/tests/qttest/tst_unreadableelement.cpp @@ -89,7 +89,11 @@ private slots: .contains(QStringLiteral("RESULT placed"))); QVERIFY(QFile::exists(embedded)); - QVERIFY(QFile::setPermissions(m_symbol, QFileDevice::Permissions())); + // Qt cannot take read permission away on Windows: it only knows the + // read-only flag there, so this returns false. The check needs a + // file the user cannot read, which this system cannot give it. + if (!QFile::setPermissions(m_symbol, QFileDevice::Permissions())) + QSKIP("this system cannot make the file unreadable (Windows?)"); QFile probe(m_symbol); if (probe.open(QIODevice::ReadOnly)) QSKIP("permissions do not stop this user reading the file (root?)"); From 1fdb0ee32e625499951905ed998c9af4273b5530 Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Wed, 7 Oct 2026 01:51:00 +0200 Subject: [PATCH 2/2] Skip tst_unreadableelement on Windows only The skip applied wherever setPermissions() failed, which on Linux and macOS would hide a real failure. Only Windows cannot take read permission away; elsewhere the call must succeed as before. Co-Authored-By: Claude Fable 5.1 --- tests/qttest/tst_unreadableelement.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/qttest/tst_unreadableelement.cpp b/tests/qttest/tst_unreadableelement.cpp index 607ac210b..2c0af7031 100644 --- a/tests/qttest/tst_unreadableelement.cpp +++ b/tests/qttest/tst_unreadableelement.cpp @@ -89,11 +89,13 @@ private slots: .contains(QStringLiteral("RESULT placed"))); QVERIFY(QFile::exists(embedded)); +#ifdef Q_OS_WIN // Qt cannot take read permission away on Windows: it only knows the // read-only flag there, so this returns false. The check needs a - // file the user cannot read, which this system cannot give it. - if (!QFile::setPermissions(m_symbol, QFileDevice::Permissions())) - QSKIP("this system cannot make the file unreadable (Windows?)"); + // file the user cannot read, which Windows cannot give it. + QSKIP("Windows cannot make the file unreadable through QFile"); +#endif + QVERIFY(QFile::setPermissions(m_symbol, QFileDevice::Permissions())); QFile probe(m_symbol); if (probe.open(QIODevice::ReadOnly)) QSKIP("permissions do not stop this user reading the file (root?)");