From: jkuro@... Date: 1999-01-18T13:38:35+09:00 Subject: [ruby-list:11598] Re: $B$O$8$a$^$7$F!u4D6-JQ?t$K$D$$$F$N> ruby 1.2.1(99/01/12) [sparc-solaris2.5] >> >> /usr/home/jkuro/a:6:in `keys': failed to allocate memory (fatal) >> from /usr/home/jkuro/a:6:in `test' >> from /usr/home/jkuro/a:21 printenv すると、謎の空行があるので変だなとは思っていたのですが、以下の patch でおさまりました。 #先に調べてメイル出せばよかった。 - -- LOGNAME=jkuro HZ=100 TZ=Japan - -- 謎の空行をどうにかしたいけど…他の方はありますか? --- ../ruby-1.2.1.orig/hash.c Mon Dec 14 18:00:07 1998 +++ ./hash.c Mon Jan 18 13:02:27 1999 @@ -963,6 +963,10 @@ env = environ; while (*env) { char *s = strchr(*env, '='); + if (!s) { + env++; + continue; + } ary_push(ary, str_taint(str_new(*env, s-*env))); env++; } @@ -985,6 +989,10 @@ env = environ; while (*env) { char *s = strchr(*env, '='); + if (!s) { + env++; + continue; + } ary_push(ary, str_taint(str_new2(s+1))); env++; } @@ -1050,6 +1058,10 @@ env = environ; while (*env) { char *s = strchr(*env, '='); + if (!s) { + env++; + continue; + } ary_push(ary, assoc_new(str_taint(str_new(*env, s-*env)), str_taint(str_new2(s+1)))); env++; @@ -1095,13 +1107,19 @@ { char **env; VALUE ary; + int len; if (TYPE(value) != T_STRING) return FALSE; ary = ary_new(); env = environ; while (*env) { - char *s = strchr(*env, '=')+1; - int len = strlen(s); + char *s = strchr(*env, '='); + if (!s) { + env++; + continue; + } + s++; + len = strlen(s); if (strncmp(s, RSTRING(value)->ptr, len) == 0) return TRUE; env++; }