From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25518 invoked from network); 5 Dec 2007 01:16:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Dec 2007 01:16:02 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 39029 invoked from network); 4 Dec 2007 18:09:17 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Dec 2007 18:09:17 -0000 Received: (qmail 3150 invoked by alias); 4 Dec 2007 18:09:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24153 Received: (qmail 3120 invoked from network); 4 Dec 2007 18:09:03 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Dec 2007 18:09:03 -0000 Received: (qmail 37610 invoked from network); 4 Dec 2007 18:09:03 -0000 Received: from smtp3-g19.free.fr (212.27.42.29) by a.mx.sunsite.dk with SMTP; 4 Dec 2007 18:08:57 -0000 Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id AF34417B62E for ; Tue, 4 Dec 2007 19:08:56 +0100 (CET) Received: from localhost.localdomain (bar06-2-82-224-157-131.fbx.proxad.net [82.224.157.131]) by smtp3-g19.free.fr (Postfix) with ESMTP id 5A7EF17B5F6 for ; Tue, 4 Dec 2007 19:08:55 +0100 (CET) Date: Tue, 4 Dec 2007 19:02:19 +0100 From: Guillaume Chazarain To: zsh-workers@sunsite.dk Subject: Re: deadlock caused by gettext usage in a signal handler Message-ID: <20071204190219.037a5400@inria.fr> In-Reply-To: <20071203224324.247fb30f.p.w.stephenson@ntlworld.com> References: <20071130203534.1d1ea29c@inria.fr> <20071203224324.247fb30f.p.w.stephenson@ntlworld.com> X-Mailer: Claws Mail 3.0.2 (GTK+ 2.10.14; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le Mon, 3 Dec 2007 22:43:24 +0000, Peter Stephenson a =C3=A9crit : > zsh doesn't ever use gettext() directly I overlooked that, great that Zsh does not use strsignal and perror ;-) Zsh seems to use dlerror though, hopefully not in a signal handler. > Alternatively, we could use strerror_r() strerror_r also calls into gettext, so I don't see how this solves the problem. I have been caught by the gettext initialization as it's a bigger malloc consumer than a simple gettext call but according to a comment by Paul Eggert in: http://cvs.savannah.gnu.org/viewvc/diffutils/lib/c-stack.c?root=3Ddiffutils= &view=3Dmarkup Do not translate them in the signal handler, since gettext is not async-signal-safe. You can see that strerror_r calls gettext in: http://sourceware.org/cgi-bin/cvsweb.cgi/libc/string/_strerror.c?rev=3D1.1.= 2.2&content-type=3Dtext/x-cvsweb-markup&cvsroot=3Dglibc return (char *) _(_sys_errlist_internal[errnum]); > To get diff output for a test failure while I was writing this I needed Does that mean you managed to make a reproducible test case? > to use "diff -a" in ztst.zsh. I'm not sure if the option is universal, > however. Confused, I can't see any diff invocation in your patch. From some googling, POSIX does not specify it (http://www.opengroup.org/onlinepubs/009695399/utilities/diff.html), but the BSDs provide it anyway (http://www.freebsd.org/cgi/man.cgi?query=3Ddiff&apropos=3D0&sektion=3D0&ma= npath=3DFreeBSD+6.0-RELEASE&format=3Dhtml), some use GNU diff. It seems to me a possible solution would be to rewrite strerror() in Zsh to initially build a static table of translated error messages as well as the translation of "Unknown error ". Don't know how much this would delay the Zsh startup though. Thanks. --=20 Guillaume