Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.8.0, 5.9.1
-
None
Description
Following is a modified snippet from src/corelib/io/qstandardpaths_unix.cpp
const uint myUid = uint(geteuid());
qDebug() << "myUid" << myUid;
QFileInfo fileInfo; QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR"));
qDebug() << "xdgRuntimeDir" << xdgRuntimeDir; fileInfo.setFile(xdgRuntimeDir);
qDebug() << "fileowner:" << fileInfo.ownerId();
// "The directory MUST be owned by the user"
if (fileInfo.ownerId() != myUid) {
qWarning("QStandardPaths: wrong ownership on runtime directory %s, %d instead of %d", qPrintable(xdgRuntimeDir), fileInfo.ownerId(), myUid);
}
If I build and run this as normal user on Linux, the output is:
$ ./test
myUid 1000
xdgRuntimeDir "/tmp/xdg-runtime-guest/"
fileowner: 1000
However, if I run it with su:
$ su -c ./test
myUid 0
xdgRuntimeDir "/tmp/xdg-runtime-guest/"
fileowner: 1000
QStandardPaths: wrong ownership on runtime directory /tmp/xdg-runtime-guest/, 1000 instead of 0