Hello community,

here is the log from the commit of package ruby for openSUSE:Factory checked in 
at 2012-03-06 14:07:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ruby (Old)
 and      /work/SRC/openSUSE:Factory/.ruby.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ruby", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ruby/ruby.changes        2011-12-06 
18:02:47.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ruby.new/ruby.changes   2012-03-06 
14:07:07.000000000 +0100
@@ -1,0 +2,23 @@
+Mon Feb 13 10:54:34 UTC 2012 - [email protected]
+
+- patch license to follow spdx.org standard
+
+-------------------------------------------------------------------
+Thu Dec 29 01:40:14 UTC 2011 - [email protected]
+
+- update to 1.8.7.p357
+  - randomize hash to avoid algorithmic complexity attacks.
+    CVE-2011-4815
+  - initialization of hash_seed to be at the beginning of the
+    process.
+  - initialize random seed at first.
+  - call OpenSSL::Random.seed at the SecureRandom.random_bytes
+    call.  insert separators for array join.  patch by Masahiro
+    Tomita.  [ruby-dev:44270]
+  - mkconfig.rb: fix for continued lines.  based on a patch from
+    Marcus Rueckert <darix AT opensu.se> at [ruby-core:20420].
+  - Infinity is greater than any bignum number.  [ruby-dev:38672]
+  - initialize store->ex_data.sk.  [ruby-core:28907]
+    [ruby-core:23971] [ruby-core:18121]
+
+-------------------------------------------------------------------
@@ -7 +30 @@
-Thu Jul  7 13:02:17 UTC 2011 - [email protected]
+Thu Jul  7 13:02:17 UTC 2011 - [email protected]

Old:
----
  ruby-1.8.7-p352.tar.bz2

New:
----
  ruby-1.8.7-p357.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ruby.spec ++++++
--- /var/tmp/diff_new_pack.10HTRA/_old  2012-03-06 14:07:10.000000000 +0100
+++ /var/tmp/diff_new_pack.10HTRA/_new  2012-03-06 14:07:10.000000000 +0100
@@ -18,15 +18,15 @@
 # norootforbuild
 
 Name:           ruby
-Version:        1.8.7.p352
+Version:        1.8.7.p357
 Release:        0
 #
 %define pkg_version 1.8.7
-%define patch_level p352
+%define patch_level p357
 %define rb_arch %(echo %{_target_cpu}-linux | sed -e "s/i686/i586/" -e 
"s/hppa2.0/hppa/" -e "s/ppc/powerpc/")
 %define rb_ver  %(echo %{pkg_version} | sed -e 's/\\\.[0-9]\\\+$//')
 #
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 #
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -116,7 +116,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package devel
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Summary:        Development files to link against Ruby
 Requires:       %{name} = %{version}
@@ -134,7 +134,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package tk
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Summary:        TCL/TK bindings for Ruby
 Requires:       %{name} = %{version}
@@ -148,7 +148,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package doc-ri
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Summary:        Ruby Interactive Documentation
 Requires:       %{name} = %{version}
@@ -165,7 +165,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package doc-html
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Summary:        This package contains the HTML docs for ruby
 Requires:       %{name} = %{version}
@@ -182,7 +182,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package examples
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Requires:       %{name} = %{version}
 Summary:        Example scripts for ruby
@@ -196,7 +196,7 @@
     Yukihiro Matsumoto <[email protected]>
 
 %package test-suite
-License:        GPLv2+
+License:        GPL-2.0+
 Group:          Development/Languages/Ruby
 Requires:       %{name} = %{version}
 Summary:        An Interpreted Object-Oriented Scripting Language

++++++ ruby-1.8.7-p352.tar.bz2 -> ruby-1.8.7-p357.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/ChangeLog 
new/ruby-1.8.7-p357/ChangeLog
--- old/ruby-1.8.7-p352/ChangeLog       2011-06-30 05:53:30.000000000 +0200
+++ new/ruby-1.8.7-p357/ChangeLog       2011-12-28 13:47:15.000000000 +0100
@@ -1,3 +1,54 @@
+Wed Dec 28 21:34:23 2011  URABE Shyouhei  <[email protected]>
+
+       * string.c (rb_str_hash): randomize hash to avoid algorithmic
+         complexity attacks. CVE-2011-4815
+
+       * st.c (strhash): ditto.
+
+       * string.c (Init_String): initialization of hash_seed to be at the
+         beginning of the process.
+
+       * st.c (Init_st): ditto.
+
+Thu Dec  8 11:57:04 2011  Tanaka Akira  <[email protected]>
+
+       * inits.c (rb_call_inits): call Init_RandomSeed at first.
+
+       * random.c (seed_initialized): defined.
+         (fill_random_seed): extracted from random_seed.
+         (make_seed_value): extracted from random_seed.
+         (rb_f_rand): initialize random seed at first.
+         (initial_seed): defined.
+         (Init_RandomSeed): defined.
+         (Init_RandomSeed2): defined.
+         (rb_reset_random_seed): defined.
+         (Init_Random): call Init_RandomSeed2.
+
+Sat Dec 10 20:44:23 2011  Tanaka Akira  <[email protected]>
+
+       * lib/securerandom.rb: call OpenSSL::Random.seed at the
+         SecureRandom.random_bytes call.
+         insert separators for array join.
+         patch by Masahiro Tomita.  [ruby-dev:44270]
+
+Mon Oct 17 04:20:22 2011  Nobuyoshi Nakada  <[email protected]>
+
+       * mkconfig.rb: fix for continued lines.  based on a patch from
+         Marcus Rueckert <darix AT opensu.se> at [ruby-core:20420].
+
+Mon Oct 17 04:19:39 2011  Yukihiro Matsumoto  <[email protected]>
+
+       * numeric.c (flo_cmp): Infinity is greater than any bignum
+         number.  [ruby-dev:38672]
+
+       * bignum.c (rb_big_cmp): ditto.
+
+Mon Oct 17 03:56:12 2011  Yusuke Endoh  <[email protected]>
+
+       * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): initialize
+         store->ex_data.sk.  [ruby-core:28907] [ruby-core:23971]
+         [ruby-core:18121]
+
 Thu Jun 30 12:52:56 2011  WATANABE Hirofumi  <[email protected]>
 
        * ext/tk/extconf.rb (intptr_t, uintptr_t): support for the latest 
ActiveTcl with mingw.
@@ -80,7 +131,7 @@
 Mon May 30 10:58:17 2011  Hiroshi Nakamura  <[email protected]>
 
        * lib/logger.rb (Logger::ProgName): do not depend on subversion
-         keyword ($Id: ChangeLog 32320 2011-06-30 03:53:30Z shyouhei $). 
ProgName with revision number was written in the
+         keyword ($Id: ChangeLog 34151 2011-12-28 12:47:15Z shyouhei $). 
ProgName with revision number was written in the
          header line of each logfile for ease of tracking what version user
          is using in troubleshooting.  Logger is already stable enough.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/bignum.c new/ruby-1.8.7-p357/bignum.c
--- old/ruby-1.8.7-p352/bignum.c        2010-06-08 10:42:55.000000000 +0200
+++ new/ruby-1.8.7-p357/bignum.c        2011-12-10 13:17:27.000000000 +0100
@@ -3,7 +3,7 @@
   bignum.c -
 
   $Author: shyouhei $
-  $Date: 2010-06-08 17:42:55 +0900 (Tue, 08 Jun 2010) $
+  $Date: 2011-12-10 21:17:27 +0900 (Sat, 10 Dec 2011) $
   created at: Fri Jun 10 00:48:55 JST 1994
 
   Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -1114,7 +1114,15 @@
        break;
 
       case T_FLOAT:
-       return rb_dbl_cmp(rb_big2dbl(x), RFLOAT(y)->value);
+       {
+           double a = RFLOAT_VALUE(y);
+
+           if (isinf(a)) {
+               if (a > 0.0) return INT2FIX(-1);
+               else return INT2FIX(1);
+           }
+           return rb_dbl_cmp(rb_big2dbl(x), a);
+       }
 
       default:
        return rb_num_coerce_cmp(x, y);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/ext/openssl/ossl_x509store.c 
new/ruby-1.8.7-p357/ext/openssl/ossl_x509store.c
--- old/ruby-1.8.7-p352/ext/openssl/ossl_x509store.c    2008-05-29 
19:45:47.000000000 +0200
+++ new/ruby-1.8.7-p357/ext/openssl/ossl_x509store.c    2011-12-10 
13:17:23.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * $Id: ossl_x509store.c 16691 2008-05-29 17:45:47Z knu $
+ * $Id: ossl_x509store.c 33999 2011-12-10 12:17:23Z shyouhei $
  * 'OpenSSL for Ruby' project
  * Copyright (C) 2001-2002  Michal Rokos <[email protected]>
  * All rights reserved.
@@ -131,6 +131,7 @@
 
 /* BUG: This method takes any number of arguments but appears to ignore them. 
*/
     GetX509Store(self, store);
+    store->ex_data.sk = NULL;
     X509_STORE_set_verify_cb_func(store, ossl_verify_cb);
     ossl_x509store_set_vfy_cb(self, Qnil);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/inits.c new/ruby-1.8.7-p357/inits.c
--- old/ruby-1.8.7-p352/inits.c 2008-04-09 13:13:04.000000000 +0200
+++ new/ruby-1.8.7-p357/inits.c 2011-12-28 13:47:15.000000000 +0100
@@ -2,8 +2,8 @@
 
   inits.c -
 
-  $Author: knu $
-  $Date: 2008-04-09 20:13:04 +0900 (Wed, 09 Apr 2008) $
+  $Author: shyouhei $
+  $Date: 2011-12-28 21:47:15 +0900 (Wed, 28 Dec 2011) $
   created at: Tue Dec 28 16:01:58 JST 1993
 
   Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -38,6 +38,7 @@
 void Init_sym _((void));
 void Init_process _((void));
 void Init_Random _((void));
+void Init_RandomSeed _((void));
 void Init_Range _((void));
 void Init_Regexp _((void));
 void Init_signal _((void));
@@ -46,10 +47,13 @@
 void Init_Time _((void));
 void Init_var_tables _((void));
 void Init_version _((void));
+void Init_st _((void));
 
 void
 rb_call_inits()
 {
+    Init_RandomSeed();
+    Init_st();
     Init_sym();
     Init_var_tables();
     Init_Object();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/lib/securerandom.rb 
new/ruby-1.8.7-p357/lib/securerandom.rb
--- old/ruby-1.8.7-p352/lib/securerandom.rb     2011-06-16 16:22:36.000000000 
+0200
+++ new/ruby-1.8.7-p357/lib/securerandom.rb     2011-12-10 13:17:33.000000000 
+0100
@@ -50,12 +50,12 @@
   def self.random_bytes(n=nil)
     n ||= 16
     if defined? OpenSSL::Random
-      @pid = $$ if !defined?(@pid)
+      @pid = 0 if !defined?(@pid)
       pid = $$
       if @pid != pid
         now = Time.now
         ary = [now.to_i, now.usec, @pid, pid]
-        OpenSSL::Random.seed(ary.to_s)
+        OpenSSL::Random.seed(ary.join('.'))
         @pid = pid
       end
       return OpenSSL::Random.random_bytes(n)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/mkconfig.rb 
new/ruby-1.8.7-p357/mkconfig.rb
--- old/ruby-1.8.7-p352/mkconfig.rb     2010-11-24 08:38:41.000000000 +0100
+++ new/ruby-1.8.7-p357/mkconfig.rb     2011-12-10 13:17:30.000000000 +0100
@@ -56,14 +56,13 @@
       continued_name = name
       next
     end
-  when /^"(.+)"\s*(\\)?$/
+  when /^"(.*)"\s*(\\)?$/
     if continued_line
       continued_line <<  $1
-      unless $2
-       val = continued_line.join("")
-       name = continued_name
-       continued_line = nil
-      end
+      next if $2
+      val = continued_line.join("")
+      name = continued_name
+      continued_line = nil
     end
   when /^(?:ac_given_)?INSTALL=(.*)/
     v_fast << "  CONFIG[\"INSTALL\"] = " + $1 + "\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/numeric.c 
new/ruby-1.8.7-p357/numeric.c
--- old/ruby-1.8.7-p352/numeric.c       2011-05-21 00:29:05.000000000 +0200
+++ new/ruby-1.8.7-p357/numeric.c       2011-12-10 13:17:27.000000000 +0100
@@ -3,7 +3,7 @@
   numeric.c -
 
   $Author: shyouhei $
-  $Date: 2011-05-21 07:29:05 +0900 (Sat, 21 May 2011) $
+  $Date: 2011-12-10 21:17:27 +0900 (Sat, 10 Dec 2011) $
   created at: Fri Aug 13 18:33:09 JST 1993
 
   Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -936,6 +936,10 @@
        break;
 
       case T_BIGNUM:
+       if (isinf(a)) {
+           if (a > 0.0) return INT2FIX(1);
+           else return INT2FIX(-1);
+       }
        b = rb_big2dbl(y);
        break;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/random.c new/ruby-1.8.7-p357/random.c
--- old/ruby-1.8.7-p352/random.c        2011-05-23 06:49:40.000000000 +0200
+++ new/ruby-1.8.7-p357/random.c        2011-12-28 13:47:15.000000000 +0100
@@ -3,7 +3,7 @@
   random.c -
 
   $Author: shyouhei $
-  $Date: 2011-05-23 13:49:40 +0900 (Mon, 23 May 2011) $
+  $Date: 2011-12-28 21:47:15 +0900 (Wed, 28 Dec 2011) $
   created at: Fri Dec 24 16:39:21 JST 1993
 
   Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -189,6 +189,7 @@
 #include <fcntl.h>
 #endif
 
+static int seed_initialized = 0;
 static VALUE saved_seed = INT2FIX(0);
 
 static VALUE
@@ -250,27 +251,22 @@
     return old;
 }
 
-static VALUE
-random_seed()
+#define DEFAULT_SEED_LEN (4 * sizeof(long))
+
+static void
+fill_random_seed(ptr)
+    char *ptr;
 {
     static int n = 0;
+    unsigned long *seed;
     struct timeval tv;
     int fd;
     struct stat statbuf;
+    char *buf = (char*)ptr;
 
-    int seed_len;
-    BDIGIT *digits;
-    unsigned long *seed;
-    NEWOBJ(big, struct RBignum);
-    OBJSETUP(big, rb_cBignum, T_BIGNUM);
-
-    seed_len = 4 * sizeof(long);
-    big->sign = 1;
-    big->len = seed_len / SIZEOF_BDIGITS + 1;
-    digits = big->digits = ALLOC_N(BDIGIT, big->len);
-    seed = (unsigned long *)big->digits;
+    seed = (unsigned long *)buf;
 
-    memset(digits, 0, big->len * SIZEOF_BDIGITS);
+    memset(buf, 0, DEFAULT_SEED_LEN);
 
 #ifdef S_ISCHR
     if ((fd = open("/dev/urandom", O_RDONLY
@@ -285,7 +281,7 @@
 #endif
             )) >= 0) {
         if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) {
-            read(fd, seed, seed_len);
+            read(fd, seed, DEFAULT_SEED_LEN);
         }
         close(fd);
     }
@@ -296,13 +292,37 @@
     seed[1] ^= tv.tv_sec;
     seed[2] ^= getpid() ^ (n++ << 16);
     seed[3] ^= (unsigned long)&seed;
+}
+
+static VALUE
+make_seed_value(char *ptr)
+{
+    BDIGIT *digits;
+    NEWOBJ(big, struct RBignum);
+    OBJSETUP(big, rb_cBignum, T_BIGNUM);
+
+    RBIGNUM_SET_SIGN(big, 1);
+
+    digits = ALLOC_N(char, DEFAULT_SEED_LEN);
+    RBIGNUM(big)->digits = digits;
+    RBIGNUM(big)->len = DEFAULT_SEED_LEN / SIZEOF_BDIGITS;
+
+    MEMCPY(digits, ptr, char, DEFAULT_SEED_LEN);
 
     /* set leading-zero-guard if need. */
-    digits[big->len-1] = digits[big->len-2] <= 1 ? 1 : 0;
+    digits[RBIGNUM_LEN(big)-1] = digits[RBIGNUM_LEN(big)-2] <= 1 ? 1 : 0;
 
     return rb_big_norm((VALUE)big);
 }
 
+static VALUE
+random_seed(void)
+{
+    char buf[DEFAULT_SEED_LEN];
+    fill_random_seed(buf);
+    return make_seed_value(buf);
+}
+
 /*
  *  call-seq:
  *     srand(number=0)    => old_seed
@@ -443,6 +463,9 @@
     long val, max;
 
     rb_scan_args(argc, argv, "01", &vmax);
+    if (!seed_initialized) {
+       rand_init(random_seed());
+    }
     switch (TYPE(vmax)) {
       case T_FLOAT:
        if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN) 
{
@@ -490,6 +513,8 @@
     return LONG2NUM(val);
 }
 
+static char initial_seed[DEFAULT_SEED_LEN];
+
 void
 rb_reset_random_seed()
 {
@@ -497,9 +522,24 @@
 }
 
 void
+Init_RandomSeed(void)
+{
+    fill_random_seed(initial_seed);
+    init_by_array((unsigned long*)initial_seed, 
DEFAULT_SEED_LEN/sizeof(unsigned long));
+    seed_initialized = 1;
+}
+
+static void
+Init_RandomSeed2(void)
+{
+    saved_seed = make_seed_value(initial_seed);
+    memset(initial_seed, 0, DEFAULT_SEED_LEN);
+}
+
+void
 Init_Random()
 {
-    rb_reset_random_seed();
+    Init_RandomSeed2();
     rb_define_global_function("srand", rb_f_srand, -1);
     rb_define_global_function("rand", rb_f_rand, -1);
     rb_global_variable(&saved_seed);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/st.c new/ruby-1.8.7-p357/st.c
--- old/ruby-1.8.7-p352/st.c    2007-02-13 00:01:19.000000000 +0100
+++ new/ruby-1.8.7-p357/st.c    2011-12-28 13:47:15.000000000 +0100
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #endif
 #include <string.h>
+#include <limits.h>
 #include "st.h"
 
 typedef struct st_table_entry st_table_entry;
@@ -521,6 +522,8 @@
     return 0;
 }
 
+static unsigned long hash_seed = 0;
+
 static int
 strhash(string)
     register const char *string;
@@ -550,10 +553,11 @@
 
     return val + (val << 15);
 #else
-    register int val = 0;
+    register unsigned long val = hash_seed;
 
     while ((c = *string++) != '\0') {
        val = val*997 + c;
+       val = (val << 13) | (val >> (sizeof(st_data_t) * CHAR_BIT - 13));
     }
 
     return val + (val>>5);
@@ -573,3 +577,11 @@
 {
     return n;
 }
+
+extern unsigned long rb_genrand_int32(void);
+
+void
+Init_st(void)
+{
+    hash_seed = rb_genrand_int32();
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/string.c new/ruby-1.8.7-p357/string.c
--- old/ruby-1.8.7-p352/string.c        2010-04-01 09:11:40.000000000 +0200
+++ new/ruby-1.8.7-p357/string.c        2011-12-28 13:47:15.000000000 +0100
@@ -3,7 +3,7 @@
   string.c -
 
   $Author: shyouhei $
-  $Date: 2010-04-01 16:11:40 +0900 (Thu, 01 Apr 2010) $
+  $Date: 2011-12-28 21:47:15 +0900 (Wed, 28 Dec 2011) $
   created at: Mon Aug  9 17:12:58 JST 1993
 
   Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -875,13 +875,15 @@
     return str1;
 }
 
+static unsigned long hash_seed;
+
 int
 rb_str_hash(str)
     VALUE str;
 {
     register long len = RSTRING(str)->len;
     register char *p = RSTRING(str)->ptr;
-    register int key = 0;
+    register unsigned long key = hash_seed;
 
 #if defined(HASH_ELFHASH)
     register unsigned int g;
@@ -905,6 +907,7 @@
     while (len--) {
        key = key*65599 + *p;
        p++;
+       key = (key << 13) | (key >> ((sizeof(unsigned long) * CHAR_BIT) - 13));
     }
     key = key + (key>>5);
 #endif
@@ -5062,4 +5065,6 @@
     rb_fs = Qnil;
     rb_define_variable("$;", &rb_fs);
     rb_define_variable("$-F", &rb_fs);
+
+    hash_seed = rb_genrand_int32();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/test/ruby/test_float.rb 
new/ruby-1.8.7-p357/test/ruby/test_float.rb
--- old/ruby-1.8.7-p352/test/ruby/test_float.rb 2008-07-10 06:54:53.000000000 
+0200
+++ new/ruby-1.8.7-p357/test/ruby/test_float.rb 2011-12-10 13:17:27.000000000 
+0100
@@ -144,4 +144,31 @@
     assert_operator((-4611686018427387905.0).to_i, :<, 0)
     assert_operator((-4611686018427387906.0).to_i, :<, 0)
   end
+
+  def test_cmp
+    inf = 1.0 / 0.0
+    nan = inf / inf
+    assert_equal(0, 1.0 <=> 1.0)
+    assert_equal(1, 1.0 <=> 0.0)
+    assert_equal(-1, 1.0 <=> 2.0)
+    assert_nil(1.0 <=> nil)
+    assert_nil(1.0 <=> nan)
+    assert_nil(nan <=> 1.0)
+
+    assert_equal(0, 1.0 <=> 1)
+    assert_equal(1, 1.0 <=> 0)
+    assert_equal(-1, 1.0 <=> 2)
+
+    assert_equal(-1, 1.0 <=> 2**32)
+
+    assert_equal(1, inf <=> (Float::MAX.to_i*2))
+    assert_equal(-1, -inf <=> (-Float::MAX.to_i*2))
+    assert_equal(-1, (Float::MAX.to_i*2) <=> inf)
+    assert_equal(1, (-Float::MAX.to_i*2) <=> -inf)
+
+    assert_raise(ArgumentError) { 1.0 > nil }
+    assert_raise(ArgumentError) { 1.0 >= nil }
+    assert_raise(ArgumentError) { 1.0 < nil }
+    assert_raise(ArgumentError) { 1.0 <= nil }
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/test/ruby/test_string.rb 
new/ruby-1.8.7-p357/test/ruby/test_string.rb
--- old/ruby-1.8.7-p352/test/ruby/test_string.rb        2010-04-01 
09:11:40.000000000 +0200
+++ new/ruby-1.8.7-p357/test/ruby/test_string.rb        2011-12-28 
13:47:15.000000000 +0100
@@ -1,4 +1,5 @@
 require 'test/unit'
+require File.expand_path('envutil', File.dirname(__FILE__))
 
 class TestString < Test::Unit::TestCase
   def check_sum(str, bits=16)
@@ -29,4 +30,16 @@
   ensure
     $KCODE = original_kcode
   end
+
+  def test_hash_random
+    str = 'abc'
+    a = [str.hash.to_s]
+    cmd = sprintf("%s -e 'print %s.hash'", EnvUtil.rubybin, str.dump)
+    3.times {
+      IO.popen(cmd, "rb") {|o|
+        a << o.read
+      }
+    }
+    assert_not_equal([str.hash.to_s], a.uniq)
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ruby-1.8.7-p352/version.h 
new/ruby-1.8.7-p357/version.h
--- old/ruby-1.8.7-p352/version.h       2011-06-30 05:53:30.000000000 +0200
+++ new/ruby-1.8.7-p357/version.h       2011-12-28 13:47:15.000000000 +0100
@@ -1,15 +1,15 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2011-06-30"
+#define RUBY_RELEASE_DATE "2011-12-28"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20110630
-#define RUBY_PATCHLEVEL 352
+#define RUBY_RELEASE_CODE 20111228
+#define RUBY_PATCHLEVEL 357
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2011
-#define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 30
+#define RUBY_RELEASE_MONTH 12
+#define RUBY_RELEASE_DAY 28
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to