From: Chirag Mistry Date: 2008-03-06T18:52:14+09:00 Subject: defect for the signal usage of SIGINT in Ruby 1.9 implementation ------=_Part_19690_32190494.1204797141114 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All I was going through the code of Ruby 1.9. I got some defects related to the usage of some signal. Given below are the defect descriptions for the signal usage of SIGINT in Ruby 1.9 implementation. Defect Description: Handling SIGINT "ruby_finalize_1"(In file trunk/eval.c, at line no: 142) function calls "ruby_sig_finalize function" (In file trunk/signal.c, at line no: 996). In "ruby_sig_finalize", signal handler SIG_IGN is installed for SIGINT signal and then signal handler SIG_DFL is installed for SIGINT signal if the previously installed signal handler was the Ruby handler ("sighandler"). As per our understanding, it may create problem when ruby interpreter is embedded in a process for a limited period of time. It should not install signal handler SIG_IGN for SIGINT signal. Existing code of ruby_sig_finalize is following: --------------------------------------------------------------------- void ruby_sig_finalize() { sighandler_t oldfunc; oldfunc = ruby_signal(SIGINT, SIG_IGN); if (oldfunc == sighandler) { ruby_signal(SIGINT, SIG_DFL); } } We can do below correction in ruby_sig_finalize function: ---------------------------------------------------------------------- void ruby_sig_finalize() { sighandler_t oldfunc; oldfunc = ruby_signal(SIGINT, SIG_DFL); if (oldfunc != sighandler) { ruby_signal(SIGINT, oldfunc); } } Regards Chirag ------=_Part_19690_32190494.1204797141114 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Hi All
 
I was going through the code of Ruby 1.9. I got some defects related to the usage of some signal.
Given below are the defect descriptions for the signal usage of SIGINT in Ruby 1.9 implementation.
 
Defect Description: Handling SIGINT
"ruby_finalize_1"(In file trunk/eval.c, at line no: 142) function calls "ruby_sig_finalize function" (In file trunk/signal.c, at line no: 996). In "ruby_sig_finalize", signal handler SIG_IGN is installed for SIGINT signal and then signal handler SIG_DFL is installed for SIGINT signal if the previously installed signal handler was the Ruby handler ("sighandler"). As per our understanding, it may create problem when ruby interpreter is embedded in a process for a limited period of time. It should not install signal handler SIG_IGN for SIGINT signal.
 
Existing code of ruby_sig_finalize is following:
---------------------------------------------------------------------
void ruby_sig_finalize()
{
    sighandler_t oldfunc;
    oldfunc = ruby_signal(SIGINT, SIG_IGN);
    if (oldfunc == sighandler) {
            ruby_signal(SIGINT, SIG_DFL);
    }
}
 
We can do below correction in ruby_sig_finalize function:
----------------------------------------------------------------------
void ruby_sig_finalize()
{
    sighandler_t oldfunc;
    oldfunc = ruby_signal(SIGINT, SIG_DFL);
    if (oldfunc != sighandler) {
            ruby_signal(SIGINT, oldfunc);
    }
}
 
Regards
Chirag
------=_Part_19690_32190494.1204797141114--