This is a MIME-formatted message. If you see this text it means that your mail software cannot handle MIME-formatted messages. --=_41_24579_1223866533 Content-Type: text/html; charset="GB2312" Content-Transfer-Encoding: 8bit This patch is for BUG 172567 .

Hi all,
I believe KDE should allow non-ASCII user name to login in computer.

I am chinese, so I want use chinese user name to login in my computer.
I find out that we only need to add a QCoreApplication object to kdeinit4 and kstartupconfig4 program to achieve it, and I made two simple patches.

I add a user "ΕΛ" by kuser(compiled from svn), and I set Language=zh_CN.UTF-8
in /etc/kde/kdm/kdmrc.

restart X, kdm displays my name "ΕΛ" perfectly, but when I input my password, login,
a message box shows "Could not start kstartupconfig4. Check your installation."
 
Then I login in safe mode, run kdeinit4, got some error messages:
"
trying to create local folder /home/.kde: Permission denied
trying to create local folder /home/.kde: Permission denied
Link points to "/tmp/ksocket-ΕΛ"
trying to create local folder /home/.kde: Permission denied
kdeinit4: Aborting. bind() failed: : No such file or directory
Could not bin d to socket '/home/.kde/socket-localhost.localdomain/kdeinit4__0'
"

I infer that kdeinit4 doesn't get my "HOME" environment correctly, so it tries to create local folder in /home/.kde, of course "Permission denied".

Then I look into why kdeinit4 doesn't get my "HOME" environment correctly.
From the error messages, we could learn that maybe kdeinit4 exits when binding a socket.

in kdelibs/kinit/kinit.cpp  I find that:
1562 QByteArray socketName = QFile::encodeName(KStandardDirs::locateLocal("socket", QString("kde     init4_%1").arg(QLatin1String(display)), *s_instance));

kdeinit_library_path() calls KStandardDirs::locateLocal to locate the socket.
After I see how KStandardDirs::locateLocal is implemented I find that in
kdelibs/kdecore/kernel/kstandarddirs.cpp
KStandardDirs::addKDEDefaults() calls QDir::homePath() to get "HOME" environment variable.
1499 #if defined(Q_WS_MACX)
1500   &n bsp;     localKdeDir =  QDir::homePath() + QLatin1String("/Library/Preferences/KDE/");
1501 #elif defined(Q_WS_WIN)
1502         WCHAR wPath[MAX_PATH+1];
1503         if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {
1504           localKdeDir = QString::fromUtf16((const ushort *) wPath) + QLatin1Char('/') + KDE_DE     FAULT_HOME + QLatin1Char('/');
1505         } else {
1506           localKdeDir =  QDir::homePath() + QLatin1Char('/') + KDE_DEFAULT_HOME + QLatin1Char(     '/');
1507         }
1508 #else
1509         localKdeDir =  QDir::homePa th() + QLatin1Char('/') + KDE_DEFAULT_HOME + QLatin1Char('/     ');
1510 #endif

Because kdeinit4 is a C++ program, it doesn't initialize any QApplication instance, which cause that QDir::homePath() doesn't get the correct "HOME" environment variable.

So I add a QCoreApplication in kdelibs/kinit/kinit.cpp and kdebase/workspace/kstartupconfig/kdostartupconfig.cpp.

Then it works. Now I can use my own chinese name "ΕΛ" to login in my computer.

In QT manual I find following descriptions:
http://doc.trolltech.com/4.4/qcoreapplication.html
"
QCoreApplication contains the main event loop, where all events from the operating system (e.g., timer and network events) and other sources are processed and dispatched. It also handles the application's initialization and finalization, as well as system-wide and application-wide settings.

Some Qt classes, such as QString, can be used without a QCoreApplication object. However, in general, we recommend that you create a QCoreApplication or a QApplication object in your main() function as early as possible. The application will enter the event loop when exec() is called. exit() will not return until the event loop exits, e.g., when quit() is called.
"

kdeinit4 and kstartupconfig don't create a QCoreApplication, maybe it would lead some encoding problems, I guess.


The kdeinit4.patch should apply to the directory  kdelibs/kinit/
and kstartupconfig4.patch should apply to kdebase/workspace/kstartupconfig/ .

Best regards

pwp

--=_41_24579_1223866533 Content-Disposition: attachment; filename="kstartupconfig4.patch" Content-Type: application/octet-stream ; charset="ISO-8859-1"; name="kstartupconfig4.patch" Content-Transfer-Encoding: base64 SW5kZXg6IGtkb3N0YXJ0dXBjb25maWcuY3BwCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGtkb3N0YXJ0dXBjb25m aWcuY3BwCe+8iOeJiOacrCA4NzA2NzjvvIkKKysrIGtkb3N0YXJ0dXBjb25maWcuY3BwCe+8iOW3 peS9nOWJr+acrO+8iQpAQCAtMjUsNiArMjUsNyBAQAogI3VuZGVmIFFUX05PX0NBU1RfQVNDSUkK IAogLy8gU2VlIGRlc2NyaXB0aW9uIGluIGtzdGFydHVwY29uZmlnLmNwcCAuCisjaW5jbHVkZSA8 UUNvcmVBcHBsaWNhdGlvbj4KICNpbmNsdWRlIDxRdENvcmUvUUZpbGU+CiAjaW5jbHVkZSA8UXRD b3JlL1FUZXh0U3RyZWFtPgogI2luY2x1ZGUgPGtjb21wb25lbnRkYXRhLmg+CkBAIC03OSw2ICs4 MCw3IEBACiAgICAgS0NvbXBvbmVudERhdGEgaW5zdCggJmFib3V0ICk7CiAgICAga0RlYnVnKCkg PDwgIlJ1bm5pbmcga2Rvc3RhcnR1cGNvbmZpZy4iOwogICAgIEtDbWRMaW5lQXJnczo6aW5pdCgg YXJnYywgYXJndiwgJmFib3V0ICk7IC8vIGZvciBLTG9jYWxlIG5vdCB0byBjb21wbGFpbiBhYm91 dCBlbmNvZGluZworICAgIFFDb3JlQXBwbGljYXRpb24gYXBwKGFyZ2MsIGFyZ3YpOwogICAgIFFT dHJpbmcga2V5c25hbWUgPSBLU3RhbmRhcmREaXJzOjpsb2NhdGVMb2NhbCggImNvbmZpZyIsICJz dGFydHVwY29uZmlna2V5cyIgKTsKICAgICBRRmlsZSBrZXlzKCBrZXlzbmFtZSApOwogICAgIGlm KCAha2V5cy5vcGVuKCBRSU9EZXZpY2U6OlJlYWRPbmx5ICkpCg== --=_41_24579_1223866533 Content-Disposition: attachment; filename="kdeinit4.patch" Content-Type: application/octet-stream ; charset="ISO-8859-1"; name="kdeinit4.patch" Content-Transfer-Encoding: base64 SW5kZXg6IGtpbml0LmNwcAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBraW5pdC5jcHAJ77yI54mI5pysIDg3MDY3 OO+8iQorKysga2luaXQuY3BwCe+8iOW3peS9nOWJr+acrO+8iQpAQCAtNDEsNiArNDEsNyBAQAog I2luY2x1ZGUgPHVuaXN0ZC5oPgogI2luY2x1ZGUgPGxvY2FsZS5oPgogCisjaW5jbHVkZSA8UUNv cmVBcHBsaWNhdGlvbj4KICNpbmNsdWRlIDxRdENvcmUvUUxpYnJhcnk+CiAjaW5jbHVkZSA8UXRD b3JlL1FTdHJpbmc+CiAjaW5jbHVkZSA8UXRDb3JlL1FGaWxlPgpAQCAtMTcyMiw2ICsxNzIzLDgg QEAKICAgIGludCBrZWVwX3J1bm5pbmcgPSAxOwogICAgZC5zdWljaWRlID0gZmFsc2U7CiAKKyAg IFFDb3JlQXBwbGljYXRpb24gYXBwKGFyZ2MsIGFyZ3YpOworCiAgICAvKiogU2F2ZSBhcmd1bWVu dHMgZmlyc3QuLi4gKiovCiAgICBjaGFyICoqc2FmZV9hcmd2ID0gKGNoYXIgKiopIG1hbGxvYygg c2l6ZW9mKGNoYXIgKikgKiBhcmdjKTsKICAgIGZvcihpID0gMDsgaSA8IGFyZ2M7IGkrKykK --=_41_24579_1223866533 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --=_41_24579_1223866533--