diff options
author | Alexander Volkov <avolkov@astralinux.ru> | 2020-11-18 15:05:20 +0300 |
---|---|---|
committer | Alexander Volkov <avolkov@astralinux.ru> | 2020-11-30 19:16:21 +0300 |
commit | 68de00e0d4f2c574162a6e033d41786e3757d25d (patch) | |
tree | 5ceb709aa4da385a92ba61ab56e39d8df40c5a54 /tests/auto | |
parent | d27d2b5d72acb2a3be55d0af9ded4cd126a5f031 (diff) |
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 <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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; }); |