From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29725 invoked from network); 5 Dec 2007 00:21:59 -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 00:21:59 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 78633 invoked from network); 4 Dec 2007 18:50:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Dec 2007 18:50:33 -0000 Received: (qmail 9180 invoked by alias); 4 Dec 2007 18:50:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24155 Received: (qmail 9008 invoked from network); 4 Dec 2007 18:49:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Dec 2007 18:49:59 -0000 Received: (qmail 75428 invoked from network); 4 Dec 2007 18:49:58 -0000 Received: from smtp3-g19.free.fr (212.27.42.29) by a.mx.sunsite.dk with SMTP; 4 Dec 2007 18:49:51 -0000 Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id B190117B568 for ; Tue, 4 Dec 2007 19:49:50 +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 56C8517B542 for ; Tue, 4 Dec 2007 19:49:50 +0100 (CET) Date: Tue, 4 Dec 2007 19:43:14 +0100 From: Guillaume Chazarain To: zsh-workers@sunsite.dk Subject: Re: deadlock caused by gettext usage in a signal handler Message-ID: <20071204194314.136c08ad@inria.fr> In-Reply-To: <200712041824.lB4IOowf006457@news01.csr.com> References: <20071130203534.1d1ea29c@inria.fr> <20071203224324.247fb30f.p.w.stephenson@ntlworld.com> <20071204190219.037a5400@inria.fr> <200712041824.lB4IOowf006457@news01.csr.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 Tue, 04 Dec 2007 18:24:50 +0000, Peter Stephenson a =C3=A9crit : > Guillaume Chazarain wrote: > > Zsh seems to use dlerror though, hopefully not in a signal handler. >=20 > No, the shell is quite cautious what it executes in signal handlers; > system errors are pretty much inevitable, but there's no module handling > there so no call to dlerror. OK, great. >=20 > > strerror_r also calls into gettext, so I don't see how this solves the > > problem. >=20 > strerror_r() is the way of ensuring thread safety in printing the > message by providing a buffer into which data is written. The GNU > library manual entry does actually claim it's thread-safe; that > means that any hidden back-end functions it uses are thread-safe too. Thread-safety does not imply async-signal-safety. It means locks and thread local storage, but these do nothing for signals. It would be great if sticking an _r would make functions callable in signal handlers ;-) There are more details in this blog post: http://girtby.net/archives/2006/12/18/the-other-kind-of-reentrant Thanks. --=20 Guillaume