NetBSD Problem Report #48353

From www@NetBSD.org  Wed Oct 30 13:41:19 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 03F9AA5FF5
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 30 Oct 2013 13:41:19 +0000 (UTC)
Message-Id: <20131030134116.377D0A6006@mollari.NetBSD.org>
Date: Wed, 30 Oct 2013 13:41:16 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: misc/kdepim4 - kmail hangs if LANG is set
X-Send-Pr-Version: www-1.0

>Number:         48353
>Category:       pkg
>Synopsis:       misc/kdepim4 - kmail hangs if LANG is set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    markd
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 13:45:00 +0000 2013
>Last-Modified:  Wed Oct 30 14:40:57 +0000 2013
>Originator:     Nat Sloss
>Release:        pkgsrc-2013Q2
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (PCIPAE) #2: Wed Oct 23 19:09:00 EST 2013  build@test:/usr/src/sys/arch/i386/compile/obj/PCIPAE i386
>Description:
Whilst in KDE if you open konsole and export LANG=en_AU.UTF-8 (or any other UTF-8 variant) or LANG is exported in your shell profile.

Then attempt to start kmail from the konsole and the process freezes.

If LANG is not set it will run (you receive an error about klocale though.)

The problem that I've found is that it calls setlocale and the libkmailprivate init functions are called and these call setlocale again so it is recursive as described in the following backtrace:

[Switching to LWP 1]
pthread__mutex_pause ()
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libpthread/pthread_mutex.c:183
183	}
[?1034h(gdb) bt
#0  pthread__mutex_pause ()
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libpthread/pthread_mutex.c:183
#1  0xb8d9a038 in pthread__mutex_spin (ptm=0xb8b9a888, 
    owner=0xbf000000)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libpthread/pthread_mutex.c:208
#2  0xb8d9a14d in pthread__mutex_lock_slow (ptm=0xb8b9a888)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libpthread/pthread_mutex.c:240
#3  0xb8d99fa0 in pthread_mutex_lock (ptm=0xb8b9a888)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libpthread/pthread_mutex.c:174
#4  0xb8b65900 in _citrus_LC_CTYPE_load (
    name=0xbf7ffd23 "en_AU.UTF-8", part=0xbf7fc9e8)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/compat/../locale/nb_lc_template.h:195
#5  0xb8b65bba in _citrus_LC_CTYPE_setlocale (
    name=0xbf7ffd23 "en_AU.UTF-8", locale=0xb8b9aa20)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/compat/../locale/nb_lc_template.h:232
#6  0xb8b62576 in _generic_LC_ALL_setlocale (
    name=0xbac37178 "", locale=0xb8b9aa20)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/generic_lc_all.c:95
#7  0xb8b62865 in __setlocale (category=0, name=0xbac37178 "")
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/setlocale.c:111
#8  0xb8b628a3 in *__setlocale50 (category=0, 
    locale=0xbac37178 "")
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/setlocale.c:124
#9  0xbab9f913 in kInitializeLocale ()
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kcatalog.cpp:43
#10 0xbab9feec in KCatalog::KCatalog (this=0xb6424440, 
    name=..., language=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kcatalog.cpp:105
#11 0xbabd1813 in KuitSemanticsPrivate::KuitSemanticsPrivate (
    this=0xb646a6e0, lang=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kuitsemantics.cpp:464
#12 0xbabd1881 in KuitSemantics::KuitSemantics (
    this=0xb640a1a4, lang=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kuitsemantics.cpp:1575
#13 0xbabc876e in KLocalizedStringPrivate::notifyCatalogsUpdated
    (languages=..., catalogs=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocalizedstring.cpp:1026
#14 0xbabbb684 in KLocalePrivate::updateCatalogs (
    this=0xb6463100)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale_kde.cpp:857
#15 0xbabb7bf1 in KLocalePrivate::setLanguage (this=0xb6463100, 
    languages=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale_kde.cpp:693
#16 0xbabb8622 in KLocalePrivate::initLanguageList (
    this=0xb6463100, language=..., configLanguages=..., 
    useEnvironmentVariables=true)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale_kde.cpp:443
#17 0xbabb0dd8 in KLocalePrivate::init (this=0xb6463100, 
    catalogName=..., language=..., country=..., 
    persistantConfig=..., tempConfig=0x0)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale_kde.cpp:260
#18 0xbac0dd03 in KLocaleUnixPrivate::KLocaleUnixPrivate (
    this=0xb6463100, q_ptr=0xb6424438, catalogName=..., 
    config=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale_unix.cpp:25
#19 0xbabaccea in KLocale::KLocale (this=0xb6424438, 
    catalog=..., config=...)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocale.cpp:54
#20 0xbab2b363 in KGlobal::locale ()
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/kernel/kglobal.cpp:185
#21 0xbabc727e in KLocalizedString::toString (this=0xbf7fcf08)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/klocalizedstring.cpp:194
#22 0xbb27c5f1 in i18n (
    text=0xbb654c94 "<qt><p>Structuring information returned by the Crypto plug-in could not be processed correctly; the plug-in might be damaged.</p><p>Please contact your system administrator.</p></qt>")
    at /home/packages/2013Q2/pkgsrc/misc/kdepim4/work/.buildlink/include/klocalizedstring.h:632
#23 0xbb4eba54 in __static_initialization_and_destruction_0 (
    __priority=65535, __initialize_p=1)
    at /home/packages/2013Q2/pkgsrc/misc/kdepim4/work/kdepim-4.4.11.1/kmail/messagecomposer.cpp:257
#24 0xbb267488 in ?? () from /usr/pkg/lib/libkmailprivate.so.4
#25 0xbb7f136f in _rtld_call_init_functions (mask=0xbf7fcf98)
    at /home/build/NetBSD-6.1_source_tree/usr/src/libexec/ld.elf_so.mod/rtld.c:255
#26 0xbb7f246c in dlopen (
    name=0xb8ba93a0 "/usr/lib/i18n/libmapper_646.so.5.0", 
    mode=1)
    at /home/build/NetBSD-6.1_source_tree/usr/src/libexec/ld.elf_so.mod/rtld.c:991
#27 0xb8b6ebf4 in _citrus_load_module (rhandle=0xbf7fd41c, 
    encname=0xb6571008 "UTF8")
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/citrus/citrus_module.c:319
#28 0xb8b6df36 in _citrus_ctype_open (rcc=0xb640fc24, 
    encname=0xb6571008 "UTF8", variable=0xb6423230, lenvar=0, 
    szpriv=112)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/citrus/citrus_ctype.c:154
#29 0xb8b67a0c in _rune_read_file (
    var=0xb6571000 "RuneCT10UTF8", lenvar=14, prl=0xb640e064)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/rune.c:233
#30 0xb8b67c45 in _rune_load (var=0xb6571000 "RuneCT10UTF8", 
    lenvar=90834, prl=0xb640e064)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/rune.c:294
#31 0xb8b655f1 in _citrus_LC_CTYPE_create_impl (
    root=0xb8b91720 "/usr/share/locale", 
    name=0xbf7ffd23 "en_AU.UTF-8", pdata=0xb640e064)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/citrus/citrus_lc_ctype.c:92
#32 0xb8b657e1 in _citrus_LC_CTYPE_load_sub (
    name=0xbf7ffd23 "en_AU.UTF-8", real=0x0, part=0xbf7fe57c, 
    force=0)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/compat/../locale/nb_lc_template.h:150
#33 0xb8b65928 in _citrus_LC_CTYPE_load (
    name=0xbf7ffd23 "en_AU.UTF-8", part=0xbf7fe57c)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/compat/../locale/nb_lc_template.h:196
#34 0xb8b65bba in _citrus_LC_CTYPE_setlocale (
    name=0xbf7ffd23 "en_AU.UTF-8", locale=0xb8b9aa20)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/compat/../locale/nb_lc_template.h:232
#35 0xb8b62576 in _generic_LC_ALL_setlocale (
    name=0xbac37178 "", locale=0xb8b9aa20)
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/generic_lc_all.c:95
#36 0xb8b62865 in __setlocale (category=0, name=0xbac37178 "")
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/setlocale.c:111
#37 0xb8b628a3 in *__setlocale50 (category=0, 
    locale=0xbac37178 "")
    at /home/build/NetBSD-6.1_source_tree/usr/src/lib/libc/locale/setlocale.c:124
#38 0xbab9f913 in kInitializeLocale ()
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kcatalog.cpp:43
#39 0xbaba133f in __static_initialization_and_destruction_0 (
    __priority=65535, __initialize_p=1)
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kcatalog.cpp:50
#40 global constructors keyed to kcatalog.cpp(void) ()
    at /home/packages/2013Q2/pkgsrc/x11/kdelibs4/work/kdelibs-4.10.3/kdecore/localization/kcatalog.cpp:286
#41 0xbaa70ec8 in ?? () from /usr/pkg/lib/libkdecore.so.5
#42 0xbb7f136f in _rtld_call_init_functions (mask=0xbf7fe764)
    at /home/build/NetBSD-6.1_source_tree/usr/src/libexec/ld.elf_so.mod/rtld.c:255
#43 0xbb7f1cb8 in _rtld (sp=0xbf7fe8e0, relocbase=3145654272)
    at /home/build/NetBSD-6.1_source_tree/usr/src/libexec/ld.elf_so.mod/rtld.c:699
#44 0xbb7f095a in .rtld_start () from /usr/libexec/ld.elf_so
Backtrace stopped: Not enough registers or memory available to unwind further

Refer to #37 and #8 above.
>How-To-Repeat:
Refer to above.
>Fix:
I've found that changing libkmailprivate fixes the problem, I patched the function that was called after libkmailprivate init function so as not to call i18n and subsequently calling set locale again,  I've found that the error message printed on the terminal after starting kmail about klocale is gone also.

Here is the patch:

--- kmail/messagecomposer.cpp.orig	2011-04-20 20:03:31.000000000 +0000
+++ kmail/messagecomposer.cpp
@@ -252,17 +252,17 @@ static inline int signingChainCertNearEx
 */

 static QString mErrorProcessingStructuringInfo =
-  i18n("<qt><p>Structuring information returned by the Crypto plug-in "
+  "<qt><p>Structuring information returned by the Crypto plug-in "
        "could not be processed correctly; the plug-in might be damaged.</p>"
-       "<p>Please contact your system administrator.</p></qt>");
+       "<p>Please contact your system administrator.</p></qt>";
 static QString mErrorNoCryptPlugAndNoBuildIn =
-  i18n("<p>No active Crypto Plug-In was found and the built-in OpenPGP code "
+  "<p>No active Crypto Plug-In was found and the built-in OpenPGP code "
        "did not run successfully.</p>"
        "<p>You can do two things to change this:</p>"
        "<ul><li>either activate a Plug-In using the "
        "Settings->Configure KMail->Plug-In dialog.</li>"
        "<li>or specify traditional OpenPGP settings on the same dialog's "
-       "Identity->Advanced tab.</li></ul>");
+       "Identity->Advanced tab.</li></ul>";

 class MessageComposerJob {
   public:

I hope this is the cause of the problem and not setlocale.

Regards,

Nat.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->markd
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 30 Oct 2013 14:40:57 +0000
Responsible-Changed-Why:
Over to KDE maintainer


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.