Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: deadlock caused by gettext usage in a signal handler
- X-seq: zsh-workers 24170
- From: Guillaume Chazarain <guichaz@xxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxxxxx>
- Subject: Re: deadlock caused by gettext usage in a signal handler
- Date: Fri, 7 Dec 2007 00:02:07 +0100
- In-reply-to: <20071204203017.35a29727.p.w.stephenson@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20071130203534.1d1ea29c@xxxxxxxx> <20071204203017.35a29727.p.w.stephenson@xxxxxxxxxxxx>
Le Tue, 4 Dec 2007 20:30:17 +0000,
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> a écrit :
> That leaves me wondering if forking might be
> the problem; do we need to queue signals around there? It's not obvious
> why that would be.
It appears that glibc's fork is playing with locks:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/nptl/sysdeps/unix/sysv/linux/fork.c?rev=1.11.2.3&content-type=text/x-cvsweb-markup&cvsroot=glibc
This patch solved the problem for me:
diff --git a/Src/exec.c b/Src/exec.c
index cf79ea8..6f16b9e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -229,6 +229,7 @@ zfork(struct timeval *tv)
{
pid_t pid;
struct timezone dummy_tz;
+ sigset_t signals;
/*
* Is anybody willing to explain this test?
@@ -239,7 +240,10 @@ zfork(struct timeval *tv)
}
if (tv)
gettimeofday(tv, &dummy_tz);
+ sigfillset(&signals);
+ signals = signal_block(signals);
pid = fork();
+ signal_setmask(signals);
if (pid == -1) {
zerr("fork failed: %e", errno);
return -1;
Thanks.
--
Guillaume
Messages sorted by:
Reverse Date,
Date,
Thread,
Author