From 68de00e0d4f2c574162a6e033d41786e3757d25d Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 18 Nov 2020 15:05:20 +0300 Subject: QStandardPaths: Don't change permissions of XDG_RUNTIME_DIR Conform to the XDG Base Directory Specification: "If, when attempting to write a file, the destination directory is non-existent an attempt should be made to create it with permission 0700. If the destination directory exists already the permissions should not be changed." At the same time the spec states about XDG_RUNTIME_DIR that "its Unix access mode MUST be 0700", so don't consider the directory with wrong permissions correct and use a fallback. Task-number: QTBUG-68338 Pick-to: 5.15 5.12 Change-Id: I03c6b35b3f7d5ceb8e6326695bfc8207da92ea67 Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 2d7c1b295a..e9ade7c4fb 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -528,7 +528,12 @@ void tst_qstandardpaths::testCustomRuntimeDirectory_data() d.mkdir("runtime"); QFile::setPermissions(p, QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner | QFile::ExeGroup | QFile::ExeOther); - return updateRuntimeDir(p); + updateRuntimeDir(p); + QTest::ignoreMessage(QtWarningMsg, + QString("QStandardPaths: wrong permissions on runtime directory %1, " + "0711 instead of 0700") + .arg(p).toLatin1()); + return fallbackXdgRuntimeDir(); }); addRow("environment:wrong-owner", [](QDir &) { @@ -593,6 +598,7 @@ void tst_qstandardpaths::testCustomRuntimeDirectory_data() clearRuntimeDir(); QString p = fallbackXdgRuntimeDir(); d.mkdir(p); // probably has wrong permissions + QFile::setPermissions(p, QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner); return p; }); -- cgit v1.2.3