[debian-mysql] Bug#527623: mysql-server-5.0: 38_scripts__mysqld_safe.sh__signals.dpatch is inherently

Stephane Chazelas stephane.chazelas at seebyte.com
Tue Jun 9 11:17:04 UTC 2009


2009-06-09 11:13:25 +0100, Stephane Chazelas:
[...]
> that patch is still wrong.
> 
> The first time a HUP is received, we run the code in the trap
> and call wait which will wait for both the refresh command and
> the mysqld one.
> 
> But we won't return from that trap until mysqld dies, and in the
> trap the HUP signal is blocked, which means any subsequent
> HUP will not be handled.
[...]

That's only true with bash though. With 5 sh implementations, 4
different behaviors:

$ bash -c 'trap "echo x & wait" INT; sleep 5 & wait; :'
^Cx
^C^C^C^C^C^Cx

subsequent <Ctrl-C> are blocked until trap returns.

$ dash -c 'trap "echo x & wait" INT; sleep 5 & wait; :'
^Cx
^Cx
^Cx
^Cx
^Cx
^Cx
$ ksh -c 'trap "echo x & wait" INT; sleep 5 & wait; :'
^Cx
^Cx
^Cx
^Cx

Those happily rerun the trap from the trap.

$ pdksh -c 'trap "echo x & wait" INT; sleep 5 & wait; :'
^Cx

Here, the wait in trap returns immediately.

$ ARGV0=sh zsh -c 'trap "echo x & wait" INT; sleep 5 & wait; :'
^Cx
^C

Here, the second <Ctrl-C> is handled by the default handler.

The solution I proposed shouldn't have that portability issue.

Best regards,
Stephane





More information about the pkg-mysql-maint mailing list