zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Guillaume Chazarain <guichaz@yahoo.fr>, zsh-workers@sunsite.dk
Subject: Re: deadlock caused by gettext usage in a signal handler
Date: Tue, 04 Dec 2007 18:24:50 +0000	[thread overview]
Message-ID: <200712041824.lB4IOowf006457@news01.csr.com> (raw)
In-Reply-To: <20071204190219.037a5400@inria.fr>

Guillaume Chazarain wrote:
> Zsh seems to use dlerror though, hopefully not in a signal handler.

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.

> strerror_r also calls into gettext, so I don't see how this solves the
> problem.

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.

To put it another way, I don't really care how it solves the problem; if
it doesn't it's broken.

There is a possible problem that strerror_r() might need more memory
than we pass it if it's doing random additional things, I suppose, but
the manual doesn't give any guidance.

> > 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?

No, I was testing I hadn't broken anything.

> > 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.

There isn't; I was referring to an existing test that failed while I was
writing the patch: diff assumed the difference in output was binary and
didn't show it.

> 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.

If strerror_r() really doesn't do what it's supposed to then it needs
fixing.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


  reply	other threads:[~2007-12-04 23:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 19:35 Guillaume Chazarain
2007-12-03 22:43 ` Peter Stephenson
2007-12-04  1:39   ` Paul Ackersviller
2007-12-04 18:02   ` Guillaume Chazarain
2007-12-04 18:24     ` Peter Stephenson [this message]
2007-12-04 18:43       ` Guillaume Chazarain
2007-12-04 19:43         ` Peter Stephenson
2007-12-04 19:49           ` Guillaume Chazarain
2007-12-04 20:30 ` Peter Stephenson
2007-12-04 23:09   ` Guillaume Chazarain
2007-12-06 23:02   ` Guillaume Chazarain
2007-12-07 10:35     ` Peter Stephenson
2007-12-07 10:46       ` Guillaume Chazarain
2007-12-07 11:21         ` Bart Schaefer
2007-12-07 11:27           ` Peter Stephenson
2007-12-07 11:57             ` Guillaume Chazarain
2007-12-07 11:29         ` Peter Stephenson
2007-12-10  0:11 Paul Ackersviller
2007-12-10  2:04 ` Bart Schaefer
2007-12-10  3:17   ` Paul Ackersviller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200712041824.lB4IOowf006457@news01.csr.com \
    --to=pws@csr.com \
    --cc=guichaz@yahoo.fr \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).