[前][次][番号順一覧][スレッド一覧]

ruby-changes:32896

From: nagachika <ko1@a...>
Date: Sat, 15 Feb 2014 23:53:07 +0900 (JST)
Subject: [ruby-changes:32896] nagachika:r44975 (ruby_2_0_0): merge revision(s) r44926: [Backport #8756] [Backport #9248]

nagachika	2014-02-15 23:53:00 +0900 (Sat, 15 Feb 2014)

  New Revision: 44975

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44975

  Log:
    merge revision(s) r44926: [Backport #8756] [Backport #9248]
    
    * parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
    
    * parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
      attrset ID.  [ruby-core:60668] [Bug #8756]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/parse.y
    branches/ruby_2_0_0/test/-ext-/symbol/test_type.rb
    branches/ruby_2_0_0/test/ruby/test_struct.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 44974)
+++ ruby_2_0_0/ChangeLog	(revision 44975)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Feb 15 23:46:31 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
+
+	* parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
+	  attrset ID.  [ruby-core:60668] [Bug #8756]
+
 Sat Feb 15 23:42:04 2014  Richo Healy  <richo@p...>
 
 	* test/ruby/test_struct.rb: Add regression test for question marks and
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 44974)
+++ ruby_2_0_0/parse.y	(revision 44975)
@@ -10095,7 +10095,7 @@ rb_enc_symname_p(const char *name, rb_en https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L10095
 }
 
 #define IDSET_ATTRSET_FOR_SYNTAX ((1U<<ID_LOCAL)|(1U<<ID_CONST))
-#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<ID_SCOPE_MASK) & ~(1U<<ID_ATTRSET))
+#define IDSET_ATTRSET_FOR_INTERN (~(~0U<<(1<<ID_SCOPE_SHIFT)) & ~(1U<<ID_ATTRSET))
 
 static int
 rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_atttset)
@@ -10181,7 +10181,8 @@ rb_enc_symname_type(const char *name, lo https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L10181
 	    if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
 	    type = ID_JUNK;
 	    ++m;
-	    break;
+	    if (m + 1 < e || *m != '=') break;
+	    /* fall through */
 	  case '=':
 	    if (!(allowed_atttset & (1U << type))) return -1;
 	    type = ID_ATTRSET;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 44974)
+++ ruby_2_0_0/version.h	(revision 44975)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2014-02-15"
-#define RUBY_PATCHLEVEL 409
+#define RUBY_PATCHLEVEL 410
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
Index: ruby_2_0_0/test/ruby/test_struct.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_struct.rb	(revision 44974)
+++ ruby_2_0_0/test/ruby/test_struct.rb	(revision 44975)
@@ -319,6 +319,8 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_struct.rb#L319
     x = Object.new
     o = klass.new("test", x)
     assert_same(x, o.b?)
+    o.send("b?=", 42)
+    assert_equal(42, o.b?)
   end
 
   def test_bang_mark_in_member
@@ -326,6 +328,8 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_struct.rb#L328
     x = Object.new
     o = klass.new("test", x)
     assert_same(x, o.b!)
+    o.send("b!=", 42)
+    assert_equal(42, o.b!)
   end
 
   class TopStruct < Test::Unit::TestCase
Index: ruby_2_0_0/test/-ext-/symbol/test_type.rb
===================================================================
--- ruby_2_0_0/test/-ext-/symbol/test_type.rb	(revision 44974)
+++ ruby_2_0_0/test/-ext-/symbol/test_type.rb	(revision 44975)
@@ -105,6 +105,10 @@ module Test_Symbol https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/-ext-/symbol/test_type.rb#L105
       assert_equal(:"[foo]=", Bug::Symbol.attrset("[foo]"))
       assert_symtype(Bug::Symbol.attrset("[foo]"), :attrset?)
       assert_equal(:[]=, Bug::Symbol.attrset(:[]))
+      assert_symtype(Bug::Symbol.attrset("foo?="), :attrset?)
+      assert_equal(:"foo?=", Bug::Symbol.attrset(:foo?))
+      assert_symtype(Bug::Symbol.attrset("foo!="), :attrset?)
+      assert_equal(:"foo!=", Bug::Symbol.attrset(:foo!))
     end
   end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44926


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]