On Tue, 07 Nov 2000, Sven Neumann [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] (Raphael Quinet) writes:
I think that the best way to fix the screenshot plug-in is to add this
before the call to fork():
gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
(don't forget to #include libgimp/gimpsignal.h)
This seems to work fine (at least under Linux). I'm only wondering why
the gz, bzip2 and mail plugins do work under Solaris then. Or is this
not the case ?
Alas, these plug-ins have been broken under Solaris since a couple of
months. I thought this was reported in the bug database, but
apparently it isn't. That should have been a "grave" bug, at least.
And the fix is exactly the same as for the screenshot plug-in:
- make the code safer by checking the return value of waitpid, as
described in my followup to #27786,
- include libgimp/gimpsignal.h,
- call gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART) before
calling fork().
A quick grep shows the list of plug-ins that call waitpid() in an
unsafe way (do not check the result) and are affected by the race
condition between the system call and the signal handler:
- plug-ins/common/bz2.c (twice, for loading and saving)
- plug-ins/common/gz.c (twice, for loading and saving)
- plug-ins/common/mail.c
- plug-ins/common/screenshot.c
- plug-ins/common/url.c (twice, with ifdef/ifndef __EMX__)
The print plug-in also calls waitpid, but it uses it only for its
blocking effect and not for collecting the status of the child, so
this plug-in is safe. It looks like all plug-ins authors copied and
pasted the same code, because the same structure and the same argument
names are used in all plug-ins. But this code was wrong: it was
unsafe since the begining in 1.0.x, and broken when the new signal
handlers were installed. It's a pity that the problem was not
detected and fixed earlier (I am partly to blame for that, because I
knew the problem and I did not check if it was reported in the bug
database - I just told my users to avoid compressing files until the
bugs were found and fixed).
Anyway, I just fixed these five plug-ins and the patch should be in
the incoming directory of ftp.gimp.org in a few minutes.
Regarding bug #27786, I don't know if it is still open or not. I do
not see any crashes under Solaris 2.6, but maybe Solaris 8 is still
affected by the bug that was originally reported by Austin Donnelly.
Could someone test this, as I don't have access to a Solaris 8 machine
right now?
-Raphael