From 7693578c37225f3cecb8655918cc9912e3a3e880 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Sep 2014 16:58:03 +0000 Subject: [PATCH 01/26] * version.h (RUBY_VERSION): bump RUBY_VERSION to 2.1.4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ version.h | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 744eec898bfd01..5c1a5d7e9e2c09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Sep 24 01:43:13 2014 CHIKANAGA Tomoyuki + + * version.h (RUBY_VERSION): bump RUBY_VERSION to 2.1.4. + Fri Sep 19 00:58:34 2014 CHIKANAGA Tomoyuki * version.h (RUBY_VERSION): bump RUBY_VERSION to 2.1.3. diff --git a/version.h b/version.h index 8666e8c411f39f..c6b60511d3062e 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ -#define RUBY_VERSION "2.1.3" -#define RUBY_RELEASE_DATE "2014-09-19" -#define RUBY_PATCHLEVEL 242 +#define RUBY_VERSION "2.1.4" +#define RUBY_RELEASE_DATE "2014-09-24" +#define RUBY_PATCHLEVEL 243 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 24 #include "ruby/version.h" From 77ce45dbe435124df3a6f496caa74be8c3a47bf7 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Sep 2014 17:07:16 +0000 Subject: [PATCH 02/26] merge revision(s) r47111,r47212,r47451,r47452,r47680: [Backport #10245] * test/minitest/test_minitest_unit.rb: removed obsoleted condition for Ruby 1.8. * test/ruby/test_time_tz.rb: ditto. * test/ruby/test_time_tz.rb: Fix test error with tzdata-2014g. [ruby-core:65058] [Bug #10245] Reported by Vit Ondruch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++ test/minitest/test_minitest_unit.rb | 6 +- test/ruby/test_time_tz.rb | 145 +++++++++++++++++++--------- version.h | 2 +- 4 files changed, 112 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c1a5d7e9e2c09..d609a002471122 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Sep 24 02:06:33 2014 Tanaka Akira + + * test/ruby/test_time_tz.rb: Fix test error with tzdata-2014g. + [ruby-core:65058] [Bug #10245] Reported by Vit Ondruch. + +Wed Sep 24 02:06:33 2014 SHIBATA Hiroshi + + * test/minitest/test_minitest_unit.rb: removed obsoleted condition + for Ruby 1.8. + * test/ruby/test_time_tz.rb: ditto. + Wed Sep 24 01:43:13 2014 CHIKANAGA Tomoyuki * version.h (RUBY_VERSION): bump RUBY_VERSION to 2.1.4. diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb index 0f29614e87cfd7..207b12f6392ed6 100644 --- a/test/minitest/test_minitest_unit.rb +++ b/test/minitest/test_minitest_unit.rb @@ -197,11 +197,7 @@ def test_omg; assert true; end end def util_expand_bt bt - if RUBY_VERSION >= '1.9.0' then - bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f } - else - bt - end + bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f } end end diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index bb69af87b48a43..533ceb3d8e0031 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -2,34 +2,43 @@ class TestTimeTZ < Test::Unit::TestCase has_right_tz = true + has_lisbon_tz = true force_tz_test = ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" case RUBY_PLATFORM when /linux/ force_tz_test = true when /darwin|freebsd/ - has_right_tz = false + has_lisbon_tz = false force_tz_test = true end if force_tz_test - def with_tz(tz) - old = ENV["TZ"] - begin - ENV["TZ"] = tz - yield - ensure - ENV["TZ"] = old + module Util + def with_tz(tz) + old = ENV["TZ"] + begin + ENV["TZ"] = tz + yield + ensure + ENV["TZ"] = old + end end end else - def with_tz(tz) - if ENV["TZ"] == tz - yield + module Util + def with_tz(tz) + if ENV["TZ"] == tz + yield + end end end end module Util + def have_tz_offset?(tz) + with_tz(tz) {!Time.now.utc_offset.zero?} + end + def format_gmtoff(gmtoff, colon=false) if gmtoff < 0 expected = "-" @@ -72,14 +81,11 @@ def group_by(e, &block) include Util extend Util - if RUBY_VERSION < "1.9" - def time_to_s(t) - t.strftime("%Y-%m-%d %H:%M:%S ") + format_gmtoff(t.gmtoff) - end - else - def time_to_s(t) - t.to_s - end + has_right_tz &&= have_tz_offset?("right/America/Los_Angeles") + has_lisbon_tz &&= have_tz_offset?("Europe/Lisbon") + + def time_to_s(t) + t.to_s end @@ -153,7 +159,7 @@ def test_europe_lisbon with_tz(tz="Europe/Lisbon") { assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone) } - end if has_right_tz + end if has_lisbon_tz def test_europe_moscow with_tz(tz="Europe/Moscow") { @@ -200,35 +206,42 @@ def self.gen_test_name(hint) s.sub(/gen_/) { "gen" + "_#{hint}_".gsub(/[^0-9A-Za-z]+/, '_') } end + def self.parse_zdump_line(line) + return nil if /\A\#/ =~ line || /\A\s*\z/ =~ line + if /\A(\S+)\s+ + \S+\s+(\S+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d+)\s+UTC? + \s+=\s+ + \S+\s+(\S+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d+)\s+\S+ + \s+isdst=\d+\s+gmtoff=(-?\d+)\n + \z/x !~ line + raise "unexpected zdump line: #{line.inspect}" + end + tz, u_mon, u_day, u_hour, u_min, u_sec, u_year, + l_mon, l_day, l_hour, l_min, l_sec, l_year, gmtoff = $~.captures + u_year = u_year.to_i + u_mon = MON2NUM[u_mon] + u_day = u_day.to_i + u_hour = u_hour.to_i + u_min = u_min.to_i + u_sec = u_sec.to_i + l_year = l_year.to_i + l_mon = MON2NUM[l_mon] + l_day = l_day.to_i + l_hour = l_hour.to_i + l_min = l_min.to_i + l_sec = l_sec.to_i + gmtoff = gmtoff.to_i + [tz, + [u_year, u_mon, u_day, u_hour, u_min, u_sec], + [l_year, l_mon, l_day, l_hour, l_min, l_sec], + gmtoff] + end + def self.gen_zdump_test(data) sample = [] data.each_line {|line| - next if /\A\#/ =~ line || /\A\s*\z/ =~ line - /\A(\S+)\s+ - \S+\s+(\S+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d+)\s+UTC - \s+=\s+ - \S+\s+(\S+)\s+(\d+)\s+(\d\d):(\d\d):(\d\d)\s+(\d+)\s+\S+ - \s+isdst=\d+\s+gmtoff=(-?\d+)\n - \z/x =~ line - tz, u_mon, u_day, u_hour, u_min, u_sec, u_year, - l_mon, l_day, l_hour, l_min, l_sec, l_year, gmtoff = $~.captures - u_year = u_year.to_i - u_mon = MON2NUM[u_mon] - u_day = u_day.to_i - u_hour = u_hour.to_i - u_min = u_min.to_i - u_sec = u_sec.to_i - l_year = l_year.to_i - l_mon = MON2NUM[l_mon] - l_day = l_day.to_i - l_hour = l_hour.to_i - l_min = l_min.to_i - l_sec = l_sec.to_i - gmtoff = gmtoff.to_i - sample << [tz, - [u_year, u_mon, u_day, u_hour, u_min, u_sec], - [l_year, l_mon, l_day, l_hour, l_min, l_sec], - gmtoff] + s = parse_zdump_line(line) + sample << s if s } sample.each {|tz, u, l, gmtoff| expected_utc = "%04d-%02d-%02d %02d:%02d:%02d UTC" % u @@ -249,6 +262,7 @@ def self.gen_zdump_test(data) } } } + group_by(sample) {|tz, _, _, _| tz }.each {|tz, a| a.each_with_index {|(_, u, l, gmtoff), i| expected = "%04d-%02d-%02d %02d:%02d:%02d %s" % (l+[format_gmtoff(gmtoff)]) @@ -348,6 +362,45 @@ def self.gen_zdump_test(data) #right/Asia/Tokyo Sat Dec 31 23:59:60 2005 UTC = Sun Jan 1 08:59:60 2006 JST isdst=0 gmtoff=32400 right/Europe/Paris Fri Jun 30 23:59:60 1972 UTC = Sat Jul 1 00:59:60 1972 CET isdst=0 gmtoff=3600 right/Europe/Paris Wed Dec 31 23:59:60 2008 UTC = Thu Jan 1 00:59:60 2009 CET isdst=0 gmtoff=3600 +End + + def self.gen_variational_zdump_test(hint, data) + sample = [] + data.each_line {|line| + s = parse_zdump_line(line) + sample << s if s + } + + define_method(gen_test_name(hint)) { + results = [] + sample.each {|tz, u, l, gmtoff| + expected_utc = "%04d-%02d-%02d %02d:%02d:%02d UTC" % u + expected = "%04d-%02d-%02d %02d:%02d:%02d %s" % (l+[format_gmtoff(gmtoff)]) + mesg_utc = "TZ=#{tz} Time.utc(#{u.map {|arg| arg.inspect }.join(', ')})" + mesg = "#{mesg_utc}.localtime" + with_tz(tz) { + t = nil + assert_nothing_raised(mesg) { t = Time.utc(*u) } + assert_equal(expected_utc, time_to_s(t), mesg_utc) + assert_nothing_raised(mesg) { t.localtime } + + results << [ + expected == time_to_s(t), + gmtoff == t.gmtoff, + format_gmtoff(gmtoff) == t.strftime("%z"), + format_gmtoff(gmtoff, true) == t.strftime("%:z"), + format_gmtoff2(gmtoff) == t.strftime("%::z") + ] + } + } + assert_includes(results, [true, true, true, true, true]) + } + end + + # tzdata-2014g fixed the offset for lisbon from -0:36:32 to -0:36:45. + # [ruby-core:65058] [Bug #10245] + gen_variational_zdump_test "lisbon", <<'End' if has_lisbon_tz Europe/Lisbon Mon Jan 1 00:36:31 1912 UTC = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2192 +Europe/Lisbon Mon Jan 1 00:36:44 1912 UT = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2205 End end diff --git a/version.h b/version.h index c6b60511d3062e..3476d73246447b 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-09-24" -#define RUBY_PATCHLEVEL 243 +#define RUBY_PATCHLEVEL 244 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 From c8ec78cb09e70df30b4c3b7b4b865f73bc6d0094 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Sep 2014 17:18:59 +0000 Subject: [PATCH 03/26] merge revision(s) r47683: [Backport #10281] array.c: GC guard * array.c (rb_ary_splice): prevent replacing array from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 1 + version.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/array.c b/array.c index 3d2409340c8ea1..79f7d3b5373b4e 100644 --- a/array.c +++ b/array.c @@ -1585,6 +1585,7 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl) MEMMOVE(RARRAY_PTR(ary) + beg, RARRAY_CONST_PTR(rpl), VALUE, rlen); } } + RB_GC_GUARD(rpl); } void diff --git a/version.h b/version.h index 3476d73246447b..ebd55759bbb281 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-09-24" -#define RUBY_PATCHLEVEL 244 +#define RUBY_PATCHLEVEL 245 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 From ee69bb41bea710942fb0f92ca38f23abbf8b4781 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Sep 2014 17:22:03 +0000 Subject: [PATCH 04/26] merge revision(s) r47641,r47642,r47644: [Backport #10262] * win32/win32.c (VCSUP): nothing to do if this worktree is not under any VCS (it means that the worktree may be from the release package). * win32/Makefile.sub (VCSUP): nothing to do if this worktree is not under any VCS (it means that the worktree may be from the release package). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ version.h | 2 +- win32/Makefile.sub | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d609a002471122..638994812bd990 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 24 02:21:41 2014 NAKAMURA Usaku + + * win32/Makefile.sub (VCSUP): nothing to do if this worktree is not + under any VCS (it means that the worktree may be from the release + package). + Wed Sep 24 02:06:33 2014 Tanaka Akira * test/ruby/test_time_tz.rb: Fix test error with tzdata-2014g. diff --git a/version.h b/version.h index ebd55759bbb281..7f6a16230da023 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-09-24" -#define RUBY_PATCHLEVEL 245 +#define RUBY_PATCHLEVEL 246 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 diff --git a/win32/Makefile.sub b/win32/Makefile.sub index d6289bc53d381f..e393b46253d8fc 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -377,6 +377,8 @@ VCSUP = $(VCS) rebase $(GITSVNREBASEOPTIONS) !else if exist($(srcdir)/.git) VCS = git VCSUP = $(VCS) pull $(GITPULLOPTIONS) +!else +VCSUP = rem !endif ruby_pc = $(RUBY_BASE_NAME)-$(MAJOR).$(MINOR).pc From 2ccf72827a05afb9fb8c9e60c3fb1a72ff177250 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Sep 2014 17:39:48 +0000 Subject: [PATCH 05/26] merge revision(s) r47696,r47697: [Backport #10279] * parse.y (parse_ident): just after a label, new expression should start, cannot be a modifier. [ruby-core:65211] [Bug #10279] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 2 +- test/ruby/test_keyword.rb | 14 ++++++++++++++ version.h | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 638994812bd990..d0d4a03105eb52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 24 02:30:55 2014 Nobuyoshi Nakada + + * parse.y (parse_ident): just after a label, new expression should + start, cannot be a modifier. [ruby-core:65211] [Bug #10279] + Wed Sep 24 02:21:41 2014 NAKAMURA Usaku * win32/Makefile.sub (VCSUP): nothing to do if this worktree is not diff --git a/parse.y b/parse.y index 5991376820c8cb..37e3cbdcd6e5da 100644 --- a/parse.y +++ b/parse.y @@ -8195,7 +8195,7 @@ parser_yylex(struct parser_params *parser) return keyword_do_block; return keyword_do; } - if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE))) + if (IS_lex_state_for(state, (EXPR_BEG | EXPR_VALUE | EXPR_LABELARG))) return kw->id[0]; else { if (kw->id[0] != kw->id[1]) diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 0930cf0f5d0868..e7bd11b18b0beb 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -325,7 +325,9 @@ def test_required_keyword assert_equal([[:keyreq, :a], [:keyrest, :b]], o.method(:bar).parameters, feature7701) assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar(c: bug8139)} assert_raise_with_message(ArgumentError, /missing keyword/, bug8139) {o.bar} + end + def test_required_keyword_with_newline bug9669 = '[ruby-core:61658] [Bug #9669]' assert_nothing_raised(SyntaxError, bug9669) do eval(<<-'end;', nil, __FILE__, __LINE__) @@ -335,6 +337,7 @@ def bug9669.foo a: end; end assert_equal(42, bug9669.foo(a: 42)) + o = nil assert_nothing_raised(SyntaxError, bug9669) do eval(<<-'end;', nil, __FILE__, __LINE__) o = { @@ -346,6 +349,17 @@ def bug9669.foo a: assert_equal({a: 1}, o, bug9669) end + def test_required_keyword_with_reserved + bug10279 = '[ruby-core:65211] [Bug #10279]' + h = nil + assert_nothing_raised(SyntaxError, bug10279) do + break eval(<<-'end;', nil, __FILE__, __LINE__) + h = {a: if true then 42 end} + end; + end + assert_equal({a: 42}, h, bug10279) + end + def test_block_required_keyword feature7701 = '[ruby-core:51454] [Feature #7701] required keyword argument' b = assert_nothing_raised(SyntaxError, feature7701) do diff --git a/version.h b/version.h index 7f6a16230da023..b25ed3f6ba05c2 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-09-24" -#define RUBY_PATCHLEVEL 246 +#define RUBY_PATCHLEVEL 247 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9 From 309b9303c194d594222aa2919c3b531e4d825492 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:06:27 +0000 Subject: [PATCH 06/26] merge revision(s) r47820: [Backport #10330] * error.c: update exception tree. [DOC] reported by @hemge via twitter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ error.c | 11 +++++++---- version.h | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0d4a03105eb52..6f77b75fc834a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 15 22:46:52 2014 NAKAMURA Usaku + + * error.c: update exception tree. [DOC] + reported by @hemge via twitter. + Wed Sep 24 02:30:55 2014 Nobuyoshi Nakada * parse.y (parse_ident): just after a label, new expression should diff --git a/error.c b/error.c index d533a3bf4b1ef1..e90f9b410a92b9 100644 --- a/error.c +++ b/error.c @@ -1740,14 +1740,18 @@ syserr_eqq(VALUE self, VALUE exc) * * LoadError * * NotImplementedError * * SyntaxError + * * SecurityError * * SignalException * * Interrupt * * StandardError -- default for +rescue+ * * ArgumentError - * * IndexError - * * StopIteration + * * EncodingError + * * FiberError * * IOError * * EOFError + * * IndexError + * * KeyError + * * StopIteration * * LocalJumpError * * NameError * * NoMethodError @@ -1755,14 +1759,13 @@ syserr_eqq(VALUE self, VALUE exc) * * FloatDomainError * * RegexpError * * RuntimeError -- default for +raise+ - * * SecurityError * * SystemCallError * * Errno::* - * * SystemStackError * * ThreadError * * TypeError * * ZeroDivisionError * * SystemExit + * * SystemStackError * * fatal -- impossible to rescue */ diff --git a/version.h b/version.h index b25ed3f6ba05c2..daa270cffccbb2 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.4" -#define RUBY_RELEASE_DATE "2014-09-24" -#define RUBY_PATCHLEVEL 247 +#define RUBY_RELEASE_DATE "2014-10-15" +#define RUBY_PATCHLEVEL 248 #define RUBY_RELEASE_YEAR 2014 -#define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 24 +#define RUBY_RELEASE_MONTH 10 +#define RUBY_RELEASE_DAY 15 #include "ruby/version.h" From 9ecfc87fa52fee44a023f5030d96a765532967a5 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:08:15 +0000 Subject: [PATCH 07/26] merge revision(s) r47819: [Backport #9914] * configure.in: Fix typo. [Bug #9914] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ configure.in | 2 +- version.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f77b75fc834a0..cdffa806f153a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Oct 15 23:08:02 2014 Rei Odaira + + * configure.in: Fix typo. [Bug #9914] + Wed Oct 15 22:46:52 2014 NAKAMURA Usaku * error.c: update exception tree. [DOC] diff --git a/configure.in b/configure.in index fc01f3b42526b0..1f6a044229724b 100644 --- a/configure.in +++ b/configure.in @@ -1165,7 +1165,7 @@ AS_CASE(["$target_os"], [ # AIX currently does not support a 32-bit call to posix_fadvise() # if _LARGE_FILES is defined. - ac_cv_posix_fadvise=no + ac_cv_func_posix_fadvise=no ]) ]) diff --git a/version.h b/version.h index daa270cffccbb2..311e5a266471e1 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 248 +#define RUBY_PATCHLEVEL 249 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From b1c5f7e23d049276c57fd6298faf600f1cb16e1b Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:10:21 +0000 Subject: [PATCH 08/26] merge revision(s) r47850: [Backport #10294] * dir.c (dir_s_aref): fix rdoc. `Dir.glob` allows an array but `Dir[]` not. the former accepts an optional parameter `flags`, while the latter accepts arbitrary number of arguments but no `flags`. [ruby-core:65265] [Bug #10294] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ dir.c | 2 -- version.h | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdffa806f153a5..a9586ff9c3a2dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Oct 15 23:10:07 2014 Nobuyoshi Nakada + + * dir.c (dir_s_aref): fix rdoc. `Dir.glob` allows an array but + `Dir[]` not. the former accepts an optional parameter `flags`, + while the latter accepts arbitrary number of arguments but no + `flags`. [ruby-core:65265] [Bug #10294] + Wed Oct 15 23:08:02 2014 Rei Odaira * configure.in: Fix typo. [Bug #9914] diff --git a/dir.c b/dir.c index 8492ce78d0327b..3188a9eb38c776 100644 --- a/dir.c +++ b/dir.c @@ -1784,11 +1784,9 @@ dir_globs(long argc, const VALUE *argv, int flags) /* * call-seq: - * Dir[ array ] -> array * Dir[ string [, string ...] ] -> array * * Equivalent to calling - * Dir.glob(array,0) and * Dir.glob([string,...],0). * */ diff --git a/version.h b/version.h index 311e5a266471e1..988ccb7b1648c6 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 249 +#define RUBY_PATCHLEVEL 250 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From 22a193f1c95c9d60ecf8a9939110fa5ae8439e0c Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:12:22 +0000 Subject: [PATCH 09/26] merge revision(s) r47891: [Backport #10373] proc.c: method body GC guard * proc.c (rb_mod_define_method): guard method body to prevent its method entry from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 1 + version.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/proc.c b/proc.c index cc4e71080c3e5b..e5b6e5313d905e 100644 --- a/proc.c +++ b/proc.c @@ -1666,6 +1666,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) if (noex == NOEX_MODFUNC) { rb_method_entry_set(rb_singleton_class(mod), id, method->me, NOEX_PUBLIC); } + RB_GC_GUARD(body); } else if (rb_obj_is_proc(body)) { rb_proc_t *proc; diff --git a/version.h b/version.h index 988ccb7b1648c6..1ce6b38ab58304 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 250 +#define RUBY_PATCHLEVEL 251 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From a50794de2eac7e6dab01204355b5d94346119a4a Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:24:14 +0000 Subject: [PATCH 10/26] merge revision(s) r47896: [Backport #10369] * array.c (ary_recycle_hash): add RB_GC_GUARD (rb_ary_diff): remove volatile [Bug #10369] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ array.c | 3 ++- version.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9586ff9c3a2dd..23b8d106e4d010 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 15 23:13:43 2014 Eric Wong + + * array.c (ary_recycle_hash): add RB_GC_GUARD + (rb_ary_diff): remove volatile + [Bug #10369] + Wed Oct 15 23:10:07 2014 Nobuyoshi Nakada * dir.c (dir_s_aref): fix rdoc. `Dir.glob` allows an array but diff --git a/array.c b/array.c index 79f7d3b5373b4e..7760e3313e196d 100644 --- a/array.c +++ b/array.c @@ -3949,6 +3949,7 @@ ary_recycle_hash(VALUE hash) RHASH(hash)->ntbl = 0; st_free_table(tbl); } + RB_GC_GUARD(hash); } /* @@ -3972,7 +3973,7 @@ static VALUE rb_ary_diff(VALUE ary1, VALUE ary2) { VALUE ary3; - volatile VALUE hash; + VALUE hash; long i; hash = ary_make_hash(to_ary(ary2)); diff --git a/version.h b/version.h index 1ce6b38ab58304..85ff2c91177be1 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 251 +#define RUBY_PATCHLEVEL 252 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From 39fcf333ad8578a4c7fdf2f25054bce31c93712a Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:47:38 +0000 Subject: [PATCH 11/26] merge revision(s) r45715: [Backport #10265] * configure.in: NetBSD's ksh, used by configure, needs escapes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ configure.in | 2 +- version.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23b8d106e4d010..9f2063870f8a6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Oct 15 23:25:24 2014 NARUSE, Yui + + * configure.in: NetBSD's ksh, used by configure, needs escapes. + Wed Oct 15 23:13:43 2014 Eric Wong * array.c (ary_recycle_hash): add RB_GC_GUARD diff --git a/configure.in b/configure.in index 1f6a044229724b..bb1ab8abd84a83 100644 --- a/configure.in +++ b/configure.in @@ -2092,7 +2092,7 @@ if test x$setjmp_prefix = xsig; then else unset setjmp_sigmask fi -AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+($setjmp_cast)}) +AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+\($setjmp_cast\)}) AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask+,0})]) AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp($setjmp_cast(env),val)]) AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf) diff --git a/version.h b/version.h index 85ff2c91177be1..a34f6bc45bb58f 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 252 +#define RUBY_PATCHLEVEL 253 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From b3cfa2f7b136d1c708a13d965dd63e7b9869dbee Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 14:51:58 +0000 Subject: [PATCH 12/26] merge revision(s) r46783: [Backport #6716] * lib/fileutils.rb: handle ENOENT error with symlink targeted to non-exists file. [ruby-dev:45933] [Bug #6716] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/fileutils.rb | 12 +++++++++--- test/fileutils/test_fileutils.rb | 6 ++++++ version.h | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f2063870f8a6f..1f65e70b03b0dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 15 23:50:33 2014 SHIBATA Hiroshi + + * lib/fileutils.rb: handle ENOENT error with symlink targeted to + non-exists file. [ruby-dev:45933] [Bug #6716] + Wed Oct 15 23:25:24 2014 NARUSE, Yui * configure.in: NetBSD's ksh, used by configure, needs escapes. diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 99044e2cd63114..335d60d4a259b2 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -854,7 +854,8 @@ def install(src, dest, options = {}) fu_check_options options, OPT_TABLE['install'] fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] return if options[:noop] - fu_each_src_dest(src, dest) do |s, d, st| + fu_each_src_dest(src, dest) do |s, d| + st = File.stat(s) unless File.exist?(d) and compare_file(s, d) remove_file d, true copy_file s, d @@ -1252,7 +1253,12 @@ def dereference? end def exist? - lstat! ? true : false + begin + lstat + true + rescue Errno::ENOENT + false + end end def file? @@ -1570,7 +1576,7 @@ def fu_list(arg) #:nodoc: def fu_each_src_dest(src, dest) #:nodoc: fu_each_src_dest0(src, dest) do |s, d| raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d) - yield s, d, File.stat(s) + yield s, d end end private_module_function :fu_each_src_dest diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index c5f8734fead116..6aa89c49eff03e 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -420,6 +420,12 @@ def test_mv_symlink assert_raise(Errno::ELOOP) { mv 'tmp/symlink', 'tmp/symlink' } + # unexist symlink + File.symlink 'xxx', 'tmp/src' + assert_nothing_raised { + mv 'tmp/src', 'tmp/dest' + } + assert_equal true, File.symlink?('tmp/dest') end if have_symlink? def test_mv_pathname diff --git a/version.h b/version.h index a34f6bc45bb58f..7dcdc5f5e7381a 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-15" -#define RUBY_PATCHLEVEL 253 +#define RUBY_PATCHLEVEL 254 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From 8bdf68d182398e82e31b208ef2a8856ad33550a4 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 15:05:45 +0000 Subject: [PATCH 13/26] merge r47598 partially. extracted commits are as follows. [Bug #9728] https://github.com/k-takata/Onigmo/commit/15ddec6d18e27fdc1988236764e766fd5892ecf5 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ regcomp.c | 10 +++++++--- regexec.c | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f65e70b03b0dc..7d5d1f48a11f2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 15 23:58:13 2014 CHIKANAGA Tomoyuki + + merge r47598 partially. extracted commits are as follows. [Bug #9728] + https://github.com/k-takata/Onigmo/commit/15ddec6d18e27fdc1988236764e766fd5892ecf5 + Wed Oct 15 23:50:33 2014 SHIBATA Hiroshi * lib/fileutils.rb: handle ENOENT error with symlink targeted to diff --git a/regcomp.c b/regcomp.c index 705e0faad774ee..15d71f4906fe0c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4495,6 +4495,9 @@ concat_opt_anc_info(OptAncInfo* to, OptAncInfo* left, OptAncInfo* right, if (right_len == 0) { to->right_anchor |= left->right_anchor; } + else { + to->right_anchor |= (left->right_anchor & ANCHOR_PREC_READ_NOT); + } } static int @@ -5068,7 +5071,8 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env) case ANCHOR_END_BUF: case ANCHOR_SEMI_END_BUF: case ANCHOR_END_LINE: - case ANCHOR_LOOK_BEHIND: /* just for (?<=x).* */ + case ANCHOR_LOOK_BEHIND: /* just for (?<=x).* */ + case ANCHOR_PREC_READ_NOT: /* just for (?!x).* */ add_opt_anc_info(&opt->anc, NANCHOR(node)->type); break; @@ -5091,7 +5095,6 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env) } break; - case ANCHOR_PREC_READ_NOT: case ANCHOR_LOOK_BEHIND_NOT: break; } @@ -5357,7 +5360,8 @@ set_optimize_info_from_tree(Node* node, regex_t* reg, ScanEnv* scan_env) ANCHOR_BEGIN_POSITION | ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML | ANCHOR_LOOK_BEHIND); - reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF); + reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF | + ANCHOR_PREC_READ_NOT); if (reg->anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)) { reg->anchor_dmin = opt.len.min; diff --git a/regexec.c b/regexec.c index 973d3eac0004e6..6c5ba577606081 100644 --- a/regexec.c +++ b/regexec.c @@ -4184,7 +4184,7 @@ onig_search_gpos(regex_t* reg, const UChar* str, const UChar* end, prev = s; s += enclen(reg->enc, s, end); - if ((reg->anchor & ANCHOR_LOOK_BEHIND) == 0) { + if ((reg->anchor & (ANCHOR_LOOK_BEHIND | ANCHOR_PREC_READ_NOT)) == 0) { while (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0) && s < range) { prev = s; From 69fe55ab72387160c0465722b6a625b007244632 Mon Sep 17 00:00:00 2001 From: svn Date: Wed, 15 Oct 2014 15:05:59 +0000 Subject: [PATCH 14/26] * 2014-10-16 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.h b/version.h index 7dcdc5f5e7381a..831485e550013c 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.4" -#define RUBY_RELEASE_DATE "2014-10-15" +#define RUBY_RELEASE_DATE "2014-10-16" #define RUBY_PATCHLEVEL 254 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 15 +#define RUBY_RELEASE_DAY 16 #include "ruby/version.h" From 982aab0e823e59af59ab77aff241d4a9cf2596b5 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 15:18:04 +0000 Subject: [PATCH 15/26] merge revision(s) r47818,r47832: [Backport #9820] * signal.c (rb_f_kill): should not ignore signal unless the default handler is registered. [ruby-dev:48592] [Bug #9820] * signal.c (rb_f_kill): get rid of deadlock as unhandled and discarded signals do not make interrupt_cond signaled. based on the patch by Kazuki Tsujimoto at [ruby-dev:48606]. [Bug #9820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 12 ++++++++++++ signal.c | 16 +++++++++++++--- test/ruby/test_signal.rb | 12 ++++++++++++ version.h | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d5d1f48a11f2c..1f00e4ebf519da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Oct 16 00:10:45 2014 Nobuyoshi Nakada + + * signal.c (rb_f_kill): get rid of deadlock as unhandled and + discarded signals do not make interrupt_cond signaled. + based on the patch by Kazuki Tsujimoto at [ruby-dev:48606]. + [Bug #9820] + +Thu Oct 16 00:10:45 2014 Nobuyoshi Nakada + + * signal.c (rb_f_kill): should not ignore signal unless the + default handler is registered. [ruby-dev:48592] [Bug #9820] + Wed Oct 15 23:58:13 2014 CHIKANAGA Tomoyuki merge r47598 partially. extracted commits are as follows. [Bug #9728] diff --git a/signal.c b/signal.c index 82fad956df7ac5..3db044e517a2fd 100644 --- a/signal.c +++ b/signal.c @@ -343,6 +343,7 @@ ruby_default_signal(int sig) raise(sig); } +static RETSIGTYPE sighandler(int sig); static int signal_ignored(int sig); static void signal_enque(int sig); @@ -449,6 +450,7 @@ rb_f_kill(int argc, VALUE *argv) rb_pid_t pid = NUM2PIDT(argv[i]); if ((sig != 0) && (self != -1) && (pid == self)) { + int t; /* * When target pid is self, many caller assume signal will be * delivered immediately and synchronously. @@ -467,7 +469,12 @@ rb_f_kill(int argc, VALUE *argv) ruby_kill(pid, sig); break; default: - if (signal_ignored(sig)) break; + t = signal_ignored(sig); + if (t) { + if (t < 0 && kill(pid, sig)) + rb_sys_fail(0); + break; + } signal_enque(sig); wakeup = 1; } @@ -612,16 +619,19 @@ ruby_nativethread_signal(int signum, sighandler_t handler) static int signal_ignored(int sig) { + sighandler_t func; #ifdef POSIX_SIGNAL struct sigaction old; (void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old)); if (sigaction(sig, NULL, &old) < 0) return FALSE; - return old.sa_handler == SIG_IGN; + func = old.sa_handler; #else sighandler_t old = signal(sig, SIG_DFL); signal(sig, old); - return old == SIG_IGN; + func = old; #endif + if (func == SIG_IGN) return 1; + return func == sighandler ? 0 : -1; } static void diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb index e329df9a341252..d3e8f864c97fad 100644 --- a/test/ruby/test_signal.rb +++ b/test/ruby/test_signal.rb @@ -278,5 +278,17 @@ def test_ignored_interrupt Process.kill(:INT, $$) end end; + + if trap = Signal.list['TRAP'] + bug9820 = '[ruby-dev:48592] [Bug #9820]' + status = assert_in_out_err(['-e', 'Process.kill(:TRAP, $$)']) + assert_predicate(status, :signaled?, bug9820) + assert_equal(trap, status.termsig, bug9820) + end + + if Signal.list['CONT'] + bug9820 = '[ruby-dev:48606] [Bug #9820]' + assert_ruby_status(['-e', 'Process.kill(:CONT, $$)']) + end end if Process.respond_to?(:kill) end diff --git a/version.h b/version.h index 831485e550013c..27189944d748bc 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 254 +#define RUBY_PATCHLEVEL 255 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From d396f66630a1f477d15b1e840590750af3d4d797 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 15:28:55 +0000 Subject: [PATCH 16/26] merge revision(s) r47715: [Backport #10282] * object.c (rb_class_real): do not dereference 0 VALUE * test/ruby/test_module.rb (test_inspect_segfault): Test case and bug report by Thomas Stratmann. [ruby-core:65214] [Bug #10282] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ object.c | 5 ++--- test/ruby/test_module.rb | 24 ++++++++++++++++++++++++ version.h | 2 +- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f00e4ebf519da..0ba5dbd6f9a288 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Oct 16 00:20:12 2014 Eric Wong + + * object.c (rb_class_real): do not dereference 0 VALUE + + * test/ruby/test_module.rb (test_inspect_segfault): + Test case and bug report by Thomas Stratmann. + [ruby-core:65214] [Bug #10282] + Thu Oct 16 00:10:45 2014 Nobuyoshi Nakada * signal.c (rb_f_kill): get rid of deadlock as unhandled and diff --git a/object.c b/object.c index 34eac51a1d1b15..0d7e03a95f1bd1 100644 --- a/object.c +++ b/object.c @@ -203,9 +203,8 @@ rb_obj_not_equal(VALUE obj1, VALUE obj2) VALUE rb_class_real(VALUE cl) { - if (cl == 0) - return 0; - while ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS) { + while (cl && + ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS)) { cl = RCLASS_SUPER(cl); } return cl; diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 372a2d4ca5d08e..050d17a5d3fd1c 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1957,6 +1957,30 @@ def foo; end } end + def test_inspect_segfault + bug_10282 = '[ruby-core:65214] [Bug #10282]' + assert_separately [], <<-RUBY + module ShallowInspect + def shallow_inspect + "foo" + end + end + + module InspectIsShallow + include ShallowInspect + alias_method :inspect, :shallow_inspect + end + + class A + end + + A.prepend InspectIsShallow + + expect = "#" + assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}" + RUBY + end + private def assert_top_method_is_private(method) diff --git a/version.h b/version.h index 27189944d748bc..e9dc8dc4c8a063 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 255 +#define RUBY_PATCHLEVEL 256 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From 90c3ddc5786fcfd933c1825738034e275ebfbac9 Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 15 Oct 2014 15:31:03 +0000 Subject: [PATCH 17/26] merge revision(s) r47900: [Backport #10035] * lib/find.rb (Find.find): Call to_path for arguments to obtain strings. [ruby-core:63713] [Bug #10035] Reported by Herwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/find.rb | 1 + version.h | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0ba5dbd6f9a288..d73611b9be2aa4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Oct 16 00:30:30 2014 Tanaka Akira + + * lib/find.rb (Find.find): Call to_path for arguments to obtain + strings. + [ruby-core:63713] [Bug #10035] Reported by Herwin. + Thu Oct 16 00:20:12 2014 Eric Wong * object.c (rb_class_real): do not dereference 0 VALUE diff --git a/lib/find.rb b/lib/find.rb index 6f3e4282edbe82..d33c8bb16bc3e5 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -40,6 +40,7 @@ def find(*paths) # :yield: path fs_encoding = Encoding.find("filesystem") paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path| + path = path.to_path if path.respond_to? :to_path enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding ps = [path] while file = ps.shift diff --git a/version.h b/version.h index e9dc8dc4c8a063..8c09c61a656004 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 256 +#define RUBY_PATCHLEVEL 257 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From dac945b48cf5921a9fa411a929390905cc6dcacf Mon Sep 17 00:00:00 2001 From: nagachika Date: Thu, 16 Oct 2014 13:06:10 +0000 Subject: [PATCH 18/26] merge revision(s) r47645: [Backport #10263] * vm_eval.c (eval_string_with_cref): fix super from eval with scope. set klass in the current control frame to the class of the receiver in the context to be evaluated, this class/module must match the actual receiver to call super. [ruby-core:65122] [Bug #10263] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ test/ruby/test_super.rb | 15 +++++++++++++++ version.h | 2 +- vm_eval.c | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d73611b9be2aa4..d07547843859a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Oct 16 22:06:03 2014 Nobuyoshi Nakada + + * vm_eval.c (eval_string_with_cref): fix super from eval with + scope. set klass in the current control frame to the class of + the receiver in the context to be evaluated, this class/module + must match the actual receiver to call super. + [ruby-core:65122] [Bug #10263] + Thu Oct 16 00:30:30 2014 Tanaka Akira * lib/find.rb (Find.find): Call to_path for arguments to obtain diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index e42782191dbd91..6278e4b88a523d 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -494,4 +494,19 @@ def foo(result) end assert_equal(%w[B A], result, bug9721) end + + def test_from_eval + bug10263 = '[ruby-core:65122] [Bug #10263a]' + a = Class.new do + def foo + "A" + end + end + b = Class.new(a) do + def foo + binding.eval("super") + end + end + assert_equal("A", b.new.foo, bug10263) + end end diff --git a/version.h b/version.h index 8c09c61a656004..07096cb19dea11 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 257 +#define RUBY_PATCHLEVEL 258 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 diff --git a/vm_eval.c b/vm_eval.c index cb0e637942d07a..dc0b05375b77fd 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -1211,7 +1211,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg, absolute_path = file; } - if (scope != Qnil) { + if (!NIL_P(scope)) { bind = Check_TypedStruct(scope, &ruby_binding_data_type); { envval = bind->env; @@ -1261,6 +1261,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg, COPY_CREF(cref, orig_cref); } vm_set_eval_stack(th, iseqval, cref, base_block); + th->cfp->klass = CLASS_OF(base_block->self); RB_GC_GUARD(crefval); if (0) { /* for debug */ From 2d17e3aa204ecd75c939cad6272d770d3522cbb5 Mon Sep 17 00:00:00 2001 From: nagachika Date: Thu, 16 Oct 2014 13:19:07 +0000 Subject: [PATCH 19/26] merge revision(s) r47716: [Backport #10285] * ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO should be writable any encoding strings, without conversion. [ruby-core:65240] [Bug #10285] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/stringio/stringio.c | 5 +++-- test/stringio/test_stringio.rb | 12 ++++++++++++ version.h | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d07547843859a8..7e81db44b6a57b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Oct 16 22:10:11 2014 Nobuyoshi Nakada + + * ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO + should be writable any encoding strings, without conversion. + [ruby-core:65240] [Bug #10285] + Thu Oct 16 22:06:03 2014 Nobuyoshi Nakada * vm_eval.c (eval_string_with_cref): fix super from eval with diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 1a12d298e14a4f..55563c3a69e009 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -1169,12 +1169,13 @@ strio_write(VALUE self, VALUE str) struct StringIO *ptr = writable(self); long len, olen; rb_encoding *enc, *enc2; + rb_encoding *const ascii8bit = rb_ascii8bit_encoding(); if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); enc = rb_enc_get(ptr->string); enc2 = rb_enc_get(str); - if (enc != enc2 && enc != rb_ascii8bit_encoding()) { + if (enc != enc2 && enc != ascii8bit) { str = rb_str_conv_enc(str, enc2, enc); } len = RSTRING_LEN(str); @@ -1185,7 +1186,7 @@ strio_write(VALUE self, VALUE str) ptr->pos = olen; } if (ptr->pos == olen) { - if (enc2 == rb_ascii8bit_encoding()) { + if (enc == ascii8bit || enc2 == ascii8bit) { rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc); OBJ_INFECT(ptr->string, str); } diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 3fbe2f7ecac729..07d89d16e10743 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -137,6 +137,18 @@ def test_write_encoding assert_equal(Encoding::UTF_8, s.encoding, "honor the original encoding over ASCII-8BIT") end + def test_set_encoding + bug10285 = '[ruby-core:65240] [Bug #10285]' + f = StringIO.new() + f.set_encoding(Encoding::ASCII_8BIT) + f.write("quz \x83 mat".b) + s = "foo \x97 bar".force_encoding(Encoding::WINDOWS_1252) + assert_nothing_raised(Encoding::CompatibilityError, bug10285) { + f.write(s) + } + assert_equal(Encoding::ASCII_8BIT, f.string.encoding, bug10285) + end + def test_mode_error f = StringIO.new("", "r") assert_raise(IOError) { f.write("foo") } diff --git a/version.h b/version.h index 07096cb19dea11..eb2fb41212560b 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 258 +#define RUBY_PATCHLEVEL 259 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 From 3ec2fe7a21f3f4a69d6d7cd6dd6739f5d6d8daeb Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 18 Oct 2014 18:21:39 +0000 Subject: [PATCH 20/26] merge revision(s) r47973: [Backport #10392] * parse.y (parser_here_document): do not append already appended and disposed code fragment. [ruby-dev:48647] [Bug #10392] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ parse.y | 5 ++++- test/ripper/test_scanner_events.rb | 4 ++++ version.h | 6 +++--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e81db44b6a57b..edd09d24f54ace 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Oct 19 03:13:38 2014 Nobuyoshi Nakada + + * parse.y (parser_here_document): do not append already appended + and disposed code fragment. [ruby-dev:48647] [Bug #10392] + Thu Oct 16 22:10:11 2014 Nobuyoshi Nakada * ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO diff --git a/parse.y b/parse.y index 37e3cbdcd6e5da..5c62e36d23cfd7 100644 --- a/parse.y +++ b/parse.y @@ -6547,7 +6547,10 @@ parser_here_document(struct parser_params *parser, NODE *here) if (pend < lex_pend) rb_str_cat(str, "\n", 1); lex_goto_eol(parser); if (nextc() == -1) { - if (str) dispose_string(str); + if (str) { + dispose_string(str); + str = 0; + } goto error; } } while (!whole_match_p(eos, len, indent)); diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 2474588f764547..d444bb1042a068 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -708,6 +708,10 @@ def test_tstring_content_HEREDOC assert_equal ["there\n""heredoc", "\n"], scan('tstring_content', "<<""EOS\n""there\n""heredoc\#@foo\nEOS"), bug7255 + bug10392 = '[ruby-dev:48647] [Bug #10392]' + assert_equal [" E\n\n"], + scan('tstring_content', "<<""'E'\n E\n\n"), + bug10392 end def test_heredoc_end diff --git a/version.h b/version.h index eb2fb41212560b..ec4ffa5829c37c 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.4" -#define RUBY_RELEASE_DATE "2014-10-16" -#define RUBY_PATCHLEVEL 259 +#define RUBY_RELEASE_DATE "2014-10-19" +#define RUBY_PATCHLEVEL 260 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 19 #include "ruby/version.h" From 06ce3b73af99e22e9f70f551a24ab41fc18da326 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 18 Oct 2014 18:35:31 +0000 Subject: [PATCH 21/26] merge revision(s) r48000: [Backport #10368] * vm_core.h, vm.c, proc.c: fix GC mark miss on bindings. [ruby-dev:48616] [Bug #10368] * test/ruby/test_eval.rb: add a test code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ proc.c | 36 ++++++++---------------------------- test/ruby/test_eval.rb | 15 +++++++++++++++ version.h | 2 +- vm.c | 37 ++++++++++++++++++++++++++++++++++++- vm_core.h | 3 +++ 6 files changed, 70 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index edd09d24f54ace..af9338fea46b98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Oct 19 03:22:53 2014 Kazuki Tsujimoto + + * vm_core.h, vm.c, proc.c: fix GC mark miss on bindings. + [ruby-dev:48616] [Bug #10368] + + * test/ruby/test_eval.rb: add a test code. + Sun Oct 19 03:13:38 2014 Nobuyoshi Nakada * parse.y (parser_here_document): do not append already appended diff --git a/proc.c b/proc.c index e5b6e5313d905e..66ffa4c0410f27 100644 --- a/proc.c +++ b/proc.c @@ -262,6 +262,7 @@ binding_mark(void *ptr) bind = ptr; RUBY_MARK_UNLESS_NULL(bind->env); RUBY_MARK_UNLESS_NULL(bind->path); + RUBY_MARK_UNLESS_NULL(bind->blockprocval); } RUBY_MARK_LEAVE("binding"); } @@ -282,8 +283,8 @@ const rb_data_type_t ruby_binding_data_type = { NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY }; -static VALUE -binding_alloc(VALUE klass) +VALUE +rb_binding_alloc(VALUE klass) { VALUE obj; rb_binding_t *bind; @@ -295,12 +296,13 @@ binding_alloc(VALUE klass) static VALUE binding_dup(VALUE self) { - VALUE bindval = binding_alloc(rb_cBinding); + VALUE bindval = rb_binding_alloc(rb_cBinding); rb_binding_t *src, *dst; GetBindingPtr(self, src); GetBindingPtr(bindval, dst); dst->env = src->env; dst->path = src->path; + dst->blockprocval = src->blockprocval; dst->first_lineno = src->first_lineno; return bindval; } @@ -317,30 +319,7 @@ binding_clone(VALUE self) VALUE rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp) { - rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp); - rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp); - VALUE bindval, envval; - rb_binding_t *bind; - - if (cfp == 0 || ruby_level_cfp == 0) { - rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber."); - } - - while (1) { - envval = rb_vm_make_env_object(th, cfp); - if (cfp == ruby_level_cfp) { - break; - } - cfp = rb_vm_get_binding_creatable_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)); - } - - bindval = binding_alloc(rb_cBinding); - GetBindingPtr(bindval, bind); - bind->env = envval; - bind->path = ruby_level_cfp->iseq->location.path; - bind->first_lineno = rb_vm_get_sourceline(ruby_level_cfp); - - return bindval; + return rb_vm_make_binding(th, src_cfp); } VALUE @@ -2409,9 +2388,10 @@ proc_binding(VALUE self) } } - bindval = binding_alloc(rb_cBinding); + bindval = rb_binding_alloc(rb_cBinding); GetBindingPtr(bindval, bind); bind->env = proc->envval; + bind->blockprocval = proc->blockprocval; if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) { bind->path = proc->block.iseq->location.path; bind->first_lineno = FIX2INT(rb_iseq_first_lineno(proc->block.iseq->self)); diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 2700aa33f383e9..28d797e2c8b181 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -484,4 +484,19 @@ def test_eval_location_fstring assert_same a, b end + + def test_gced_binding_block + assert_normal_exit %q{ + def m + binding + end + GC.stress = true + b = nil + tap do + b = m {} + end + 0.times.to_a + b.eval('yield') + }, '[Bug #10368]' + end end diff --git a/version.h b/version.h index ec4ffa5829c37c..8c8d4ca7460dff 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-19" -#define RUBY_PATCHLEVEL 260 +#define RUBY_PATCHLEVEL 261 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 diff --git a/vm.c b/vm.c index c82a00e5a234a5..212f7b01401f68 100644 --- a/vm.c +++ b/vm.c @@ -688,6 +688,39 @@ rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass) return procval; } +/* Binding */ + +VALUE +rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp) +{ + rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp); + rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp); + VALUE bindval, envval; + rb_binding_t *bind; + VALUE blockprocval = 0; + + if (cfp == 0 || ruby_level_cfp == 0) { + rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber."); + } + + while (1) { + envval = vm_make_env_object(th, cfp, &blockprocval); + if (cfp == ruby_level_cfp) { + break; + } + cfp = rb_vm_get_binding_creatable_next_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)); + } + + bindval = rb_binding_alloc(rb_cBinding); + GetBindingPtr(bindval, bind); + bind->env = envval; + bind->path = ruby_level_cfp->iseq->location.path; + bind->blockprocval = blockprocval; + bind->first_lineno = rb_vm_get_sourceline(ruby_level_cfp); + + return bindval; +} + VALUE * rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars) { @@ -699,6 +732,7 @@ rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars) NODE *node = 0; ID minibuf[4], *dyns = minibuf; VALUE idtmp = 0; + VALUE blockprocval = 0; if (dyncount < 0) return 0; @@ -719,7 +753,8 @@ rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars) ALLOCV_END(idtmp); vm_set_eval_stack(th, iseqval, 0, base_block); - bind->env = rb_vm_make_env_object(th, th->cfp); + bind->env = vm_make_env_object(th, th->cfp, &blockprocval); + bind->blockprocval = blockprocval; vm_pop_frame(th); GetEnvPtr(bind->env, env); diff --git a/vm_core.h b/vm_core.h index 3b588bdbcc7e95..73127e65eab41d 100644 --- a/vm_core.h +++ b/vm_core.h @@ -726,6 +726,7 @@ extern const rb_data_type_t ruby_binding_data_type; typedef struct { VALUE env; VALUE path; + VALUE blockprocval; /* for GC mark */ unsigned short first_lineno; } rb_binding_t; @@ -842,6 +843,7 @@ rb_block_t *rb_vm_control_frame_block_ptr(rb_control_frame_t *cfp); /* VM related object allocate functions */ VALUE rb_thread_alloc(VALUE klass); VALUE rb_proc_alloc(VALUE klass); +VALUE rb_binding_alloc(VALUE klass); /* for debug */ extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *); @@ -862,6 +864,7 @@ int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp); VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, int argc, const VALUE *argv, const rb_block_t *blockptr); VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass); +VALUE rb_vm_make_binding(rb_thread_t *th, const rb_control_frame_t *src_cfp); VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp); VALUE rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp); VALUE *rb_binding_add_dynavars(rb_binding_t *bind, int dyncount, const ID *dynvars); From 5a58165520d5a429ab69f8d6d952a8ff645452bc Mon Sep 17 00:00:00 2001 From: nagachika Date: Wed, 22 Oct 2014 14:14:52 +0000 Subject: [PATCH 22/26] merge revision(s) r45274,r45278,r45280,r48097: [Backport #9424] [Backport #9640] * lib/openssl/ssl.rb: Explicitly whitelist the default SSL/TLS ciphers. Forbid SSLv2 and SSLv3, disable compression by default. Reported by Jeff Hodges. [ruby-core:59829] [Bug #9424] * test/openssl/test_ssl.rb: Reuse TLS default options from OpenSSL::SSL::SSLContext::DEFAULT_PARAMS. * ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override options even if OpenSSL::SSL::OP_NO_SSLv3 is not defined. this is pointed out by Stephen Touset. [ruby-core:65711] [Bug #9424] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 19 ++++++++++++++ ext/openssl/lib/openssl/ssl.rb | 47 +++++++++++++++++++++++++++++++--- test/openssl/test_ssl.rb | 6 +---- version.h | 6 ++--- 4 files changed, 66 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index af9338fea46b98..721c897a356543 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Wed Oct 22 23:02:49 2014 CHIKANAGA Tomoyuki + + * ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override + options even if OpenSSL::SSL::OP_NO_SSLv3 is not defined. + this is pointed out by Stephen Touset. [ruby-core:65711] [Bug #9424] + +Wed Oct 22 23:02:49 2014 Martin Bosslet + + * test/openssl/test_ssl.rb: Reuse TLS default options from + OpenSSL::SSL::SSLContext::DEFAULT_PARAMS. + +Wed Oct 22 23:02:49 2014 Martin Bosslet + + * lib/openssl/ssl.rb: Explicitly whitelist the default + SSL/TLS ciphers. Forbid SSLv2 and SSLv3, disable + compression by default. + Reported by Jeff Hodges. + [ruby-core:59829] [Bug #9424] + Sun Oct 19 03:22:53 2014 Kazuki Tsujimoto * vm_core.h, vm.c, proc.c: fix GC mark miss on bindings. diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index 86be19054a1606..43025e76220cf1 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -23,10 +23,49 @@ class SSLContext DEFAULT_PARAMS = { :ssl_version => "SSLv23", :verify_mode => OpenSSL::SSL::VERIFY_PEER, - :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW", - :options => defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) ? - OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS : - OpenSSL::SSL::OP_ALL, + :ciphers => %w{ + ECDHE-ECDSA-AES128-GCM-SHA256 + ECDHE-RSA-AES128-GCM-SHA256 + ECDHE-ECDSA-AES256-GCM-SHA384 + ECDHE-RSA-AES256-GCM-SHA384 + DHE-RSA-AES128-GCM-SHA256 + DHE-DSS-AES128-GCM-SHA256 + DHE-RSA-AES256-GCM-SHA384 + DHE-DSS-AES256-GCM-SHA384 + ECDHE-ECDSA-AES128-SHA256 + ECDHE-RSA-AES128-SHA256 + ECDHE-ECDSA-AES128-SHA + ECDHE-RSA-AES128-SHA + ECDHE-ECDSA-AES256-SHA384 + ECDHE-RSA-AES256-SHA384 + ECDHE-ECDSA-AES256-SHA + ECDHE-RSA-AES256-SHA + DHE-RSA-AES128-SHA256 + DHE-RSA-AES256-SHA256 + DHE-RSA-AES128-SHA + DHE-RSA-AES256-SHA + DHE-DSS-AES128-SHA256 + DHE-DSS-AES256-SHA256 + DHE-DSS-AES128-SHA + DHE-DSS-AES256-SHA + AES128-GCM-SHA256 + AES256-GCM-SHA384 + AES128-SHA256 + AES256-SHA256 + AES128-SHA + AES256-SHA + ECDHE-ECDSA-RC4-SHA + ECDHE-RSA-RC4-SHA + RC4-SHA + }.join(":"), + :options => -> { + opts = OpenSSL::SSL::OP_ALL + opts &= ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS if defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) + opts |= OpenSSL::SSL::OP_NO_COMPRESSION if defined?(OpenSSL::SSL::OP_NO_COMPRESSION) + opts |= OpenSSL::SSL::OP_NO_SSLv2 if defined?(OpenSSL::SSL::OP_NO_SSLv2) + opts |= OpenSSL::SSL::OP_NO_SSLv3 if defined?(OpenSSL::SSL::OP_NO_SSLv3) + opts + }.call } DEFAULT_CERT_STORE = OpenSSL::X509::Store.new diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index a13f0e1a9c49a7..b743819518f7b5 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -4,10 +4,6 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase - TLS_DEFAULT_OPS = defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) ? - OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS : - OpenSSL::SSL::OP_ALL - def test_ctx_setup ctx = OpenSSL::SSL::SSLContext.new assert_equal(ctx.setup, true) @@ -276,7 +272,7 @@ def test_sslctx_set_params ctx = OpenSSL::SSL::SSLContext.new ctx.set_params assert_equal(OpenSSL::SSL::VERIFY_PEER, ctx.verify_mode) - assert_equal(TLS_DEFAULT_OPS, ctx.options) + assert_equal(OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options], ctx.options) ciphers = ctx.ciphers ciphers_versions = ciphers.collect{|_, v, _, _| v } ciphers_names = ciphers.collect{|v, _, _, _| v } diff --git a/version.h b/version.h index 8c8d4ca7460dff..0edb9dc42a0386 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.4" -#define RUBY_RELEASE_DATE "2014-10-19" -#define RUBY_PATCHLEVEL 261 +#define RUBY_RELEASE_DATE "2014-10-22" +#define RUBY_PATCHLEVEL 262 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 19 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" From a7a045f1f049cf4252a0b855c738dbff6968375a Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 25 Oct 2014 18:29:00 +0000 Subject: [PATCH 23/26] merge revision(s) r48102: [Backport #10413] * class.c (unknown_keyword_error): delete expected keywords directly from raw table, so that the given block is not called. [ruby-core:65837] [Bug #10413] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ class.c | 4 +++- test/ruby/test_keyword.rb | 15 +++++++++++++++ version.h | 6 +++--- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 721c897a356543..e10d55e624f768 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada + + * class.c (unknown_keyword_error): delete expected keywords + directly from raw table, so that the given block is not called. + [ruby-core:65837] [Bug #10413] + Wed Oct 22 23:02:49 2014 CHIKANAGA Tomoyuki * ext/openssl/lib/openssl/ssl.rb (DEFAULT_PARAMS): override diff --git a/class.c b/class.c index de5323a69b2472..8f11f45b535c65 100644 --- a/class.c +++ b/class.c @@ -1876,10 +1876,12 @@ NORETURN(static void unknown_keyword_error(VALUE hash, const ID *table, int keyw static void unknown_keyword_error(VALUE hash, const ID *table, int keywords) { + st_table *tbl = rb_hash_tbl_raw(hash); VALUE keys; int i; for (i = 0; i < keywords; i++) { - rb_hash_delete(hash, ID2SYM(table[i])); + st_data_t key = ID2SYM(table[i]); + st_delete(tbl, &key, NULL); } keys = rb_funcall(hash, rb_intern("keys"), 0, 0); if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword"); diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index e7bd11b18b0beb..13bac278f2e3f2 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -505,4 +505,19 @@ def m(a: []) tap { prc.call } }, bug8964 end + + def test_unknown_keyword_with_block + bug10413 = '[ruby-core:65837] [Bug #10413]' + class << (o = Object.new) + def bar(k2: 'v2') + end + + def foo + bar(k1: 1) + end + end + assert_raise_with_message(ArgumentError, /unknown keyword: k1/, bug10413) { + o.foo {raise "unreachable"} + } + end end diff --git a/version.h b/version.h index 0edb9dc42a0386..9c6d9abedebd1b 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.1.4" -#define RUBY_RELEASE_DATE "2014-10-22" -#define RUBY_PATCHLEVEL 262 +#define RUBY_RELEASE_DATE "2014-10-26" +#define RUBY_PATCHLEVEL 263 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 22 +#define RUBY_RELEASE_DAY 26 #include "ruby/version.h" From d841eef772c58ce42c37c9624fe23b0445dfa50e Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 25 Oct 2014 18:42:44 +0000 Subject: [PATCH 24/26] merge revision(s) r48111,r48118,r48120: [Backport #10421] * vm_method.c (rb_method_entry_make): warn redefinition only for already defined methods, but not for undefined methods. [ruby-dev:48691] [Bug #10421] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ test/ruby/test_object.rb | 9 +++++++++ version.h | 2 +- vm_method.c | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e10d55e624f768..ba03421dea746c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Oct 26 03:31:46 2014 Nobuyoshi Nakada + + * vm_method.c (rb_method_entry_make): warn redefinition only for + already defined methods, but not for undefined methods. + [ruby-dev:48691] [Bug #10421] + Sun Oct 26 03:21:30 2014 Nobuyoshi Nakada * class.c (unknown_keyword_error): delete expected keywords diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index e8ab6135c480ac..596bddf1e59ce0 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -298,6 +298,15 @@ def (Object.new).object_id; end $VERBOSE = false def (Object.new).__send__; end INPUT + + bug10421 = '[ruby-dev:48691] [Bug #10421]' + assert_in_out_err([], <<-INPUT, ["1"], [], bug10421) + $VERBOSE = false + class C < BasicObject + def object_id; 1; end + end + puts C.new.object_id + INPUT end def test_remove_method diff --git a/version.h b/version.h index 9c6d9abedebd1b..b6f5a953ef85e9 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.4" #define RUBY_RELEASE_DATE "2014-10-26" -#define RUBY_PATCHLEVEL 263 +#define RUBY_PATCHLEVEL 264 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 10 diff --git a/vm_method.c b/vm_method.c index a5fe4ba0a3bcf1..2270359029f756 100644 --- a/vm_method.c +++ b/vm_method.c @@ -181,6 +181,7 @@ rb_free_method_entry(rb_method_entry_t *me) xfree(me); } +static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr); static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); static inline rb_method_entry_t * @@ -355,7 +356,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type, } /* check mid */ if (mid == object_id || mid == id__send__) { - if (type == VM_METHOD_TYPE_ISEQ) { + if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) { rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid)); } } From 31d25ce5037909f85af54d8ad197933cf0a6b635 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 27 Oct 2014 11:23:17 +0000 Subject: [PATCH 25/26] merge revision(s) r48161: * lib/rexml/entity.rb: keep the entity size within the limitation. reported by Willis Vandevanter and patched by nahi. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@48163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/rexml/entity.rb | 6 ++++++ test/rexml/test_document.rb | 27 +++++++++++++++++++++++++++ test/rexml/test_entity.rb | 16 ++++++++++++++++ version.h | 6 +++--- 5 files changed, 58 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba03421dea746c..19dbbd025e014c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Oct 27 20:20:14 2014 NAKAMURA Usaku + + * lib/rexml/entity.rb: keep the entity size within the limitation. + reported by Willis Vandevanter and + patched by nahi. + Sun Oct 26 03:31:46 2014 Nobuyoshi Nakada * vm_method.c (rb_method_entry_make): warn redefinition only for diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb index 39f3900075d00a..f447202394db2d 100644 --- a/lib/rexml/entity.rb +++ b/lib/rexml/entity.rb @@ -138,8 +138,14 @@ def value matches = @value.scan(PEREFERENCE_RE) rv = @value.clone if @parent + sum = 0 matches.each do |entity_reference| entity_value = @parent.entity( entity_reference[0] ) + if sum + entity_value.bytesize > Security.entity_expansion_text_limit + raise "entity expansion has grown too large" + else + sum += entity_value.bytesize + end rv.gsub!( /%#{entity_reference.join};/um, entity_value ) end end diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb index cec9452373882b..efdcf66b82eda2 100644 --- a/test/rexml/test_document.rb +++ b/test/rexml/test_document.rb @@ -45,6 +45,20 @@ def test_new &a; +EOF + + XML_WITH_NESTED_PARAMETER_ENTITY = < + + + + + + + +]> + EOF XML_WITH_4_ENTITY_EXPANSION = <