<div dir="ltr"><pre>Hi all,<br>I made two experiments:<br>the first program is:<br>#include <QCoreApplication><br>#include <QFile><br>#include <stdio.h><br>int main(int argc, char *argv[])<br>{<br>QCoreApplication app(argc, argv);<br>
printf("%s\n", QFile::encodeName(QString::fromUtf8("<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>ΕΛ")).data());<br>return 0;<br>}<br>the output is:<br>
<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>ΕΛ<br><br>the second program is:<br>#include <QCoreApplication><br>#include <QFile><br>#include <stdio.h><br>
int main(int argc, char *argv[])<br>{<br>//QCoreApplication app(argc, argv);<br>printf("%s\n", QFile::encodeName(QString::fromUtf8("<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>ΕΛ")).data());<br>
return 0;<br>}<br>the output is:<br><i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i><br><br>QFile::encodeName got wrong file name without a QCoreApplication object !<br>
(my locale is zh_CN.UTF-8)<br><br>From the error messages:<br>"<br>trying to create local folder <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde: Permission denied<br>
trying to create local folder <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde: Permission denied<br>Link points to "/tmp/ksocket-ΕΛ"<br>trying to create local folder <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde: Permission denied<br>
kdeinit4: Aborting. bind() failed: : No such file or directory<br>Could not bind to socket<br>'<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>home<span class="moz-txt-tag">/</span></i>.kde/socket-localhost.localdomain/kdeinit4__0'<br>
"<br>I find that maybe something is wrong when binding a socket.<br><br>kdelibs/kinit/kinit.cpp<br>main() function calls kdeinit_library_path() function.<br>1808 kdeinit_library_path();<br><br>and in kdeinit_library_path() function,<br>
1562 QByteArray socketName =<br>QFile::encodeName(KStandardDirs::locateLocal("socket",<br>QString("kdeinit4_%1").a rg(QLatin1String(display)), *s_instance));<br><br>I think that's the reason why kdeinit4 binds the socket wrongly,<br>
and we should add a QCoreAoolication to make QFile, QDir and other QT<br>class work in kdeinit4.<br><br>Best regards!<br><br>pwp</pre></div>