Bug #4362: Process.kill should accept -SIGXXX with implicit conversion
http://redmine.ruby-lang.org/issues/show/4362

ɼ???: Tomoyuki Chikanaga
?????????: Open, ?????: Normal
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-02-02 trunk 30762) [x86_64-darwin10.6.0]

Process.kill ??第?????? Fixnum ??? Symbol???String ?????????種??????????????
??????????????????? - ?????????????????????????????????????信?????????????????????????
???????? Fixnum, Symbol, String 以????????????????渡????? to_str ????????????
?????????????????????????????????????????????????????????????????? - ??????????????????
???????????????????????? - ???解??????????????????

> Process.kill(:"-SIGTERM", $$)
ArgumentError: unsupported name `SIG-SIGTERM'
> Process.kill(:"-TERM", $$)
ArgumentError: unsupported name `SIG-TERM'

??????????????? String 以????????????????????????????????????Symbol ??????????????????????????????????
??????? - ???解???????????????????????????????????????????????????????????????????????????????????

diff --git a/signal.c b/signal.c
index 27d90ac..5343108 100644
--- a/signal.c
+++ b/signal.c
@@ -359,6 +359,7 @@ rb_f_kill(int argc, VALUE *argv)
     int negative = 0;
     int sig;
     int i;
+    volatile VALUE str;
     const char *s;
 
     rb_secure(2);
@@ -376,11 +377,11 @@ rb_f_kill(int argc, VALUE *argv)
 
       case T_STRING:
 	s = RSTRING_PTR(argv[0]);
+      str_signal:
 	if (s[0] == '-') {
 	    negative++;
 	    s++;
 	}
-      str_signal:
 	if (strncmp("SIG", s, 3) == 0)
 	    s += 3;
 	if((sig = signm2signo(s)) == 0)
@@ -391,9 +392,6 @@ rb_f_kill(int argc, VALUE *argv)
 	break;
 
       default:
-        {
-	    VALUE str;
-
 	    str = rb_check_string_type(argv[0]);
 	    if (!NIL_P(str)) {
 		s = RSTRING_PTR(str);
@@ -401,7 +399,6 @@ rb_f_kill(int argc, VALUE *argv)
 	    }
 	    rb_raise(rb_eArgError, "bad signal type %s",
 		     rb_obj_classname(argv[0]));
-	}
 	break;
     }


----------------------------------------
http://redmine.ruby-lang.org