Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: deadlock caused by gettext usage in a signal handler

Le Mon, 3 Dec 2007 22:43:24 +0000,
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> a écrit :

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


Do not translate them in the signal handler, since gettext is not

You can see that strerror_r calls gettext in:


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
but the BSDs provide it anyway
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.



Messages sorted by: Reverse Date, Date, Thread, Author