From a590770d279e2357d5bedfe49a04016b5f6feb57 Mon Sep 17 00:00:00 2001 From: zyppe <210hcl@gmail.com> Date: Thu, 29 Feb 2024 14:29:47 +0800 Subject: [PATCH] Initialize for ruby2.5 --- .gitignore | 1 + .ruby2.5.metadata | 1 + did_you_mean-1.2.0.gem | Bin 0 -> 20992 bytes remove-unneeded-files.patch | 13 + ruby2.5-default.macros | 7 + ruby2.5-rpmlintrc | 2 + ruby2.5.changes | 326 +++ ruby2.5.macros | 16 + ruby2.5.spec | 456 +++++ series | 11 + suse.patch | 3844 +++++++++++++++++++++++++++++++++++ 11 files changed, 4677 insertions(+) create mode 100644 .gitignore create mode 100644 .ruby2.5.metadata create mode 100644 did_you_mean-1.2.0.gem create mode 100644 remove-unneeded-files.patch create mode 100644 ruby2.5-default.macros create mode 100644 ruby2.5-rpmlintrc create mode 100644 ruby2.5.changes create mode 100644 ruby2.5.macros create mode 100644 ruby2.5.spec create mode 100644 series create mode 100644 suse.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b5d2d1f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ruby-2.5.9.tar.xz diff --git a/.ruby2.5.metadata b/.ruby2.5.metadata new file mode 100644 index 0000000..8eb3fd9 --- /dev/null +++ b/.ruby2.5.metadata @@ -0,0 +1 @@ +ddaa9e107b816140e45e896b081f5b8a886f7fef415d0b52798c937814e08dff ruby-2.5.9.tar.xz diff --git a/did_you_mean-1.2.0.gem b/did_you_mean-1.2.0.gem new file mode 100644 index 0000000000000000000000000000000000000000..d26553bdf620382bfdda3fb9e905fa0d36d3b922 GIT binary patch literal 20992 zcmeEtQ;;q|u-@9X_pEK(wr$(?p0#az&)T+aoV9KH&$-D%Quig5RHc%K^vlfDpt`H8 zzV7L7#?H*u$kfQyh~B~*=>L>3{u5SKR-pfA|H*%DnK+m^fS6d=nb?>(nAka3fEbxr zSlKv$elh-^Qs{p?*UiP%$oZd29+qZiw*TYAf9n6w=Kq^*|J}I%wEh3pAz?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>ni;Eal0Oa8UT_OJU^tCmCGM!exs62S(w&#^dz;(E&24Dj(^gUK zO79DYQ-Ps?0lsG9tMIaSag=$e&&Ir@jvaB(|B>y@%IP__VB)qB94g0&mWwDX^_x%f zTPq8I1NX#K4`cl6+AI5#1eeH=mYcd~%5fE$;+?^SUqsCnk?5_KnctbsCH=$aA~d%y{vv2P7)$RgJtR=l7Icuw z`jk+Mjvbp-u0{?s_>!=(`*i}Z4L^Cjm=R7VlBepKPU!;W9IwDn)YNb~Hla+mIB=|{ zjNGKNy+!rZ^BX|sK4KL@RYkXkk;@RFfLm%N^hvVf{t#0#WH{_X5Tlk)kITctQ+GI} zL@DMVchq0znI%?7mGfa6}=!=zP(AO@k^cPzrx>(AA)LNULj! zkWtvYh#<-B2styDK`#S>_nr=I_qG~pO?uCcyp2euzlz;Nw>0jutV5H9Eg8*2vrh%l zSHN8Zx_2EB^8LPx-&q?p1|L~nOQ_2~Qg-x@nv#SmFT2HY%a%Lr-KM!;Rrk0yuN%#h zc+-k(Kh#;BA>D9NH$M=(erTER6rGynixL8SzKt>^cedZuVnhzrc6kqWK&E-0*@@U{ zPR?cZ_qLCYI23>MW;;b6-O=Mp@$hiD{5)m|?-HIU-fuHNc=}*G{X)X-g+LC7qPcwvXiMb)f1fX=`hUgB=_k&nD#J_g)v{XGqA^JJo61Uc0_Q7+2tU ztBNa3*!}bOwyr|sHlX@U*r)__Er~tX(Shq_ow`3YZSue&D0=3}jyXbytd`;|E;V&Q zY>+=Axu&fL{%|yr8yT6JYyZRh!SiqIW$&m`0MQe*i7t&L(kttl+3gxRY@F4~CG8@G zn7amOL8}!2kIloqH*s=)#t_~ftmvTU8wA|4p*Y2 Y(%3ha>#s#|Jbg^yn7}cCzm>qh00{--W&i*H literal 0 HcmV?d00001 diff --git a/remove-unneeded-files.patch b/remove-unneeded-files.patch new file mode 100644 index 0000000..6c1f788 --- /dev/null +++ b/remove-unneeded-files.patch @@ -0,0 +1,13 @@ +Index: ruby-2.5.7/gems/did_you_mean-1.2.0/did_you_mean.gemspec +=================================================================== +--- ruby-2.5.7.orig/gems/did_you_mean-1.2.0/did_you_mean.gemspec ++++ ruby-2.5.7/gems/did_you_mean-1.2.0/did_you_mean.gemspec +@@ -11,7 +11,7 @@ Gem::Specification.new do |s| + s.date = "2017-12-13" + s.description = "The gem that has been saving people from typos since 2014.".freeze + s.email = ["mail@yukinishijima.net".freeze] +- s.files = [".gitignore".freeze, ".ruby-version".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "benchmark/jaro_winkler/memory_usage.rb".freeze, "benchmark/jaro_winkler/speed.rb".freeze, "benchmark/levenshtein/memory_usage.rb".freeze, "benchmark/levenshtein/speed.rb".freeze, "benchmark/memory_usage.rb".freeze, "did_you_mean.gemspec".freeze, "doc/CHANGELOG.md.erb".freeze, "doc/changelog_generator.rb".freeze, "evaluation/calculator.rb".freeze, "evaluation/dictionary_generator.rb".freeze, "evaluation/incorrect_words.yaml".freeze, "lib/did_you_mean.rb".freeze, "lib/did_you_mean/core_ext/name_error.rb".freeze, "lib/did_you_mean/experimental.rb".freeze, "lib/did_you_mean/experimental/initializer_name_correction.rb".freeze, "lib/did_you_mean/experimental/ivar_name_correction.rb".freeze, "lib/did_you_mean/formatters/plain_formatter.rb".freeze, "lib/did_you_mean/formatters/verbose_formatter.rb".freeze, "lib/did_you_mean/jaro_winkler.rb".freeze, "lib/did_you_mean/levenshtein.rb".freeze, "lib/did_you_mean/spell_checker.rb".freeze, "lib/did_you_mean/spell_checkers/key_error_checker.rb".freeze, "lib/did_you_mean/spell_checkers/method_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/null_checker.rb".freeze, "lib/did_you_mean/verbose.rb".freeze, "lib/did_you_mean/verbose_formatter.rb".freeze, "lib/did_you_mean/version.rb".freeze, "test/core_ext/name_error_extension_test.rb".freeze, "test/edit_distance/jaro_winkler_test.rb".freeze, "test/experimental/initializer_name_correction_test.rb".freeze, "test/experimental/method_name_checker_test.rb".freeze, "test/spell_checker_test.rb".freeze, "test/spell_checking/class_name_check_test.rb".freeze, "test/spell_checking/key_name_check_test.rb".freeze, "test/spell_checking/method_name_check_test.rb".freeze, "test/spell_checking/uncorrectable_name_check_test.rb".freeze, "test/spell_checking/variable_name_check_test.rb".freeze, "test/test_helper.rb".freeze, "test/verbose_formatter_test.rb".freeze] ++ s.files = [".gitignore".freeze, ".ruby-version".freeze, ".travis.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "benchmark/jaro_winkler/memory_usage.rb".freeze, "benchmark/jaro_winkler/speed.rb".freeze, "benchmark/levenshtein/memory_usage.rb".freeze, "benchmark/levenshtein/speed.rb".freeze, "benchmark/memory_usage.rb".freeze, "did_you_mean.gemspec".freeze, "doc/CHANGELOG.md.erb".freeze, "doc/changelog_generator.rb".freeze, "evaluation/calculator.rb".freeze, "evaluation/dictionary_generator.rb".freeze, "evaluation/incorrect_words.yaml".freeze, "lib/did_you_mean.rb".freeze, "lib/did_you_mean/core_ext/name_error.rb".freeze, "lib/did_you_mean/experimental.rb".freeze, "lib/did_you_mean/experimental/initializer_name_correction.rb".freeze, "lib/did_you_mean/experimental/ivar_name_correction.rb".freeze, "lib/did_you_mean/formatters/plain_formatter.rb".freeze, "lib/did_you_mean/formatters/verbose_formatter.rb".freeze, "lib/did_you_mean/jaro_winkler.rb".freeze, "lib/did_you_mean/levenshtein.rb".freeze, "lib/did_you_mean/spell_checker.rb".freeze, "lib/did_you_mean/spell_checkers/key_error_checker.rb".freeze, "lib/did_you_mean/spell_checkers/method_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb".freeze, "lib/did_you_mean/spell_checkers/null_checker.rb".freeze, "lib/did_you_mean/verbose.rb".freeze, "lib/did_you_mean/verbose_formatter.rb".freeze, "lib/did_you_mean/version.rb".freeze, "test/core_ext/name_error_extension_test.rb".freeze, "test/edit_distance/jaro_winkler_test.rb".freeze, "test/experimental/initializer_name_correction_test.rb".freeze, "test/experimental/method_name_checker_test.rb".freeze, "test/spell_checker_test.rb".freeze, "test/spell_checking/class_name_check_test.rb".freeze, "test/spell_checking/key_name_check_test.rb".freeze, "test/spell_checking/method_name_check_test.rb".freeze, "test/spell_checking/uncorrectable_name_check_test.rb".freeze, "test/spell_checking/variable_name_check_test.rb".freeze, "test/test_helper.rb".freeze, "test/verbose_formatter_test.rb".freeze].reject{|path| path.start_with?('evaluation/') } + s.homepage = "https://github.com/yuki24/did_you_mean".freeze + s.licenses = ["MIT".freeze] + s.required_ruby_version = Gem::Requirement.new(">= 2.5.0dev".freeze) diff --git a/ruby2.5-default.macros b/ruby2.5-default.macros new file mode 100644 index 0000000..e729e49 --- /dev/null +++ b/ruby2.5-default.macros @@ -0,0 +1,7 @@ +%rb_default_ruby_suffix ruby2.5 + +%rb_default_ruby ruby25 +%rb_default_ruby_abi ruby:2.5.0 + +%rb_build_versions %rb_default_ruby +%rb_build_ruby_abis %rb_default_ruby_abi diff --git a/ruby2.5-rpmlintrc b/ruby2.5-rpmlintrc new file mode 100644 index 0000000..045f9b7 --- /dev/null +++ b/ruby2.5-rpmlintrc @@ -0,0 +1,2 @@ +addFilter("files-duplicate /usr/share/ri/.*") +addFilter("unexpanded-macro /usr/share/ri/.*") diff --git a/ruby2.5.changes b/ruby2.5.changes new file mode 100644 index 0000000..d4052e0 --- /dev/null +++ b/ruby2.5.changes @@ -0,0 +1,326 @@ +* Fri Oct 20 2023 mrueckert@suse.de +- update suse.patch to 531fb8b2cc + - fix quadratic behavior in the uri parser (boo#1209891 + CVE-2023-28755) + - fix expensive regexp in the RFC2822 time parser (boo#1209967 + CVE-2023-28756) + - backport date 2.0.3 (boo#1193035 CVE-2021-41817) + - merge CGI 0.1.0.2: (boo#1205726 CVE-2021-33621) + - When parsing cookies, only decode the values + - HTTP response splitting in CGI +* Mon Sep 5 2022 mrueckert@suse.de +- Update suse.patch to 41adc98ad1: + - Cookie Prefix Spoofing in CGI::Cookie.parse (boo#1193081 CVE-2021-41819) +- add back some lost chunks to the suse.patch +* Wed Apr 20 2022 mrueckert@suse.de +- Update suse.patch: + - backport fix for CVE-2022-28739: ruby: Buffer overrun in + String-to-Float conversion (boo#1198441) + - back port date 2.0.3 CVE-2021-41817 (boo#1193035) + - merge the previous bug fixes into suse.patch + - CVE-2021-32066.patch + - CVE-2021-31810.patch + - CVE-2021-31799.patch +* Wed Apr 20 2022 mrueckert@suse.de +- Add Requires to make and gcc to ruby-devel to make the default + extconf.rb work +* Thu Nov 11 2021 ali.abdallah@suse.com + Add patches to fix the following CVE's: + - CVE-2021-32066.patch (CVE-2021-32066): Fix StartTLS stripping + vulnerability in Net:IMAP (bsc#1188160) + - CVE-2021-31810.patch (CVE-2021-31810): Fix trusting FTP PASV + responses vulnerability in Net:FTP (bsc#1188161) + - CVE-2021-31799.patch (CVE-2021-31799): Fix Command injection + vulnerability in RDoc (bsc#1190375) +* Tue Apr 13 2021 mrueckert@suse.de +- Update to 2.5.9 (boo#1184644) + https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-5-9-released/ + - CVE-2020-25613: Potential HTTP Request Smuggling Vulnerability + in WEBrick + - CVE-2021-28965: XML round-trip vulnerability in REXML + Complete list of changes at + https://github.com/ruby/ruby/compare/v2_5_8...v2_5_9 +- Update suse.patch: + Remove fix for CVE-2020-25613 as it is included in the update +* Mon Mar 15 2021 mrueckert@suse.de +- Update suse.patch: (boo#1177125) + Backport fix CVE-2020-25613: Potential HTTP Request Smuggling + Vulnerability in WEBrick +* Fri Oct 16 2020 mrueckert@suse.de +- replace all patches with suse.patch (v2_5_8..2.5-suse) + (we keep remove-unneeded-files.patch as it can not be done in our + backports branch) +- backport patch to enable optimizations also on ARM64 + (boo#1177222) +* Tue Apr 28 2020 mrueckert@suse.de +- make sure that update-alternative weight for the default + distribution is always greater than our normal weight +* Tue Apr 28 2020 mrueckert@suse.de +- make the update-alternative weight based on the ruby version +* Tue Apr 7 2020 mrueckert@suse.de +- Update to 2.5.8 (boo#1167244 boo#1168938) + - CVE-2020-10663: Unsafe Object Creation Vulnerability in JSON + (Additional fix) + - CVE-2020-10933: Heap exposure vulnerability in the socket + library + https://github.com/ruby/ruby/compare/v2_5_7...v2_5_8 +- drop CVE-2020-8130.patch and rake-12.3.0.gem: included upstream +* Fri Mar 6 2020 mrueckert@suse.de +- Fix CVE-2020-8130 (boo# 1164804) for the intree copy of rake: + - add CVE-2020-8130.patch and rake-12.3.0.gem +* Thu Feb 6 2020 mrueckert@suse.de +- remove test files which are not needed at runtime (boo#1162396) + - adds remove-unneeded-files.patch and did_you_mean-1.2.0.gem +* Tue Oct 8 2019 mrueckert@suse.de +- update to 2.5.7 + - https://www.ruby-lang.org/en/news/2019/10/01/ruby-2-5-7-released/ + - CVE-2019-16255: A code injection vulnerability of Shell#[] + and Shell#test (boo#1152990) + - CVE-2019-16254: HTTP response splitting in WEBrick + (Additional fix) (boo#1152992) + - CVE-2019-15845: A NUL injection vulnerability of File.fnmatch + and File.fnmatch? (boo#1152994) + - CVE-2019-16201: Regular Expression Denial of Service + vulnerability of WEBrick’s Digest access authentication + (boo#1152995) + - https://www.ruby-lang.org/en/news/2019/08/28/ruby-2-5-6-released/ + - Multiple jQuery vulnerabilities in RDoc (CVE-2012-6708 + CVE-2015-9251) +* Tue Jul 9 2019 mrueckert@suse.de +- fix running tests (boo#1140844) + just passing the DISABLED_TESTS variable is wrong. probably a + relict from calling the test scripts directly. use TESTOPTS now. +* Thu Jun 13 2019 mrueckert@suse.de +- refreshed patches with new patch series: + 0001-make-gem-build-reproducible.patch + 0002-gc.c-tick-for-POWER-arch.patch + 0003-Mark-Gemspec-reproducible-change-fixing-784225-too.patch + 0004-Make-gemspecs-reproducible.patch +- rename patch now that it is generated from git: + old: 450160263aed8c446ce5b142d71f921ab4118f3a.patch + new: 0005-Include-the-alternative-malloc-header-instead-of-mal.patch + old: use-pie.patch + new: 0006-Use-PIE-for-the-binaries.patch +- ruby: change over of the Japanese Era to the new emperor May + 1st 2019 (boo#1133790) + 0007-date-support-for-Reiwa-new-Japanese-era.patch +* Wed Mar 27 2019 mrueckert@suse.de +- for some reason the --enable-pie option does not work as + expected. Fix this for now with a patch that just injects the + - pie flag in the Makefile (adds use-pie.patch) (boo#1130028) +* Fri Mar 15 2019 mrueckert@suse.de +- update to 2.5.5 + https://www.ruby-lang.org/en/news/2019/03/13/ruby-2-5-4-released/ + - CVE-2019-8320: Delete directory using symlink when + decompressing tar (boo#1130627) + - CVE-2019-8321: Escape sequence injection vulnerability in + verbose (boo#1130623) + - CVE-2019-8322: Escape sequence injection vulnerability in gem + owner (boo#1130622) + - CVE-2019-8323: Escape sequence injection vulnerability in API + response handling (boo#1130620) + - CVE-2019-8324: Installing a malicious gem may lead to arbitrary + code execution (boo#1130617) + - CVE-2019-8325: Escape sequence injection vulnerability in + errors (boo#1130611) + https://www.ruby-lang.org/en/news/2019/03/15/ruby-2-5-5-released/ +* Thu Feb 7 2019 mrueckert@suse.de +- replace the awk based provides generation with the new file-attr + handler in ruby-bundled-gems-rpmhelper + This kills one provides rubygem-name = version + But this should not have be used since a while anymore. +- add option to build without docs for testing +- provide support to undo the split of the stdlib: + pass --without=separate_stdlib to "osc build" +* Fri Nov 23 2018 mliska@suse.cz +- Use parallel make. +* Thu Nov 22 2018 mliska@suse.cz +- Disable compressed sections as they are not supported by rpm + (https://bugs.ruby-lang.org/issues/12934). +* Wed Nov 7 2018 mrueckert@suse.de +- update to 2.5.3 + This release includes some bug fixes and some security fixes. + - CVE-2018-16396: Tainted flags are not propagated in Array#pack + and String#unpack with some directives (boo#1112532) + - CVE-2018-16395: OpenSSL::X509::Name equality check does not + work correctly (boo#1112530) + https://github.com/ruby/ruby/compare/v2_5_1...v2_5_3 +- drop frozen-pop3.patch +* Tue Oct 16 2018 mrueckert@suse.de +- backport 450160263aed8c446ce5b142d71f921ab4118f3a.patch: + Include the alternative malloc header instead of malloc.h +* Tue Aug 28 2018 mrueckert@suse.de +- update to 2.5.1 + This release includes some bug fixes and some security fixes. + - CVE-2017-17742: HTTP response splitting in WEBrick + (boo#1087434) + - CVE-2018-6914: Unintentional file and directory creation with + directory traversal in tempfile and tmpdir (boo#1087441) + - CVE-2018-8777: DoS by large request in WEBrick (boo#1087436) + - CVE-2018-8778: Buffer under-read in String#unpack (boo#1087433) + - CVE-2018-8779: Unintentional socket creation by poisoned NUL + byte in UNIXServer and UNIXSocket (boo#1087440) + - CVE-2018-8780: Unintentional directory traversal by poisoned + NUL byte in Dir (boo#1087437) + - Multiple vulnerabilities in RubyGems + CVE-2018-1000079 (boo#1082058) + CVE-2018-1000075 (boo#1082014) + CVE-2018-1000078 (boo#1082011) + CVE-2018-1000077 (boo#1082010) + CVE-2018-1000076 (boo#1082009) + CVE-2018-1000074 (boo#1082008) + CVE-2018-1000073 (boo#1082007) + https://github.com/ruby/ruby/compare/v2_5_0...v2_5_1 +* Tue Aug 28 2018 mrueckert@suse.de +- added frozen-pop3.patch: + Net::POPMail methods modify frozen literal when using default arg + https://redmine.ruby-lang.org/issues/14416 +* Thu Mar 22 2018 mrueckert@suse.de +- wrong files where installed from the macro files after adding + dump-version.rb +* Thu Jan 25 2018 mrueckert@suse.de +- fix dump-versions.rb: it was picking up system rdoc versions on + some source dirs +* Mon Jan 15 2018 mrueckert@suse.de +- add reproducible build patches from debian + 0003-Mark-Gemspec-reproducible-change-fixing-784225-too.patch + 0004-Make-gemspecs-reproducible.patch +* Mon Dec 25 2017 mrueckert@suse.de +- drop 316f58076d29dcff053256992d9ec19fed7e698f.patch +- no longer bundling bundler +* Mon Dec 25 2017 mrueckert@suse.de +- update to 2.5.0 final + Ruby 2.5.0 is the first stable release of the Ruby 2.5 series. It + introduces many new features and performance improvements. The + notable changes are as follows: + - New Features + - rescue/else/ensure are now allowed to be used directly with + do/end blocks. [Feature #12906] + - Add yield_self to yield given block in its context. Unlike + tap, it returns the result of the block. [Feature #6721] + - Support branch coverage and method coverage measurement. The + branch coverage indicates which branches are executed and + which are not. The method coverage indicates which methods + are invoked and which are not. By running the test suite with + these new features, you will know which branches and methods + are executed, and evaluate total coverage of the test suite + more strictly. [Feature #13901] + - Hash#slice [Feature #8499] and Hash#transform_keys [Feature + [#13583]] + - Struct.new can create classes that accept keyword arguments. + [Feature #11925] + - Enumerable#any?,all?,none? and one? accept a pattern argument + [Feature #11286] + - Top-level constant look-up is no longer available. [Feature + [#11547]] + - One of our most loved libraries, pp.rb, is now automatically + loaded. You no longer have to write require "pp". [Feature + [#14123]] + - Print backtrace and error message in reverse order (oldest + call first, most recent call last). When a long backtrace + appears on your terminal (TTY), you can easily find the cause + line at the bottom of the backtrace. Note that the order is + reversed only when backtrace is printed out to the terminal + directly. [Feature #8661] [experimental] + - Performance improvements + - About 5-10%% performance improvement by removing all trace + instructions from overall bytecode (instruction sequences). + The trace instruction was added to support the TracePoint. + However, in most cases, TracePoint is not used and trace + instructions are pure overhead. Instead, now we use a dynamic + instrumentation technique. See [Feature #14104] for more + details. + - Block passing by a block parameter (e.g. def foo(&b); + bar(&b); end) is about 3 times faster than Ruby 2.4 by “Lazy + Proc allocation” technique. [Feature #14045] + - Mutex is rewritten to be smaller and faster. [Feature #13517] + - ERB now generates code from a template which runs twice as + fast as Ruby 2.4. + - Improve performance of some built-in methods including + Array#concat, Enumerable#sort_by, String#concat, + String#index, Time#+ and more. + - IO.copy_stream uses copy_file_range(2) to copy offload + [Feature #13867] + - Other notable changes since 2.4 + - SecureRandom now prefers OS-provided sources over OpenSSL. + [Bug #9569] + - Promote cmath, csv, date, dbm, etc, fcntl, fiddle, fileutils, + gdbm, ipaddr, scanf, sdbm, stringio, strscan, webrick, zlib + from standard libraries to default gems. + - Update to Onigmo 6.1.3. + - It adds the absence operator. + - Note that Ruby 2.4.1 also includes this change. + - Update to Psych 3.0.2. + - Update to RubyGems 2.7.3. + - Update to RDoc 6.0.1. + - Switch the lexer from IRB based one to Ripper. This + dramatically improves the performance of document + generation. + - Fix a significant amount of bugs that existed over ten + years. + - Add support for new Ruby syntax from the latest versions. + - Update supported Unicode version to 10.0.0. + - Thread.report_on_exception is now set to true by default. + This change helps debugging of multi-threaded programs. + [Feature #14143] + - IO#write now receives multiple arguments [Feature #9323] For + details see: https://github.com/ruby/ruby/blob/v2_5_0/NEWS + https://github.com/ruby/ruby/compare/v2_4_0...v2_5_0 +* Tue Dec 19 2017 mrueckert@suse.de +- switch to https urls +* Mon Dec 18 2017 mrueckert@suse.de +- update to 2.5.0~rc1 + https://www.ruby-lang.org/en/news/2017/12/14/ruby-2-5-0-rc1-released/ +- added 316f58076d29dcff053256992d9ec19fed7e698f.patch + to fix building rbtrace and ruby-prof +* Mon Nov 20 2017 mrueckert@suse.de +- disable jemalloc again because of: (boo#1068883) + https://github.com/jemalloc/jemalloc/issues/937 +* Fri Nov 17 2017 mrueckert@suse.de +- update to 60813 + see installed /usr/share/doc/packages/ruby2.5/ChangeLog +* Wed Nov 15 2017 mrueckert@suse.de +- update to 60739 + see installed /usr/share/doc/packages/ruby2.5/ChangeLog +* Wed Nov 15 2017 mrueckert@suse.de +- make the whole u-a handling less error prone by having the list + in variable ua-binaries +* Thu Nov 9 2017 jdelvare@suse.de +- Add conflicts to libruby to make sure ruby and ruby-stdlib are + also updated when libruby is updated (bsc#1048072.) +* Thu Nov 9 2017 mrueckert@suse.de +- exclude all testsuites for the stdlib gems +* Wed Nov 8 2017 mrueckert@suse.de +- build jemalloc +* Tue Oct 31 2017 mrueckert@suse.de +- update to 60568 + see installed /usr/share/doc/packages/ruby2.5/ChangeLog + - this fixes the "ruby -rubygems" on 2.5 +* Wed Oct 4 2017 mrueckert@suse.de +- update intree gem list +- bundler is now part of core too! +* Wed Oct 4 2017 mrueckert@suse.de +- update to r60035: + see installed /usr/share/doc/packages/ruby2.5/ChangeLog +- revert some of the wrong Group changes +- drop autoreconf -fi and the buildrequires for the related + packages +* Fri Sep 22 2017 mrueckert@suse.de +- make it easier to sync the versions from the gemspec with the + spec file: + ruby dump-versions.rb $unpacked_tarball_dir +* Fri Sep 22 2017 mrueckert@suse.de +- add conflicts for all intree gems +* Mon Sep 11 2017 jengelh@inai.de +- Fix RPM groups. Replace old RPM macros by modern ones. +- Ensure neutrality of descriptions. +* Fri Sep 8 2017 mrueckert@suse.de +- update to 59623 +* Wed Aug 9 2017 mrueckert@suse.de +- fix gem provides +- install macro files with 2.5 version +* Wed Aug 9 2017 mrueckert@suse.de +- initial package (Fate#324013) +- port 2 patches we still need from the 2.4 package: + 0001-make-gem-build-reproducible.patch + 0002-gc.c-tick-for-POWER-arch.patch diff --git a/ruby2.5.macros b/ruby2.5.macros new file mode 100644 index 0000000..f9439c2 --- /dev/null +++ b/ruby2.5.macros @@ -0,0 +1,16 @@ +# +# IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT +# +# if you change any macros here you have to update the copy in the +# prjconf aswell. +# +# IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT +# +%rubygemsruby25() rubygem(ruby:2.5.0:%{expand:%%rubygemsx%*} %{expand:%%{rubygems%*}} +%rubygemsxruby25() %{expand:%%{rubygemsx%*}} + +%rubyruby25() ruby2.5 %{expand:%%rubyx%*} %{expand:%%{ruby%*}} +%rubyxruby25() %{expand:%%{rubyx%*}} + +%rubydevelruby25() ruby2.5-devel %{expand:%%rubydevelx%*} %{expand:%%{rubydevel%*}} +%rubydevelxruby25() %{expand:%%{rubydevelx%*}} diff --git a/ruby2.5.spec b/ruby2.5.spec new file mode 100644 index 0000000..8718cc3 --- /dev/null +++ b/ruby2.5.spec @@ -0,0 +1,456 @@ +# +# spec file for package ruby2.5 +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +Name: ruby2.5 + +#### +#!!! +#!!! when updating, check versions of embedded rubygems in package stdlib below +#!!! +#### + +%define patch_level p0 +Version: 2.5.9 +Release: 150000.4.29.1 +%define pkg_version %{version} +# make the exported API version explicit +%define api_version 2.5.0 +%define rb_binary_suffix .ruby2.5 +%define rb_soname ruby2.5 +%define _rb_ua_weight 25 + +# ruby-macros and ruby-common version +%define rpm_macros_version 3 + +# +%define libname libruby2_5-2_5 +# keep in sync with macro file! +%define rb_ver %{api_version} +%define rb_arch %(echo %{_target_cpu}-linux-gnu | sed -e "s/ppc/powerpc/") +%define rb_arch_short %(echo %{_target_cpu}-linux | sed -e "s/ppc/powerpc/ ; s/i[0-9]86/x86/") +%define rb_libdir %{_libdir}/ruby/%{rb_ver}/ +%define rb_archdir %{_libdir}/ruby/%{rb_ver}/%{rb_arch} +%define rb_extdir %{_libdir}/ruby/gems/%{rb_ver}/extensions/ +%define rb_extarchdir %{_libdir}/ruby/gems/%{rb_ver}/extensions/%{rb_arch_short}/ +%define rb_extversionedarchdir %{_libdir}/ruby/gems/%{rb_ver}/extensions/%{rb_arch_short}/%{rb_ver} +%define rb_extdocdir %{_libdir}/ruby/gems/%{rb_ver}/doc/extensions +%define rb_extarchdocdir %{_libdir}/ruby/gems/%{rb_ver}/doc/extensions/%{rb_arch_short} + +%if "%{rb_default_ruby_suffix}" == "%{rb_soname}" +%define is_default_ruby 1 +%define rb_ua_weight 1%{_rb_ua_weight} +%else +%define rb_ua_weight %{_rb_ua_weight} +%endif + +%define ua_binaries rake rdoc ri +# keep in sync with macro file! +# +# from valgrind.spec +%ifarch %ix86 x86_64 ppc ppc64 +%define use_valgrind 1 +%endif +# turn on testsuite by default. we dont hard fail anyway. +%bcond_without run_tests +%bcond_without build_docs +%if 0%{?is_opensuse} || 0%{?sle_version} >= 150000 +%bcond_with jemalloc +%else +%bcond_with jemalloc +%endif +%bcond_without separate_stdlib + +# +BuildRequires: gdbm-devel +BuildRequires: ruby-bundled-gems-rpmhelper +%if %{with jemalloc} +BuildRequires: jemalloc-devel +%endif +BuildRequires: libffi-devel +BuildRequires: libyaml-devel +BuildRequires: ncurses-devel +BuildRequires: netcfg +BuildRequires: openssl-devel +BuildRequires: pkg-config +BuildRequires: procps +BuildRequires: readline-devel +BuildRequires: timezone +BuildRequires: zlib-devel +# this requires is needed as distros older than 11.3 have a buildignore on freetype2, without this the detection of the tk extension fails +BuildRequires: freetype2-devel +%if 0%{?suse_version} > 1010 +BuildRequires: xorg-x11-libX11-devel +%else +BuildRequires: xorg-x11-devel +%endif +%if 0%{?use_valgrind} +%if 0%{?suse_version} > 1021 +BuildRequires: valgrind-devel +%else +BuildRequires: valgrind +%endif +%endif +BuildRequires: xz +Provides: ruby(abi) = %{rb_ver} +%if 0%{?suse_version} > 1130 +Conflicts: ruby(abi) = %{rb_ver} +%endif +Provides: ruby25 = %{version}-%{release} +%if 0%{?is_default_ruby} +Provides: ruby-default = %{version}-%{release} +Conflicts: otherproviders(ruby-default) +%endif +Requires: %{libname} = %{version} +%if %{with separate_stdlib} +Requires: %{name}-stdlib = %{version} +%else +Provides: %{name}-stdlib = %{version}-%{release} +Obsoletes: %{name}-stdlib < %{version}-%{release} +%endif +PreReq: update-alternatives +BuildRequires: update-alternatives +Requires: ruby-common + +# +Url: https://www.ruby-lang.org/ +Source: https://cache.ruby-lang.org/pub/ruby/2.5/ruby-%{pkg_version}.tar.xz +# the file was created by applying all patches and then running gem build in the gems/did_you_mean-1.2.0 directory +Source1: did_you_mean-1.2.0.gem +# +Source3: %{name}.macros +Source4: %{name}-default.macros +Source98: series +Source99: %{name}-rpmlintrc + +Patch01: suse.patch +# this can not be in our backports git as the files are not there yet +Patch02: remove-unneeded-files.patch +# +Summary: An Interpreted Object-Oriented Scripting Language +License: BSD-2-Clause OR Ruby +Group: Development/Languages/Ruby + +%description +Ruby is an interpreted scripting language for object-oriented programming. It +has many features for processing text files and performing system management +tasks (as in Perl). It is extensible. + +* Ruby features: + +- Simple Syntax + +- *Normal* Object-Oriented features (class, method calls, for + example) + +- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for + example) + +- Operator Overloading + +- Exception Handling + +- Iterators and Closures + +- Garbage Collection + +- Dynamic Loading of Object Files (on some architectures) + +%package -n %{libname} +Summary: Dynamic runtime library for Ruby +# Both ruby and ruby-stdlib now depend explicitly on libruby by version, +# however it was not always the case, so the conflicts statements below +# are needed to handle updates. +Group: System/Libraries +Conflicts: %{name} < %{version}-%{release} +Conflicts: %{name}-stdlib < %{version}-%{release} + +%description -n %{libname} +Dynamic runtime library for Ruby + +%package doc +Summary: Documentation and samples for Ruby +Group: Development/Languages/Ruby + +%description doc +Documentation and samples for Ruby + +%if %{with separate_stdlib} +%package stdlib +Summary: The Ruby standard library +Group: Development/Languages/Ruby +Provides: ruby-stdlib = %{version}-%{release} +Requires: %{libname} = %{version} + +%description stdlib +The Ruby standard library +%endif + +%package devel +Summary: Development files to link against Ruby +Group: Development/Languages/Ruby +Requires: %{name} = %{version} +Provides: rubygems = 2.5.2 +Provides: rubygems_with_buildroot_patch +%if %{with jemalloc} +Requires: jemalloc-devel +%endif +# extconf.rb defaults to make +Requires: make +Requires: gcc + +%description devel +Development files to link against Ruby. + +%package devel-extra +Summary: Special development files of ruby, normally not installed +Group: Development/Languages/Ruby +Requires: %{name}-devel = %{version} + +%description devel-extra +Development files to link against Ruby. + +%package doc-ri +Summary: Ruby Interactive Documentation +Group: Development/Languages/Ruby +Requires: %{name} = %{version} +%if 0%{?suse_version} >= 1121 +BuildArch: noarch +%endif + +%description doc-ri +This package contains the RI docs for ruby + +%package doc-html +Summary: This package contains the HTML docs for ruby +Group: Development/Languages/Ruby +Requires: %{name} = %{version} +%if 0%{?suse_version} >= 1121 +BuildArch: noarch +%endif + +%description doc-html +This package contains the HTML docs for ruby + +%package examples +Summary: Example scripts for ruby +Group: Development/Languages/Ruby +Requires: %{name} = %{version} +%if 0%{?suse_version} >= 1121 +BuildArch: noarch +%endif + +%description examples +Example scripts for ruby + +%package test-suite +Requires: %{name} = %{version} +Summary: An Interpreted Object-Oriented Scripting Language +Group: Development/Languages/Ruby +%if 0%{?suse_version} >= 1121 +BuildArch: noarch +%endif + +%description test-suite +Ruby is an interpreted scripting language for object-oriented programming. It +has many features for processing text files and performing system management +tasks (as in Perl). It is extensible. + +* Ruby features: + +- Simple Syntax + +- *Normal* Object-Oriented features (class, method calls, for + example) + +- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for + example) + +- Operator Overloading + +- Exception Handling + +- Iterators and Closures + +- Garbage Collection + +- Dynamic Loading of Object Files (on some architectures) + +%prep +%autosetup -p1 -n ruby-%{pkg_version} +find sample -type f -print0 | xargs -r0 chmod a-x +grep -Erl '^#! */' benchmark bootstraptest ext lib sample test \ + | xargs -r perl -p -i -e 's|^#!\s*\S+(\s+.*)?$|#!/usr/bin/ruby%{rb_binary_suffix} $1|' + +%build +rm -rv gems/did_you_mean-1.2.0/evaluation +cp %{SOURCE1} gems/ +# iseq.c needs -fno-strict-aliasing +export LANG="en_US.UTF-8" +export LC_ALL="en_US.UTF-8" +export LC_CTYPE="en_US.UTF-8" +export CFLAGS="%{optflags} -fno-strict-aliasing" +%configure \ + %if %{with jemalloc} + --with-jemalloc \ + %endif + --program-suffix="%{rb_binary_suffix}" \ + --with-soname=%{rb_soname} \ + --target=%{_target_platform} \ + %if 0%{?use_valgrind} + --with-valgrind \ + %endif + %if ! %{with build_docs} + --disable-install-doc \ + --disable-install-rdoc \ + --disable-install-capi \ + %endif + --with-mantype=man \ + --enable-shared \ + --disable-static \ + --disable-rpath \ + --with-compress-debug-sections=no +make all V=1 %{?_smp_mflags} + +%install +%makeinstall V=1 +echo "%defattr(-,root,root,-)" > devel-extra-excludes +echo "%defattr(-,root,root,-)" > devel-extra-list +for i in iseq.h insns.inc insns_info.inc revision.h version.h thread_pthread.h \ + ruby_atomic.h method.h internal.h id.h vm_core.h vm_opts.h node.h eval_intern.h vm_debug.h; do + install -m 644 $i %{buildroot}%{_includedir}/ruby-%{rb_ver}/ + echo "%exclude %{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-excludes + echo "%{_includedir}/ruby-%{rb_ver}/$i" >> devel-extra-list +done + +# Create gem native extensions dir +# use shell scripting here as we're executing the just installed binary +%define rb_binary %{buildroot}/usr/bin/ruby -I %{buildroot}%{rb_libdir} -I %{buildroot}%{rb_archdir} +export LD_LIBRARY_PATH=%{buildroot}%{_libdir} + +install -D -m 0644 %{S:3} %{buildroot}/etc/rpm/macros.suse-ruby2.5 +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +%if 0%{?is_default_ruby} + install -D -m 0644 %{S:4} %{buildroot}/etc/rpm/macros.suse-ruby2.5-default + for bin in %{buildroot}%{_bindir}/{erb,gem,irb,ruby}%{rb_binary_suffix} ; do + # yes really hard links + ln $bin ${bin%%%{rb_binary_suffix}} + done + for man in %{buildroot}%{_mandir}/man1/*%{rb_binary_suffix}.1* ; do + # yes really hard links + # TODO: this is dangerous as we cant anc + ln $man ${man%%%{rb_binary_suffix}.1}.1 + done + ln -s lib%{rb_soname}.so %{buildroot}%{_libdir}/libruby.so +%endif +for bin in %{ua_binaries}; do + # dummy + mv %{buildroot}%_bindir/${bin}%{rb_binary_suffix} %{buildroot}%_bindir/$bin.ruby%{rb_binary_suffix} + # + ln -s $bin %{buildroot}%{_sysconfdir}/alternatives/$bin + ln -s %{_sysconfdir}/alternatives/$bin %{buildroot}%_bindir/$bin + # + ln -s ${bin}%{rb_binary_suffix} %{buildroot}%{_sysconfdir}/alternatives//$bin%{rb_binary_suffix} + ln -s %{_sysconfdir}/alternatives/$bin%{rb_binary_suffix} %{buildroot}%_bindir/$bin%{rb_binary_suffix} +done +install -dD %{buildroot}%{rb_extdir} %{buildroot}%{rb_extarchdir} %{buildroot}%{rb_extversionedarchdir} %{buildroot}%{rb_extarchdocdir} +chmod -vR go-w,go+rX %{buildroot}%{_libdir}/ruby + +%post +for bin in %{ua_binaries}; do + /usr/sbin/update-alternatives --install \ + %{_bindir}/$bin $bin %{_bindir}/$bin.ruby%{rb_binary_suffix} %{rb_ua_weight} + /usr/sbin/update-alternatives --install \ + %{_bindir}/$bin%{rb_binary_suffix} $bin%{rb_binary_suffix} %{_bindir}/$bin.ruby%{rb_binary_suffix} %{rb_ua_weight} +done + +%preun +if [ "$1" = 0 ] ; then + for bin in %{ua_binaries}; do + /usr/sbin/update-alternatives --remove $bin %{_bindir}/$bin.ruby%{rb_binary_suffix} + /usr/sbin/update-alternatives --remove $bin%{rb_binary_suffix} %{_bindir}/$bin.ruby%{rb_binary_suffix} + done +fi + +%if %{with run_tests} +%check +DISABLE_TESTS="" +%ifarch armv7l armv7hl armv7hnl +# test_call_double(DL::TestDL) fails on ARM HardFP +# http://bugs.ruby-lang.org/issues/6592 +DISABLE_TESTS="-x test_dl2.rb $DISABLE_TESTS" + +# Workaround OpenSSL::TestPKeyRSA#test_sign_verify_memory_leak timeouts on ARM. +# https://bugs.ruby-lang.org/issues/9984 +sed -i -e 's|20_000|10_000|g' test/openssl/test_pkey_rsa.rb +%endif +# Allow MD5 in OpenSSL. +# https://bugs.ruby-lang.org/issues/9154 +export OPENSSL_ENABLE_MD5_VERIFY=1 +export LD_LIBRARY_PATH="$PWD" +# we know some tests will fail when they do not find a /usr/bin/ruby +make -j 4 check V=1 TESTOPTS="$DISABLE_TESTS" ||: +%endif + +%post -n %{libname} -p /sbin/ldconfig +%postun -n %{libname} -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%ghost %{_sysconfdir}/alternatives/rake* +%ghost %{_sysconfdir}/alternatives/rdoc* +%ghost %{_sysconfdir}/alternatives/ri* +%{_bindir}/erb* +%{_bindir}/gem* +%{_bindir}/irb* +%{_bindir}/rake* +%{_bindir}/rdoc* +%{_bindir}/ri* +%{_bindir}/ruby* +%{_mandir}/man1/ri*.1* +%{_mandir}/man1/irb*.1* +%{_mandir}/man1/erb*.1* +#{_mandir}/man1/rake*.1* +%{_mandir}/man1/ruby*.1* +%doc ChangeLog COPYING COPYING.ja GPL KNOWNBUGS.rb LEGAL NEWS README* +%config /etc/rpm/macros.suse-ruby2.5* + +%if %{with separate_stdlib} +%files stdlib +%defattr(-,root,root,-) +%endif +%{_libdir}/ruby/ +%exclude %{_libdir}/ruby/gems/%{api_version}/gems/*/test/ +%dir %rb_extdir +%dir %rb_extarchdir +%dir %rb_extversionedarchdir +%dir %rb_extdocdir +%dir %rb_extarchdocdir + +%files -n %{libname} +%defattr(-,root,root,-) +%{_libdir}/libruby*.so.* + +%files devel -f devel-extra-excludes +%defattr(-,root,root,-) +%{_includedir}/ruby-%{rb_ver} +%{_libdir}/libruby*.so +%{_libdir}/pkgconfig/ruby-2.5.pc + +%files devel-extra -f devel-extra-list + +%if %{with build_docs} +%files doc +%defattr(-,root,root,-) +%doc doc/* sample/ + +%files doc-ri +%defattr(-,root,root,-) +%dir %{_datadir}/ri/ +%{_datadir}/ri/%{rb_ver}/ +%endif + +%changelog diff --git a/series b/series new file mode 100644 index 0000000..a2c7b87 --- /dev/null +++ b/series @@ -0,0 +1,11 @@ +# Patch series file for quilt, created by quilt setup +# Source: ruby-2.5.5.tar.xz +# Patchdir: ruby-2.5.5 +# +0001-make-gem-build-reproducible.patch +0002-gc.c-tick-for-POWER-arch.patch +0003-Mark-Gemspec-reproducible-change-fixing-784225-too.patch +0004-Make-gemspecs-reproducible.patch +0005-Include-the-alternative-malloc-header-instead-of-mal.patch +0006-Use-PIE-for-the-binaries.patch +0007-date-support-for-Reiwa-new-Japanese-era.patch diff --git a/suse.patch b/suse.patch new file mode 100644 index 0000000..15cb83f --- /dev/null +++ b/suse.patch @@ -0,0 +1,3844 @@ +diff --git a/Makefile.in b/Makefile.in +index 25075f5900..515cac832b 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -233,7 +233,7 @@ miniruby$(EXEEXT): + $(PROGRAM): + @$(RM) $@ + $(ECHO) linking $@ +- $(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@ ++ $(Q) $(PURIFY) $(CC) -pie $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@ + $(Q) $(POSTLINK) + + # We must `rm' the library each time this rule is invoked because "updating" a +diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec +index c8c90870ea..9cf22f7e0a 100644 +--- a/ext/bigdecimal/bigdecimal.gemspec ++++ b/ext/bigdecimal/bigdecimal.gemspec +@@ -6,6 +6,7 @@ + s.name = "bigdecimal" + s.version = bigdecimal_version + s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"] ++ s.date = RUBY_RELEASE_DATE + s.email = ["mrkn@mrkn.jp"] + + s.summary = "Arbitrary-precision decimal floating-point number library." +diff --git a/ext/cgi/escape/escape.c b/ext/cgi/escape/escape.c +index ced1b182eb..578d651dc1 100644 +--- a/ext/cgi/escape/escape.c ++++ b/ext/cgi/escape/escape.c +@@ -11,6 +11,21 @@ RUBY_EXTERN const signed char ruby_digit36_to_number_table[]; + static VALUE rb_cCGI, rb_mUtil, rb_mEscape; + static ID id_accept_charset; + ++#define HTML_ESCAPE_MAX_LEN 6 ++ ++static const struct { ++ uint8_t len; ++ char str[HTML_ESCAPE_MAX_LEN+1]; ++} html_escape_table[UCHAR_MAX+1] = { ++#define HTML_ESCAPE(c, str) [c] = {rb_strlen_lit(str), str} ++ HTML_ESCAPE('\'', "'"), ++ HTML_ESCAPE('&', "&"), ++ HTML_ESCAPE('"', """), ++ HTML_ESCAPE('<', "<"), ++ HTML_ESCAPE('>', ">"), ++#undef HTML_ESCAPE ++}; ++ + static void + html_escaped_cat(VALUE str, char c) + { +@@ -44,40 +59,35 @@ preserve_original_state(VALUE orig, VALUE dest) + static VALUE + optimized_escape_html(VALUE str) + { +- long i, len, beg = 0; +- VALUE dest = 0; +- const char *cstr; +- +- len = RSTRING_LEN(str); +- cstr = RSTRING_PTR(str); +- +- for (i = 0; i < len; i++) { +- switch (cstr[i]) { +- case '\'': +- case '&': +- case '"': +- case '<': +- case '>': +- if (!dest) { +- dest = rb_str_buf_new(len); +- } +- +- rb_str_cat(dest, cstr + beg, i - beg); +- beg = i + 1; +- +- html_escaped_cat(dest, cstr[i]); +- break; +- } ++ VALUE vbuf; ++ typedef char escape_buf[HTML_ESCAPE_MAX_LEN]; ++ char *buf = *ALLOCV_N(escape_buf, vbuf, RSTRING_LEN(str)); ++ const char *cstr = RSTRING_PTR(str); ++ const char *end = cstr + RSTRING_LEN(str); ++ ++ char *dest = buf; ++ while (cstr < end) { ++ const unsigned char c = *cstr++; ++ uint8_t len = html_escape_table[c].len; ++ if (len) { ++ memcpy(dest, html_escape_table[c].str, len); ++ dest += len; ++ } ++ else { ++ *dest++ = c; ++ } + } + +- if (dest) { +- rb_str_cat(dest, cstr + beg, len - beg); +- preserve_original_state(str, dest); +- return dest; ++ VALUE escaped; ++ if (RSTRING_LEN(str) < (dest - buf)) { ++ escaped = rb_str_new(buf, dest - buf); ++ preserve_original_state(str, escaped); + } + else { +- return rb_str_dup(str); ++ escaped = rb_str_dup(str); + } ++ ALLOCV_END(vbuf); ++ return escaped; + } + + static VALUE +diff --git a/ext/date/date_core.c b/ext/date/date_core.c +index c250633426..1734ec0349 100644 +--- a/ext/date/date_core.c ++++ b/ext/date/date_core.c +@@ -51,6 +51,9 @@ static double positive_inf, negative_inf; + #define f_add3(x,y,z) f_add(f_add(x, y), z) + #define f_sub3(x,y,z) f_sub(f_sub(x, y), z) + ++static VALUE date_initialize(int argc, VALUE *argv, VALUE self); ++static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self); ++ + inline static int + f_cmp(VALUE x, VALUE y) + { +@@ -94,7 +97,7 @@ f_ge_p(VALUE x, VALUE y) + { + if (FIXNUM_P(x) && FIXNUM_P(y)) + return f_boolcast(FIX2LONG(x) >= FIX2LONG(y)); +- return rb_funcall(x, rb_intern(">="), 1, y); ++ return rb_funcall(x, id_ge_p, 1, y); + } + + inline static VALUE +@@ -102,7 +105,7 @@ f_eqeq_p(VALUE x, VALUE y) + { + if (FIXNUM_P(x) && FIXNUM_P(y)) + return f_boolcast(FIX2LONG(x) == FIX2LONG(y)); +- return rb_funcall(x, rb_intern("=="), 1, y); ++ return rb_funcall(x, id_eqeq_p, 1, y); + } + + inline static VALUE +@@ -236,11 +239,8 @@ f_negative_p(VALUE x) + struct SimpleDateData + { + unsigned flags; +- VALUE nth; /* not always canonicalized */ + int jd; /* as utc */ +- /* df is zero */ +- /* sf is zero */ +- /* of is zero */ ++ VALUE nth; /* not always canonicalized */ + date_sg_t sg; /* 2298874..2426355 or -/+oo -- at most 22 bits */ + /* decoded as utc=local */ + int year; /* truncated */ +@@ -259,11 +259,8 @@ struct SimpleDateData + struct ComplexDateData + { + unsigned flags; +- VALUE nth; /* not always canonicalized */ + int jd; /* as utc */ +- int df; /* as utc, in secs */ +- VALUE sf; /* in nano secs */ +- int of; /* in secs */ ++ VALUE nth; /* not always canonicalized */ + date_sg_t sg; /* 2298874..2426355 or -/+oo -- at most 22 bits */ + /* decoded as local */ + int year; /* truncated */ +@@ -277,6 +274,9 @@ struct ComplexDateData + /* packed civil */ + unsigned pc; + #endif ++ int df; /* as utc, in secs */ ++ int of; /* in secs */ ++ VALUE sf; /* in nano secs */ + }; + + union DateData { +@@ -315,31 +315,31 @@ canon(VALUE x) + + #ifndef USE_PACK + #define set_to_simple(obj, x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth)); \ + (x)->jd = _jd;\ + (x)->sg = (date_sg_t)(_sg);\ + (x)->year = _year;\ + (x)->mon = _mon;\ + (x)->mday = _mday;\ +- (x)->flags = _flags;\ +-} ++ (x)->flags = (_flags) & ~COMPLEX_DAT;\ ++} while (0) + #else + #define set_to_simple(obj, x, _nth, _jd ,_sg, _year, _mon, _mday, _flags) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth)); \ + (x)->jd = _jd;\ + (x)->sg = (date_sg_t)(_sg);\ + (x)->year = _year;\ + (x)->pc = PACK2(_mon, _mday);\ +- (x)->flags = _flags;\ +-} ++ (x)->flags = (_flags) & ~COMPLEX_DAT;\ ++} while (0) + #endif + + #ifndef USE_PACK + #define set_to_complex(obj, x, _nth, _jd ,_df, _sf, _of, _sg,\ + _year, _mon, _mday, _hour, _min, _sec, _flags) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth));\ + (x)->jd = _jd;\ + (x)->df = _df;\ +@@ -352,12 +352,12 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \ + (x)->hour = _hour;\ + (x)->min = _min;\ + (x)->sec = _sec;\ +- (x)->flags = _flags;\ +-} ++ (x)->flags = (_flags) | COMPLEX_DAT;\ ++} while (0) + #else + #define set_to_complex(obj, x, _nth, _jd ,_df, _sf, _of, _sg,\ + _year, _mon, _mday, _hour, _min, _sec, _flags) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth));\ + (x)->jd = _jd;\ + (x)->df = _df;\ +@@ -366,13 +366,13 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \ + (x)->sg = (date_sg_t)(_sg);\ + (x)->year = _year;\ + (x)->pc = PACK5(_mon, _mday, _hour, _min, _sec);\ +- (x)->flags = _flags;\ +-} ++ (x)->flags = (_flags) | COMPLEX_DAT;\ ++} while (0) + #endif + + #ifndef USE_PACK + #define copy_simple_to_complex(obj, x, y) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\ + (x)->jd = (y)->jd;\ + (x)->df = 0;\ +@@ -386,10 +386,10 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \ + (x)->min = 0;\ + (x)->sec = 0;\ + (x)->flags = (y)->flags;\ +-} ++} while (0) + #else + #define copy_simple_to_complex(obj, x, y) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\ + (x)->jd = (y)->jd;\ + (x)->df = 0;\ +@@ -399,12 +399,12 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \ + (x)->year = (y)->year;\ + (x)->pc = PACK5(EX_MON((y)->pc), EX_MDAY((y)->pc), 0, 0, 0);\ + (x)->flags = (y)->flags;\ +-} ++} while (0) + #endif + + #ifndef USE_PACK + #define copy_complex_to_simple(obj, x, y) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\ + (x)->jd = (y)->jd;\ + (x)->sg = (date_sg_t)((y)->sg);\ +@@ -412,17 +412,17 @@ _year, _mon, _mday, _hour, _min, _sec, _flags) \ + (x)->mon = (y)->mon;\ + (x)->mday = (y)->mday;\ + (x)->flags = (y)->flags;\ +-} ++} while (0) + #else + #define copy_complex_to_simple(obj, x, y) \ +-{\ ++do {\ + RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\ + (x)->jd = (y)->jd;\ + (x)->sg = (date_sg_t)((y)->sg);\ + (x)->year = (y)->year;\ + (x)->pc = PACK2(EX_MON((y)->pc), EX_MDAY((y)->pc));\ + (x)->flags = (y)->flags;\ +-} ++} while (0) + #endif + + /* base */ +@@ -1109,7 +1109,7 @@ m_virtual_sg(union DateData *x) + } + + #define canonicalize_jd(_nth, _jd) \ +-{\ ++do {\ + if (_jd < 0) {\ + _nth = f_sub(_nth, INT2FIX(1));\ + _jd += CM_PERIOD;\ +@@ -1118,7 +1118,7 @@ m_virtual_sg(union DateData *x) + _nth = f_add(_nth, INT2FIX(1));\ + _jd -= CM_PERIOD;\ + }\ +-} ++} while (0) + + inline static void + canonicalize_s_jd(VALUE obj, union DateData *x) +@@ -1928,13 +1928,13 @@ m_sec(union DateData *x) + } + + #define decode_offset(of,s,h,m)\ +-{\ ++do {\ + int a;\ + s = (of < 0) ? '-' : '+';\ + a = (of < 0) ? -of : of;\ + h = a / HOUR_IN_SECONDS;\ + m = a % HOUR_IN_SECONDS / MINUTE_IN_SECONDS;\ +-} ++} while (0) + + static VALUE + of2str(int of) +@@ -2333,6 +2333,9 @@ VALUE date_zone_to_diff(VALUE); + static int + offset_to_sec(VALUE vof, int *rof) + { ++ int try_rational = 1; ++ ++ again: + switch (TYPE(vof)) { + case T_FIXNUM: + { +@@ -2359,10 +2362,11 @@ offset_to_sec(VALUE vof, int *rof) + default: + expect_numeric(vof); + vof = f_to_r(vof); +-#ifdef CANONICALIZATION_FOR_MATHN +- if (!k_rational_p(vof)) +- return offset_to_sec(vof, rof); +-#endif ++ if (!k_rational_p(vof)) { ++ if (!try_rational) Check_Type(vof, T_RATIONAL); ++ try_rational = 0; ++ goto again; ++ } + /* fall through */ + case T_RATIONAL: + { +@@ -2371,17 +2375,10 @@ offset_to_sec(VALUE vof, int *rof) + + vs = day_to_sec(vof); + +-#ifdef CANONICALIZATION_FOR_MATHN + if (!k_rational_p(vs)) { +- if (!FIXNUM_P(vs)) +- return 0; +- n = FIX2LONG(vs); +- if (n < -DAY_IN_SECONDS || n > DAY_IN_SECONDS) +- return 0; +- *rof = (int)n; +- return 1; ++ vn = vs; ++ goto rounded; + } +-#endif + vn = rb_rational_num(vs); + vd = rb_rational_den(vs); + +@@ -2391,6 +2388,7 @@ offset_to_sec(VALUE vof, int *rof) + vn = f_round(vs); + if (!f_eqeq_p(vn, vs)) + rb_warning("fraction of offset is ignored"); ++ rounded: + if (!FIXNUM_P(vn)) + return 0; + n = FIX2LONG(vn); +@@ -2420,12 +2418,12 @@ offset_to_sec(VALUE vof, int *rof) + /* date */ + + #define valid_sg(sg) \ +-{\ ++do {\ + if (!c_valid_start_p(sg)) {\ + sg = 0;\ + rb_warning("invalid start is ignored");\ + }\ +-} ++} while (0) + + static VALUE + valid_jd_sub(int argc, VALUE *argv, VALUE klass, int need_jd) +@@ -2968,7 +2966,7 @@ d_simple_new_internal(VALUE klass, + + obj = TypedData_Make_Struct(klass, struct SimpleDateData, + &d_lite_type, dat); +- set_to_simple(obj, dat, nth, jd, sg, y, m, d, flags & ~COMPLEX_DAT); ++ set_to_simple(obj, dat, nth, jd, sg, y, m, d, flags); + + assert(have_jd_p(dat) || have_civil_p(dat)); + +@@ -2990,7 +2988,7 @@ d_complex_new_internal(VALUE klass, + obj = TypedData_Make_Struct(klass, struct ComplexDateData, + &d_lite_type, dat); + set_to_complex(obj, dat, nth, jd, df, sf, of, sg, +- y, m, d, h, min, s, flags | COMPLEX_DAT); ++ y, m, d, h, min, s, flags); + + assert(have_jd_p(dat) || have_civil_p(dat)); + assert(have_df_p(dat) || have_time_p(dat)); +@@ -3207,47 +3205,47 @@ s_trunc(VALUE s, VALUE *fr) + } + + #define num2num_with_frac(s,n) \ +-{\ ++do {\ + s = s##_trunc(v##s, &fr);\ + if (f_nonzero_p(fr)) {\ + if (argc > n)\ + rb_raise(rb_eArgError, "invalid fraction");\ + fr2 = fr;\ + }\ +-} ++} while (0) + + #define num2int_with_frac(s,n) \ +-{\ ++do {\ + s = NUM2INT(s##_trunc(v##s, &fr));\ + if (f_nonzero_p(fr)) {\ + if (argc > n)\ + rb_raise(rb_eArgError, "invalid fraction");\ + fr2 = fr;\ + }\ +-} ++} while (0) + + #define canon24oc() \ +-{\ ++do {\ + if (rh == 24) {\ + rh = 0;\ + fr2 = f_add(fr2, INT2FIX(1));\ + }\ +-} ++} while (0) + + #define add_frac() \ +-{\ ++do {\ + if (f_nonzero_p(fr2))\ + ret = d_lite_plus(ret, fr2);\ +-} ++} while (0) + + #define val2sg(vsg,dsg) \ +-{\ ++do {\ + dsg = NUM2DBL(vsg);\ + if (!c_valid_start_p(dsg)) {\ + dsg = DEFAULT_SG;\ + rb_warning("invalid start is ignored");\ + }\ +-} ++} while (0) + + static VALUE d_lite_plus(VALUE, VALUE); + +@@ -3384,10 +3382,21 @@ date_s_ordinal(int argc, VALUE *argv, VALUE klass) + */ + static VALUE + date_s_civil(int argc, VALUE *argv, VALUE klass) ++{ ++ return date_initialize(argc, argv, d_lite_s_alloc_simple(klass)); ++} ++ ++static VALUE ++date_initialize(int argc, VALUE *argv, VALUE self) + { + VALUE vy, vm, vd, vsg, y, fr, fr2, ret; + int m, d; + double sg; ++ struct SimpleDateData *dat = rb_check_typeddata(self, &d_lite_type); ++ ++ if (!simple_dat_p(dat)) { ++ rb_raise(rb_eTypeError, "Date expected"); ++ } + + rb_scan_args(argc, argv, "04", &vy, &vm, &vd, &vsg); + +@@ -3417,11 +3426,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass) + &rm, &rd)) + rb_raise(rb_eArgError, "invalid date"); + +- ret = d_simple_new_internal(klass, +- nth, 0, +- sg, +- ry, rm, rd, +- HAVE_CIVIL); ++ set_to_simple(self, dat, nth, 0, sg, ry, rm, rd, HAVE_CIVIL); + } + else { + VALUE nth; +@@ -3433,12 +3438,9 @@ date_s_civil(int argc, VALUE *argv, VALUE klass) + &ns)) + rb_raise(rb_eArgError, "invalid date"); + +- ret = d_simple_new_internal(klass, +- nth, rjd, +- sg, +- ry, rm, rd, +- HAVE_JD | HAVE_CIVIL); ++ set_to_simple(self, dat, nth, rjd, sg, ry, rm, rd, HAVE_JD | HAVE_CIVIL); + } ++ ret = self; + add_frac(); + return ret; + } +@@ -3679,9 +3681,11 @@ date_s_today(int argc, VALUE *argv, VALUE klass) + #define ref_hash0(k) rb_hash_aref(hash, k) + #define del_hash0(k) rb_hash_delete(hash, k) + +-#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k)), v) +-#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k))) +-#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k))) ++#define sym(x) ID2SYM(rb_intern(x"")) ++ ++#define set_hash(k,v) set_hash0(sym(k), v) ++#define ref_hash(k) ref_hash0(sym(k)) ++#define del_hash(k) del_hash0(sym(k)) + + static VALUE + rt_rewrite_frags(VALUE hash) +@@ -3718,8 +3722,6 @@ rt_rewrite_frags(VALUE hash) + return hash; + } + +-#define sym(x) ID2SYM(rb_intern(x)) +- + static VALUE d_lite_year(VALUE); + static VALUE d_lite_wday(VALUE); + static VALUE d_lite_jd(VALUE); +@@ -4290,12 +4292,40 @@ date_s_strptime(int argc, VALUE *argv, VALUE klass) + + VALUE date__parse(VALUE str, VALUE comp); + ++static size_t ++get_limit(VALUE opt) ++{ ++ if (!NIL_P(opt)) { ++ VALUE limit = rb_hash_aref(opt, ID2SYM(rb_intern("limit"))); ++ if (NIL_P(limit)) return SIZE_MAX; ++ return NUM2SIZET(limit); ++ } ++ return 128; ++} ++ ++static void ++check_limit(VALUE str, VALUE opt) ++{ ++ if (NIL_P(str)) return; ++ if (SYMBOL_P(str)) str = rb_sym2str(str); ++ ++ StringValue(str); ++ size_t slen = RSTRING_LEN(str); ++ size_t limit = get_limit(opt); ++ if (slen > limit) { ++ rb_raise(rb_eArgError, ++ "string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit); ++ } ++} ++ + static VALUE + date_s__parse_internal(int argc, VALUE *argv, VALUE klass) + { +- VALUE vstr, vcomp, hash; ++ VALUE vstr, vcomp, hash, opt; + +- rb_scan_args(argc, argv, "11", &vstr, &vcomp); ++ rb_scan_args(argc, argv, "11:", &vstr, &vcomp, &opt); ++ if (!NIL_P(opt)) argc--; ++ check_limit(vstr, opt); + StringValue(vstr); + if (!rb_enc_str_asciicompat_p(vstr)) + rb_raise(rb_eArgError, +@@ -4320,7 +4350,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass) + + /* + * call-seq: +- * Date._parse(string[, comp=true]) -> hash ++ * Date._parse(string[, comp=true], limit: 128) -> hash + * + * Parses the given representation of date and time, and returns a + * hash of parsed elements. This method does not function as a +@@ -4331,6 +4361,10 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass) + * it full. + * + * Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3} ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s__parse(int argc, VALUE *argv, VALUE klass) +@@ -4340,7 +4374,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) + + /* + * call-seq: +- * Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date ++ * Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date + * + * Parses the given representation of date and time, and creates a + * date object. This method does not function as a validator. +@@ -4352,13 +4386,18 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) + * Date.parse('2001-02-03') #=> # + * Date.parse('20010203') #=> # + * Date.parse('3rd Feb 2001') #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_parse(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, comp, sg; ++ VALUE str, comp, sg, opt; + +- rb_scan_args(argc, argv, "03", &str, &comp, &sg); ++ rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -4370,11 +4409,12 @@ date_s_parse(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE argv2[2], hash; +- +- argv2[0] = str; +- argv2[1] = comp; +- hash = date_s__parse(2, argv2, klass); ++ int argc2 = 2; ++ VALUE argv2[3]; ++ argv2[0] = str; ++ argv2[1] = comp; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__parse(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } +@@ -4388,19 +4428,28 @@ VALUE date__jisx0301(VALUE); + + /* + * call-seq: +- * Date._iso8601(string) -> hash ++ * Date._iso8601(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__iso8601(VALUE klass, VALUE str) ++date_s__iso8601(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__iso8601(str); + } + + /* + * call-seq: +- * Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]) -> date ++ * Date.iso8601(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some typical ISO 8601 formats. +@@ -4408,13 +4457,18 @@ date_s__iso8601(VALUE klass, VALUE str) + * Date.iso8601('2001-02-03') #=> # + * Date.iso8601('20010203') #=> # + * Date.iso8601('2001-W05-6') #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_iso8601(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -4424,38 +4478,56 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__iso8601(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__iso8601(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * Date._rfc3339(string) -> hash ++ * Date._rfc3339(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__rfc3339(VALUE klass, VALUE str) ++date_s__rfc3339(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__rfc3339(str); + } + + /* + * call-seq: +- * Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> date ++ * Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some typical RFC 3339 formats. + * + * Date.rfc3339('2001-02-03T04:05:06+07:00') #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_rfc3339(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -4465,38 +4537,56 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__rfc3339(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__rfc3339(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * Date._xmlschema(string) -> hash ++ * Date._xmlschema(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__xmlschema(VALUE klass, VALUE str) ++date_s__xmlschema(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__xmlschema(str); + } + + /* + * call-seq: +- * Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]) -> date ++ * Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some typical XML Schema formats. + * + * Date.xmlschema('2001-02-03') #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_xmlschema(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -4506,41 +4596,58 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__xmlschema(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__xmlschema(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * Date._rfc2822(string) -> hash +- * Date._rfc822(string) -> hash ++ * Date._rfc2822(string, limit: 128) -> hash ++ * Date._rfc822(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__rfc2822(VALUE klass, VALUE str) ++date_s__rfc2822(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__rfc2822(str); + } + + /* + * call-seq: +- * Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date +- * Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date ++ * Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date ++ * Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some typical RFC 2822 formats. + * + * Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_rfc2822(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); + + switch (argc) { + case 0: +@@ -4550,39 +4657,56 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__rfc2822(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__rfc2822(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * Date._httpdate(string) -> hash ++ * Date._httpdate(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__httpdate(VALUE klass, VALUE str) ++date_s__httpdate(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__httpdate(str); + } + + /* + * call-seq: +- * Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> date ++ * Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some RFC 2616 format. + * + * Date.httpdate('Sat, 03 Feb 2001 00:00:00 GMT') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_httpdate(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); + + switch (argc) { + case 0: +@@ -4592,38 +4716,60 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__httpdate(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__httpdate(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * Date._jisx0301(string) -> hash ++ * Date._jisx0301(string, limit: 128) -> hash + * + * Returns a hash of parsed elements. ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE +-date_s__jisx0301(VALUE klass, VALUE str) ++date_s__jisx0301(int argc, VALUE *argv, VALUE klass) + { ++ VALUE str, opt; ++ ++ rb_scan_args(argc, argv, "1:", &str, &opt); ++ check_limit(str, opt); ++ + return date__jisx0301(str); + } + + /* + * call-seq: +- * Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]) -> date ++ * Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date + * + * Creates a new Date object by parsing from a string according to + * some typical JIS X 0301 formats. + * + * Date.jisx0301('H13.02.03') #=> # ++ * ++ * For no-era year, legacy format, Heisei is assumed. ++ * ++ * Date.jisx0301('13.02.03') #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + date_s_jisx0301(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -4633,7 +4779,11 @@ date_s_jisx0301(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__jisx0301(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ if (!NIL_P(opt)) argv2[argc2++] = opt; ++ VALUE hash = date_s__jisx0301(argc2, argv2, klass); + return d_new_by_frags(klass, hash, sg); + } + } +@@ -4691,14 +4841,14 @@ dup_obj_as_complex(VALUE self) + } + + #define val2off(vof,iof) \ +-{\ ++do {\ + if (!offset_to_sec(vof, &iof)) {\ + iof = 0;\ + rb_warning("invalid offset is ignored");\ + }\ +-} ++} while (0) + +-#ifndef NDEBUG ++#if 0 + static VALUE + d_lite_initialize(int argc, VALUE *argv, VALUE self) + { +@@ -4751,7 +4901,7 @@ d_lite_initialize(int argc, VALUE *argv, VALUE self) + "cannot load complex into simple"); + + set_to_complex(self, &dat->c, nth, rjd, df, sf, of, sg, +- 0, 0, 0, 0, 0, 0, HAVE_JD | HAVE_DF | COMPLEX_DAT); ++ 0, 0, 0, 0, 0, 0, HAVE_JD | HAVE_DF); + } + } + return self; +@@ -4770,8 +4920,28 @@ d_lite_initialize_copy(VALUE copy, VALUE date) + { + get_d2(copy, date); + if (simple_dat_p(bdat)) { +- adat->s = bdat->s; +- adat->s.flags &= ~COMPLEX_DAT; ++ if (simple_dat_p(adat)) { ++ adat->s = bdat->s; ++ } ++ else { ++ adat->c.flags = bdat->s.flags | COMPLEX_DAT; ++ adat->c.nth = bdat->s.nth; ++ adat->c.jd = bdat->s.jd; ++ adat->c.df = 0; ++ adat->c.sf = INT2FIX(0); ++ adat->c.of = 0; ++ adat->c.sg = bdat->s.sg; ++ adat->c.year = bdat->s.year; ++#ifndef USE_PACK ++ adat->c.mon = bdat->s.mon; ++ adat->c.mday = bdat->s.mday; ++ adat->c.hour = bdat->s.hour; ++ adat->c.min = bdat->s.min; ++ adat->c.sec = bdat->s.sec; ++#else ++ adat->c.pc = bdat->s.pc; ++#endif ++ } + } + else { + if (!complex_dat_p(adat)) +@@ -4779,7 +4949,6 @@ d_lite_initialize_copy(VALUE copy, VALUE date) + "cannot load complex into simple"); + + adat->c = bdat->c; +- adat->c.flags |= COMPLEX_DAT; + } + } + return copy; +@@ -5513,8 +5682,10 @@ d_lite_new_offset(int argc, VALUE *argv, VALUE self) + static VALUE + d_lite_plus(VALUE self, VALUE other) + { ++ int try_rational = 1; + get_d1(self); + ++ again: + switch (TYPE(other)) { + case T_FIXNUM: + { +@@ -5724,18 +5895,21 @@ d_lite_plus(VALUE self, VALUE other) + default: + expect_numeric(other); + other = f_to_r(other); +-#ifdef CANONICALIZATION_FOR_MATHN +- if (!k_rational_p(other)) +- return d_lite_plus(self, other); +-#endif ++ if (!k_rational_p(other)) { ++ if (!try_rational) Check_Type(other, T_RATIONAL); ++ try_rational = 0; ++ goto again; ++ } + /* fall through */ + case T_RATIONAL: + { + VALUE nth, sf, t; + int jd, df, s; + +- if (wholenum_p(other)) +- return d_lite_plus(self, rb_rational_num(other)); ++ if (wholenum_p(other)) { ++ other = rb_rational_num(other); ++ goto again; ++ } + + if (f_positive_p(other)) + s = +1; +@@ -6242,7 +6416,7 @@ cmp_gen(VALUE self, VALUE other) + return INT2FIX(f_cmp(m_ajd(dat), other)); + else if (k_date_p(other)) + return INT2FIX(f_cmp(m_ajd(dat), f_ajd(other))); +- return rb_num_coerce_cmp(self, other, rb_intern("<=>")); ++ return rb_num_coerce_cmp(self, other, id_cmp); + } + + static VALUE +@@ -6371,7 +6545,7 @@ equal_gen(VALUE self, VALUE other) + return f_eqeq_p(m_real_local_jd(dat), other); + else if (k_date_p(other)) + return f_eqeq_p(m_real_local_jd(dat), f_jd(other)); +- return rb_num_coerce_cmp(self, other, rb_intern("==")); ++ return rb_num_coerce_cmp(self, other, id_eqeq_p); + } + + /* +@@ -6469,7 +6643,7 @@ d_lite_to_s(VALUE self) + static VALUE + mk_inspect_raw(union DateData *x, VALUE klass) + { +- char flags[5]; ++ char flags[6]; + + flags[0] = (x->flags & COMPLEX_DAT) ? 'C' : 'S'; + flags[1] = (x->flags & HAVE_JD) ? 'j' : '-'; +@@ -6635,7 +6809,9 @@ tmx_m_of(union DateData *x) + static char * + tmx_m_zone(union DateData *x) + { +- return RSTRING_PTR(m_zone(x)); ++ VALUE zone = m_zone(x); ++ /* TODO: fix potential dangling pointer */ ++ return RSTRING_PTR(zone); + } + + static const struct tmx_funcs tmx_funcs = { +@@ -6785,7 +6961,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self, + * + * %M - Minute of the hour (00..59) + * +- * %S - Second of the minute (00..59) ++ * %S - Second of the minute (00..60) + * + * %L - Millisecond of the second (000..999) + * %N - Fractional seconds digits, default is 9 digits (nanosecond) +@@ -7018,10 +7194,14 @@ jisx0301_date_format(char *fmt, size_t size, VALUE jd, VALUE y) + c = 'S'; + s = 1925; + } +- else { ++ else if (d < 2458605) { + c = 'H'; + s = 1988; + } ++ else { ++ c = 'R'; ++ s = 2018; ++ } + snprintf(fmt, size, "%c%02ld" ".%%m.%%d", c, FIX2INT(y) - s); + return fmt; + } +@@ -7099,6 +7279,10 @@ d_lite_marshal_dump(VALUE self) + static VALUE + d_lite_marshal_load(VALUE self, VALUE a) + { ++ VALUE nth, sf; ++ int jd, df, of; ++ double sg; ++ + get_d1(self); + + rb_check_frozen(self); +@@ -7111,63 +7295,33 @@ d_lite_marshal_load(VALUE self, VALUE a) + case 2: /* 1.6.x */ + case 3: /* 1.8.x, 1.9.2 */ + { +- VALUE ajd, of, sg, nth, sf; +- int jd, df, rof; +- double rsg; +- ++ VALUE ajd, vof, vsg; + + if (RARRAY_LEN(a) == 2) { + ajd = f_sub(RARRAY_AREF(a, 0), half_days_in_day); +- of = INT2FIX(0); +- sg = RARRAY_AREF(a, 1); +- if (!k_numeric_p(sg)) +- sg = DBL2NUM(RTEST(sg) ? GREGORIAN : JULIAN); ++ vof = INT2FIX(0); ++ vsg = RARRAY_AREF(a, 1); ++ if (!k_numeric_p(vsg)) ++ vsg = DBL2NUM(RTEST(vsg) ? GREGORIAN : JULIAN); + } + else { + ajd = RARRAY_AREF(a, 0); +- of = RARRAY_AREF(a, 1); +- sg = RARRAY_AREF(a, 2); ++ vof = RARRAY_AREF(a, 1); ++ vsg = RARRAY_AREF(a, 2); + } + +- old_to_new(ajd, of, sg, +- &nth, &jd, &df, &sf, &rof, &rsg); +- +- if (!df && f_zero_p(sf) && !rof) { +- set_to_simple(self, &dat->s, nth, jd, rsg, 0, 0, 0, HAVE_JD); +- } else { +- if (!complex_dat_p(dat)) +- rb_raise(rb_eArgError, +- "cannot load complex into simple"); +- +- set_to_complex(self, &dat->c, nth, jd, df, sf, rof, rsg, +- 0, 0, 0, 0, 0, 0, +- HAVE_JD | HAVE_DF | COMPLEX_DAT); +- } ++ old_to_new(ajd, vof, vsg, ++ &nth, &jd, &df, &sf, &of, &sg); + } + break; + case 6: + { +- VALUE nth, sf; +- int jd, df, of; +- double sg; +- + nth = RARRAY_AREF(a, 0); + jd = NUM2INT(RARRAY_AREF(a, 1)); + df = NUM2INT(RARRAY_AREF(a, 2)); + sf = RARRAY_AREF(a, 3); + of = NUM2INT(RARRAY_AREF(a, 4)); + sg = NUM2DBL(RARRAY_AREF(a, 5)); +- if (!df && f_zero_p(sf) && !of) { +- set_to_simple(self, &dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD); +- } else { +- if (!complex_dat_p(dat)) +- rb_raise(rb_eArgError, +- "cannot load complex into simple"); +- +- set_to_complex(self, &dat->c, nth, jd, df, sf, of, sg, +- 0, 0, 0, 0, 0, 0, +- HAVE_JD | HAVE_DF | COMPLEX_DAT); +- } + } + break; + default: +@@ -7175,6 +7329,18 @@ d_lite_marshal_load(VALUE self, VALUE a) + break; + } + ++ if (simple_dat_p(dat)) { ++ if (df || !f_zero_p(sf) || of) { ++ rb_raise(rb_eArgError, ++ "cannot load complex into simple"); ++ } ++ set_to_simple(self, &dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD); ++ } else { ++ set_to_complex(self, &dat->c, nth, jd, df, sf, of, sg, ++ 0, 0, 0, 0, 0, 0, ++ HAVE_JD | HAVE_DF); ++ } ++ + if (FL_TEST(a, FL_EXIVAR)) { + rb_copy_generic_ivar(self, a); + FL_SET(self, FL_EXIVAR); +@@ -7354,10 +7520,21 @@ datetime_s_ordinal(int argc, VALUE *argv, VALUE klass) + */ + static VALUE + datetime_s_civil(int argc, VALUE *argv, VALUE klass) ++{ ++ return datetime_initialize(argc, argv, d_lite_s_alloc_complex(klass)); ++} ++ ++static VALUE ++datetime_initialize(int argc, VALUE *argv, VALUE self) + { + VALUE vy, vm, vd, vh, vmin, vs, vof, vsg, y, fr, fr2, ret; + int m, d, h, min, s, rof; + double sg; ++ struct ComplexDateData *dat = rb_check_typeddata(self, &d_lite_type); ++ ++ if (!complex_dat_p(dat)) { ++ rb_raise(rb_eTypeError, "DateTime expected"); ++ } + + rb_scan_args(argc, argv, "08", &vy, &vm, &vd, &vh, &vmin, &vs, &vof, &vsg); + +@@ -7401,13 +7578,13 @@ datetime_s_civil(int argc, VALUE *argv, VALUE klass) + rb_raise(rb_eArgError, "invalid date"); + canon24oc(); + +- ret = d_complex_new_internal(klass, +- nth, 0, +- 0, INT2FIX(0), +- rof, sg, +- ry, rm, rd, +- rh, rmin, rs, +- HAVE_CIVIL | HAVE_TIME); ++ set_to_complex(self, dat, ++ nth, 0, ++ 0, INT2FIX(0), ++ rof, sg, ++ ry, rm, rd, ++ rh, rmin, rs, ++ HAVE_CIVIL | HAVE_TIME); + } + else { + VALUE nth; +@@ -7426,14 +7603,15 @@ datetime_s_civil(int argc, VALUE *argv, VALUE klass) + time_to_df(rh, rmin, rs), + rof); + +- ret = d_complex_new_internal(klass, +- nth, rjd2, +- 0, INT2FIX(0), +- rof, sg, +- ry, rm, rd, +- rh, rmin, rs, +- HAVE_JD | HAVE_CIVIL | HAVE_TIME); ++ set_to_complex(self, dat, ++ nth, rjd2, ++ 0, INT2FIX(0), ++ rof, sg, ++ ry, rm, rd, ++ rh, rmin, rs, ++ HAVE_JD | HAVE_CIVIL | HAVE_TIME); + } ++ ret = self; + add_frac(); + return ret; + } +@@ -7925,7 +8103,7 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass) + + /* + * call-seq: +- * DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime ++ * DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]], limit: 128) -> datetime + * + * Parses the given representation of date and time, and creates a + * DateTime object. This method does not function as a validator. +@@ -7939,13 +8117,18 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass) + * #=> # + * DateTime.parse('3rd Feb 2001 04:05:06 PM') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_parse(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, comp, sg; ++ VALUE str, comp, sg, opt; + +- rb_scan_args(argc, argv, "03", &str, &comp, &sg); ++ rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -7957,18 +8140,20 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE argv2[2], hash; +- +- argv2[0] = str; +- argv2[1] = comp; +- hash = date_s__parse(2, argv2, klass); ++ int argc2 = 2; ++ VALUE argv2[3]; ++ argv2[0] = str; ++ argv2[1] = comp; ++ argv2[2] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__parse(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime ++ * DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime + * + * Creates a new DateTime object by parsing from a string according to + * some typical ISO 8601 formats. +@@ -7979,13 +8164,18 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass) + * #=> # + * DateTime.iso8601('2001-W05-6T04:05:06+07:00') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_iso8601(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -7995,27 +8185,37 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__iso8601(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2--; ++ VALUE hash = date_s__iso8601(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime ++ * DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime + * + * Creates a new DateTime object by parsing from a string according to + * some typical RFC 3339 formats. + * + * DateTime.rfc3339('2001-02-03T04:05:06+07:00') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -8025,27 +8225,37 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__rfc3339(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__rfc3339(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime ++ * DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime + * + * Creates a new DateTime object by parsing from a string according to + * some typical XML Schema formats. + * + * DateTime.xmlschema('2001-02-03T04:05:06+07:00') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -8055,28 +8265,38 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__xmlschema(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__xmlschema(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime +- * DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> datetime ++ * DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime ++ * DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> datetime + * + * Creates a new DateTime object by parsing from a string according to + * some typical RFC 2822 formats. + * + * DateTime.rfc2822('Sat, 3 Feb 2001 04:05:06 +0700') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -8086,7 +8306,12 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__rfc2822(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__rfc2822(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } +@@ -8100,13 +8325,18 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass) + * + * DateTime.httpdate('Sat, 03 Feb 2001 04:05:06 GMT') + * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_httpdate(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -8116,27 +8346,42 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__httpdate(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__httpdate(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } + + /* + * call-seq: +- * DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> datetime ++ * DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> datetime + * + * Creates a new DateTime object by parsing from a string according to + * some typical JIS X 0301 formats. + * + * DateTime.jisx0301('H13.02.03T04:05:06+07:00') + * #=> # ++ * ++ * For no-era year, legacy format, Heisei is assumed. ++ * ++ * DateTime.jisx0301('13.02.03T04:05:06+07:00') ++ * #=> # ++ * ++ * Raise an ArgumentError when the string length is longer than _limit_. ++ * You can stop this check by passing `limit: nil`, but note that ++ * it may take a long time to parse. + */ + static VALUE + datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass) + { +- VALUE str, sg; ++ VALUE str, sg, opt; + +- rb_scan_args(argc, argv, "02", &str, &sg); ++ rb_scan_args(argc, argv, "02:", &str, &sg, &opt); ++ if (!NIL_P(opt)) argc--; + + switch (argc) { + case 0: +@@ -8146,7 +8391,12 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass) + } + + { +- VALUE hash = date_s__jisx0301(klass, str); ++ int argc2 = 1; ++ VALUE argv2[2]; ++ argv2[0] = str; ++ argv2[1] = opt; ++ if (!NIL_P(opt)) argc2++; ++ VALUE hash = date_s__jisx0301(argc2, argv2, klass); + return dt_new_by_frags(klass, hash, sg); + } + } +@@ -8230,7 +8480,7 @@ dt_lite_to_s(VALUE self) + * + * %M - Minute of the hour (00..59) + * +- * %S - Second of the minute (00..59) ++ * %S - Second of the minute (00..60) + * + * %L - Millisecond of the second (000..999) + * %N - Fractional seconds digits, default is 9 digits (nanosecond) +@@ -8643,7 +8893,7 @@ datetime_to_date(VALUE self) + VALUE new = d_lite_s_alloc_simple(cDate); + { + get_d1b(new); +- copy_complex_to_simple(new, &bdat->s, &adat->c) ++ copy_complex_to_simple(new, &bdat->s, &adat->c); + bdat->s.jd = m_local_jd(adat); + bdat->s.flags &= ~(HAVE_DF | HAVE_TIME | COMPLEX_DAT); + return new; +@@ -9008,14 +9258,18 @@ mk_ary_of_str(long len, const char *a[]) + return o; + } + ++static VALUE ++d_lite_zero(VALUE x) ++{ ++ return INT2FIX(0); ++} ++ + void + Init_date_core(void) + { + #undef rb_intern + #define rb_intern(str) rb_intern_const(str) + +- assert(fprintf(stderr, "assert() is now active\n")); +- + id_cmp = rb_intern("<=>"); + id_le_p = rb_intern("<="); + id_ge_p = rb_intern(">="); +@@ -9231,23 +9485,22 @@ Init_date_core(void) + */ + rb_define_const(cDate, "GREGORIAN", DBL2NUM(GREGORIAN)); + +- rb_define_alloc_func(cDate, d_lite_s_alloc); ++ rb_define_alloc_func(cDate, d_lite_s_alloc_simple); + + #ifndef NDEBUG +-#define de_define_private_method rb_define_private_method +- de_define_private_method(CLASS_OF(cDate), "_valid_jd?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_jd?", + date_s__valid_jd_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_ordinal?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_ordinal?", + date_s__valid_ordinal_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_civil?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_civil?", + date_s__valid_civil_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_date?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_date?", + date_s__valid_civil_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_commercial?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_commercial?", + date_s__valid_commercial_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_weeknum?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_weeknum?", + date_s__valid_weeknum_p, -1); +- de_define_private_method(CLASS_OF(cDate), "_valid_nth_kday?", ++ rb_define_private_method(CLASS_OF(cDate), "_valid_nth_kday?", + date_s__valid_nth_kday_p, -1); + #endif + +@@ -9260,11 +9513,11 @@ Init_date_core(void) + date_s_valid_commercial_p, -1); + + #ifndef NDEBUG +- de_define_private_method(CLASS_OF(cDate), "valid_weeknum?", ++ rb_define_private_method(CLASS_OF(cDate), "valid_weeknum?", + date_s_valid_weeknum_p, -1); +- de_define_private_method(CLASS_OF(cDate), "valid_nth_kday?", ++ rb_define_private_method(CLASS_OF(cDate), "valid_nth_kday?", + date_s_valid_nth_kday_p, -1); +- de_define_private_method(CLASS_OF(cDate), "zone_to_diff", ++ rb_define_private_method(CLASS_OF(cDate), "zone_to_diff", + date_s_zone_to_diff, 1); + #endif + +@@ -9275,21 +9528,18 @@ Init_date_core(void) + date_s_gregorian_leap_p, 1); + + #ifndef NDEBUG +-#define de_define_singleton_method rb_define_singleton_method +-#define de_define_alias rb_define_alias +- de_define_singleton_method(cDate, "new!", date_s_new_bang, -1); +- de_define_alias(rb_singleton_class(cDate), "new_l!", "new"); ++ rb_define_singleton_method(cDate, "new!", date_s_new_bang, -1); ++ rb_define_alias(rb_singleton_class(cDate), "new_l!", "new"); + #endif + + rb_define_singleton_method(cDate, "jd", date_s_jd, -1); + rb_define_singleton_method(cDate, "ordinal", date_s_ordinal, -1); + rb_define_singleton_method(cDate, "civil", date_s_civil, -1); +- rb_define_singleton_method(cDate, "new", date_s_civil, -1); + rb_define_singleton_method(cDate, "commercial", date_s_commercial, -1); + + #ifndef NDEBUG +- de_define_singleton_method(cDate, "weeknum", date_s_weeknum, -1); +- de_define_singleton_method(cDate, "nth_kday", date_s_nth_kday, -1); ++ rb_define_singleton_method(cDate, "weeknum", date_s_weeknum, -1); ++ rb_define_singleton_method(cDate, "nth_kday", date_s_nth_kday, -1); + #endif + + rb_define_singleton_method(cDate, "today", date_s_today, -1); +@@ -9297,29 +9547,26 @@ Init_date_core(void) + rb_define_singleton_method(cDate, "strptime", date_s_strptime, -1); + rb_define_singleton_method(cDate, "_parse", date_s__parse, -1); + rb_define_singleton_method(cDate, "parse", date_s_parse, -1); +- rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, 1); ++ rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, -1); + rb_define_singleton_method(cDate, "iso8601", date_s_iso8601, -1); +- rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, 1); ++ rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, -1); + rb_define_singleton_method(cDate, "rfc3339", date_s_rfc3339, -1); +- rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, 1); ++ rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, -1); + rb_define_singleton_method(cDate, "xmlschema", date_s_xmlschema, -1); +- rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, 1); +- rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, 1); ++ rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, -1); ++ rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, -1); + rb_define_singleton_method(cDate, "rfc2822", date_s_rfc2822, -1); + rb_define_singleton_method(cDate, "rfc822", date_s_rfc2822, -1); +- rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, 1); ++ rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, -1); + rb_define_singleton_method(cDate, "httpdate", date_s_httpdate, -1); +- rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, 1); ++ rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, -1); + rb_define_singleton_method(cDate, "jisx0301", date_s_jisx0301, -1); + +-#ifndef NDEBUG +-#define de_define_method rb_define_method +- de_define_method(cDate, "initialize", d_lite_initialize, -1); +-#endif ++ rb_define_method(cDate, "initialize", date_initialize, -1); + rb_define_method(cDate, "initialize_copy", d_lite_initialize_copy, 1); + + #ifndef NDEBUG +- de_define_method(cDate, "fill", d_lite_fill, 0); ++ rb_define_method(cDate, "fill", d_lite_fill, 0); + #endif + + rb_define_method(cDate, "ajd", d_lite_ajd, 0); +@@ -9341,8 +9588,8 @@ Init_date_core(void) + rb_define_method(cDate, "cwday", d_lite_cwday, 0); + + #ifndef NDEBUG +- de_define_private_method(cDate, "wnum0", d_lite_wnum0, 0); +- de_define_private_method(cDate, "wnum1", d_lite_wnum1, 0); ++ rb_define_private_method(cDate, "wnum0", d_lite_wnum0, 0); ++ rb_define_private_method(cDate, "wnum1", d_lite_wnum1, 0); + #endif + + rb_define_method(cDate, "wday", d_lite_wday, 0); +@@ -9356,18 +9603,14 @@ Init_date_core(void) + rb_define_method(cDate, "saturday?", d_lite_saturday_p, 0); + + #ifndef NDEBUG +- de_define_method(cDate, "nth_kday?", d_lite_nth_kday_p, 2); ++ rb_define_method(cDate, "nth_kday?", d_lite_nth_kday_p, 2); + #endif + +- rb_define_private_method(cDate, "hour", d_lite_hour, 0); +- rb_define_private_method(cDate, "min", d_lite_min, 0); +- rb_define_private_method(cDate, "minute", d_lite_min, 0); +- rb_define_private_method(cDate, "sec", d_lite_sec, 0); +- rb_define_private_method(cDate, "second", d_lite_sec, 0); +- rb_define_private_method(cDate, "sec_fraction", d_lite_sec_fraction, 0); +- rb_define_private_method(cDate, "second_fraction", d_lite_sec_fraction, 0); +- rb_define_private_method(cDate, "offset", d_lite_offset, 0); +- rb_define_private_method(cDate, "zone", d_lite_zone, 0); ++ rb_define_private_method(cDate, "hour", d_lite_zero, 0); ++ rb_define_private_method(cDate, "min", d_lite_zero, 0); ++ rb_define_private_method(cDate, "minute", d_lite_zero, 0); ++ rb_define_private_method(cDate, "sec", d_lite_zero, 0); ++ rb_define_private_method(cDate, "second", d_lite_zero, 0); + + rb_define_method(cDate, "julian?", d_lite_julian_p, 0); + rb_define_method(cDate, "gregorian?", d_lite_gregorian_p, 0); +@@ -9380,8 +9623,6 @@ Init_date_core(void) + rb_define_method(cDate, "julian", d_lite_julian, 0); + rb_define_method(cDate, "gregorian", d_lite_gregorian, 0); + +- rb_define_private_method(cDate, "new_offset", d_lite_new_offset, -1); +- + rb_define_method(cDate, "+", d_lite_plus, 1); + rb_define_method(cDate, "-", d_lite_minus, 1); + +@@ -9409,7 +9650,7 @@ Init_date_core(void) + + rb_define_method(cDate, "to_s", d_lite_to_s, 0); + #ifndef NDEBUG +- de_define_method(cDate, "inspect_raw", d_lite_inspect_raw, 0); ++ rb_define_method(cDate, "inspect_raw", d_lite_inspect_raw, 0); + #endif + rb_define_method(cDate, "inspect", d_lite_inspect, 0); + +@@ -9426,7 +9667,7 @@ Init_date_core(void) + rb_define_method(cDate, "jisx0301", d_lite_jisx0301, 0); + + #ifndef NDEBUG +- de_define_method(cDate, "marshal_dump_old", d_lite_marshal_dump_old, 0); ++ rb_define_method(cDate, "marshal_dump_old", d_lite_marshal_dump_old, 0); + #endif + rb_define_method(cDate, "marshal_dump", d_lite_marshal_dump, 0); + rb_define_method(cDate, "marshal_load", d_lite_marshal_load, 1); +@@ -9573,6 +9814,7 @@ Init_date_core(void) + */ + + cDateTime = rb_define_class("DateTime", cDate); ++ rb_define_alloc_func(cDateTime, d_lite_s_alloc_complex); + + rb_define_singleton_method(cDateTime, "jd", datetime_s_jd, -1); + rb_define_singleton_method(cDateTime, "ordinal", datetime_s_ordinal, -1); +@@ -9582,9 +9824,9 @@ Init_date_core(void) + datetime_s_commercial, -1); + + #ifndef NDEBUG +- de_define_singleton_method(cDateTime, "weeknum", ++ rb_define_singleton_method(cDateTime, "weeknum", + datetime_s_weeknum, -1); +- de_define_singleton_method(cDateTime, "nth_kday", ++ rb_define_singleton_method(cDateTime, "nth_kday", + datetime_s_nth_kday, -1); + #endif + +@@ -9612,19 +9854,16 @@ Init_date_core(void) + rb_define_singleton_method(cDateTime, "jisx0301", + datetime_s_jisx0301, -1); + +-#define f_public(m,s) rb_funcall(m, rb_intern("public"), 1,\ +- ID2SYM(rb_intern(s))) +- +- f_public(cDateTime, "hour"); +- f_public(cDateTime, "min"); +- f_public(cDateTime, "minute"); +- f_public(cDateTime, "sec"); +- f_public(cDateTime, "second"); +- f_public(cDateTime, "sec_fraction"); +- f_public(cDateTime, "second_fraction"); +- f_public(cDateTime, "offset"); +- f_public(cDateTime, "zone"); +- f_public(cDateTime, "new_offset"); ++ rb_define_method(cDateTime, "hour", d_lite_hour, 0); ++ rb_define_method(cDateTime, "min", d_lite_min, 0); ++ rb_define_method(cDateTime, "minute", d_lite_min, 0); ++ rb_define_method(cDateTime, "sec", d_lite_sec, 0); ++ rb_define_method(cDateTime, "second", d_lite_sec, 0); ++ rb_define_method(cDateTime, "sec_fraction", d_lite_sec_fraction, 0); ++ rb_define_method(cDateTime, "second_fraction", d_lite_sec_fraction, 0); ++ rb_define_method(cDateTime, "offset", d_lite_offset, 0); ++ rb_define_method(cDateTime, "zone", d_lite_zone, 0); ++ rb_define_method(cDateTime, "new_offset", d_lite_new_offset, -1); + + rb_define_method(cDateTime, "to_s", dt_lite_to_s, 0); + +@@ -9652,15 +9891,15 @@ Init_date_core(void) + #ifndef NDEBUG + /* tests */ + +- de_define_singleton_method(cDate, "test_civil", date_s_test_civil, 0); +- de_define_singleton_method(cDate, "test_ordinal", date_s_test_ordinal, 0); +- de_define_singleton_method(cDate, "test_commercial", ++ rb_define_singleton_method(cDate, "test_civil", date_s_test_civil, 0); ++ rb_define_singleton_method(cDate, "test_ordinal", date_s_test_ordinal, 0); ++ rb_define_singleton_method(cDate, "test_commercial", + date_s_test_commercial, 0); +- de_define_singleton_method(cDate, "test_weeknum", date_s_test_weeknum, 0); +- de_define_singleton_method(cDate, "test_nth_kday", date_s_test_nth_kday, 0); +- de_define_singleton_method(cDate, "test_unit_conv", ++ rb_define_singleton_method(cDate, "test_weeknum", date_s_test_weeknum, 0); ++ rb_define_singleton_method(cDate, "test_nth_kday", date_s_test_nth_kday, 0); ++ rb_define_singleton_method(cDate, "test_unit_conv", + date_s_test_unit_conv, 0); +- de_define_singleton_method(cDate, "test_all", date_s_test_all, 0); ++ rb_define_singleton_method(cDate, "test_all", date_s_test_all, 0); + #endif + } + +diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c +index b74230d291..f06c07bae4 100644 +--- a/ext/date/date_parse.c ++++ b/ext/date/date_parse.c +@@ -40,9 +40,9 @@ RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int bas + #define f_sub_bang(s,r,x) rb_funcall(s, rb_intern("sub!"), 2, r, x) + #define f_gsub_bang(s,r,x) rb_funcall(s, rb_intern("gsub!"), 2, r, x) + +-#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k)), v) +-#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k))) +-#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k))) ++#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k"")), v) ++#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k""))) ++#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k""))) + + #define cstr2num(s) rb_cstr_to_inum(s, 10, 0) + #define str2num(s) rb_str_to_inum(s, 10, 0) +@@ -66,7 +66,13 @@ static const char abbr_months[][4] = { + #define asubt_string() rb_str_new("\024", 1) + #endif + +-#define DECDIGIT "0123456789" ++static size_t ++digit_span(const char *s, const char *e) ++{ ++ size_t i = 0; ++ while (s + i < e && isdigit(s[i])) i++; ++ return i; ++} + + static void + s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) +@@ -92,7 +98,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + y = d; + d = Qnil; + } +- if (!NIL_P(d) && *RSTRING_PTR(d) == '\'') { ++ if (!NIL_P(d) && RSTRING_LEN(d) > 0 && *RSTRING_PTR(d) == '\'') { + y = d; + d = Qnil; + } +@@ -103,17 +109,20 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + size_t l; + + s = RSTRING_PTR(y); +- while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s)) ++ ep = RSTRING_END(y); ++ while (s < ep && !issign(*s) && !isdigit(*s)) + s++; ++ if (s >= ep) goto no_date; + bp = s; + if (issign((unsigned char)*s)) + s++; +- l = strspn(s, DECDIGIT); ++ l = digit_span(s, ep); + ep = s + l; + if (*ep) { + y = d; + d = rb_str_new(bp, ep - bp); + } ++ no_date:; + } + + if (!NIL_P(m)) { +@@ -152,8 +161,10 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + VALUE iy; + + s = RSTRING_PTR(y); +- while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s)) ++ ep = RSTRING_END(y); ++ while (s < ep && !issign(*s) && !isdigit(*s)) + s++; ++ if (s >= ep) goto no_year; + bp = s; + if (issign(*s)) { + s++; +@@ -161,7 +172,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + } + if (sign) + c = Qfalse; +- l = strspn(s, DECDIGIT); ++ l = digit_span(s, ep); + ep = s + l; + if (l > 2) + c = Qfalse; +@@ -175,6 +186,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + ALLOCV_END(vbuf); + } + set_hash("year", iy); ++ no_year:; + } + + if (bc) +@@ -186,10 +198,12 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + VALUE im; + + s = RSTRING_PTR(m); +- while (!isdigit((unsigned char)*s)) ++ ep = RSTRING_END(m); ++ while (s < ep && !isdigit(*s)) + s++; ++ if (s >= ep) goto no_month; + bp = s; +- l = strspn(s, DECDIGIT); ++ l = digit_span(s, ep); + ep = s + l; + { + char *buf; +@@ -201,6 +215,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + ALLOCV_END(vbuf); + } + set_hash("mon", im); ++ no_month:; + } + + if (!NIL_P(d)) { +@@ -209,10 +224,12 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + VALUE id; + + s = RSTRING_PTR(d); +- while (!isdigit((unsigned char)*s)) ++ ep = RSTRING_END(d); ++ while (s < ep && !isdigit(*s)) + s++; ++ if (s >= ep) goto no_mday; + bp = s; +- l = strspn(s, DECDIGIT); ++ l = digit_span(s, ep); + ep = s + l; + { + char *buf; +@@ -224,6 +241,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) + ALLOCV_END(vbuf); + } + set_hash("mday", id); ++ no_mday:; + } + + if (!NIL_P(c)) +@@ -263,18 +281,18 @@ regcomp(const char *source, long len, int opt) + } + + #define REGCOMP(pat,opt) \ +-{ \ ++do { \ + if (NIL_P(pat)) \ + pat = regcomp(pat##_source, sizeof pat##_source - 1, opt); \ +-} ++} while (0) + + #define REGCOMP_0(pat) REGCOMP(pat, 0) + #define REGCOMP_I(pat) REGCOMP(pat, ONIG_OPTION_IGNORECASE) + + #define MATCH(s,p,c) \ +-{ \ ++do { \ + return match(s, p, hash, c); \ +-} ++} while (0) + + static int + match(VALUE str, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE)) +@@ -314,30 +332,30 @@ subx(VALUE str, VALUE rep, VALUE pat, VALUE hash, int (*cb)(VALUE, VALUE)) + } + + #define SUBS(s,p,c) \ +-{ \ ++do { \ + return subx(s, asp_string(), p, hash, c); \ +-} ++} while (0) + + #ifdef TIGHT_PARSER + #define SUBA(s,p,c) \ +-{ \ ++do { \ + return subx(s, asuba_string(), p, hash, c); \ +-} ++} while (0) + + #define SUBB(s,p,c) \ +-{ \ ++do { \ + return subx(s, asubb_string(), p, hash, c); \ +-} ++} while (0) + + #define SUBW(s,p,c) \ +-{ \ ++do { \ + return subx(s, asubw_string(), p, hash, c); \ +-} ++} while (0) + + #define SUBT(s,p,c) \ +-{ \ ++do { \ + return subx(s, asubt_string(), p, hash, c); \ +-} ++} while (0) + #endif + + #include "zonetab.h" +@@ -706,16 +724,14 @@ parse_era(VALUE str, VALUE hash) + static int + check_year_width(VALUE y) + { +- char *s; +- size_t l; ++ const char *s; ++ long l; + ++ l = RSTRING_LEN(y); ++ if (l < 2) return 0; + s = RSTRING_PTR(y); +- l = strcspn(s, DECDIGIT); +- s += l; +- l = strspn(s, DECDIGIT); +- if (l != 2) +- return 0; +- return 1; ++ if (!isdigit(s[1])) return 0; ++ return (l == 2 || !isdigit(s[2])); + } + + static int +@@ -1196,6 +1212,9 @@ parse_iso2(VALUE str, VALUE hash) + return 1; + } + ++#define JISX0301_ERA_INITIALS "mtshr" ++#define JISX0301_DEFAULT_ERA 'H' /* obsolete */ ++ + static int + gengo(int c) + { +@@ -1206,6 +1225,7 @@ gengo(int c) + case 'T': case 't': e = 1911; break; + case 'S': case 's': e = 1925; break; + case 'H': case 'h': e = 1988; break; ++ case 'R': case 'r': e = 2018; break; + default: e = 0; break; + } + return e; +@@ -1236,11 +1256,11 @@ parse_jis(VALUE str, VALUE hash) + { + static const char pat_source[] = + #ifndef TIGHT_PARSER +- "\\b([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)" ++ "\\b([" JISX0301_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)" + #else + BOS + FPW_COM FPT_COM +- "([mtsh])(\\d+)\\.(\\d+)\\.(\\d+)" ++ "([" JISX0301_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)" + TEE_FPT COM_FPW + EOS + #endif +@@ -2938,7 +2958,7 @@ jisx0301_cb(VALUE m, VALUE hash) + s[i] = rb_reg_nth_match(i, m); + } + +- ep = gengo(NIL_P(s[1]) ? 'h' : *RSTRING_PTR(s[1])); ++ ep = gengo(NIL_P(s[1]) ? JISX0301_DEFAULT_ERA : *RSTRING_PTR(s[1])); + set_hash("year", f_add(str2num(s[2]), INT2FIX(ep))); + set_hash("mon", str2num(s[3])); + set_hash("mday", str2num(s[4])); +@@ -2963,7 +2983,7 @@ static int + jisx0301(VALUE str, VALUE hash) + { + static const char pat_source[] = +- "\\A\\s*([mtsh])?(\\d{2})\\.(\\d{2})\\.(\\d{2})" ++ "\\A\\s*([" JISX0301_ERA_INITIALS "])?(\\d{2})\\.(\\d{2})\\.(\\d{2})" + "(?:t" + "(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d*))?)?" + "(z|[-+]\\d{2}(?::?\\d{2})?)?)?)?\\s*\\z"; +diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c +index 4f93219317..4383eb6fa1 100644 +--- a/ext/date/date_strptime.c ++++ b/ext/date/date_strptime.c +@@ -79,14 +79,17 @@ read_digits(const char *s, VALUE *n, size_t width) + { + size_t l; + +- l = strspn(s, "0123456789"); ++ if (!width) ++ return 0; ++ ++ l = 0; ++ while (ISDIGIT(s[l])) { ++ if (++l == width) break; ++ } + + if (l == 0) + return 0; + +- if (width < l) +- l = width; +- + if ((4 * l * sizeof(char)) <= (sizeof(long)*CHAR_BIT)) { + const char *os = s; + long v; +@@ -113,26 +116,26 @@ read_digits(const char *s, VALUE *n, size_t width) + } + } + +-#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k)), v) +-#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k))) +-#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k))) ++#define set_hash(k,v) rb_hash_aset(hash, ID2SYM(rb_intern(k"")), v) ++#define ref_hash(k) rb_hash_aref(hash, ID2SYM(rb_intern(k""))) ++#define del_hash(k) rb_hash_delete(hash, ID2SYM(rb_intern(k""))) + + #define fail() \ +-{ \ ++do { \ + set_hash("_fail", Qtrue); \ + return 0; \ +-} ++} while (0) + + #define fail_p() (!NIL_P(ref_hash("_fail"))) + + #define READ_DIGITS(n,w) \ +-{ \ ++do { \ + size_t l; \ + l = read_digits(&str[si], &n, w); \ + if (l == 0) \ + fail(); \ + si += l; \ +-} ++} while (0) + + #define READ_DIGITS_MAX(n) READ_DIGITS(n, LONG_MAX) + +@@ -147,14 +150,14 @@ valid_range_p(VALUE v, int a, int b) + } + + #define recur(fmt) \ +-{ \ ++do { \ + size_t l; \ + l = date__strptime_internal(&str[si], slen - si, \ + fmt, sizeof fmt - 1, hash); \ + if (fail_p()) \ + return 0; \ + si += l; \ +-} ++} while (0) + + VALUE date_zone_to_diff(VALUE); + +@@ -237,9 +240,9 @@ date__strptime_internal(const char *str, size_t slen, + VALUE n; + + if (NUM_PATTERN_P()) +- READ_DIGITS(n, 2) ++ READ_DIGITS(n, 2); + else +- READ_DIGITS_MAX(n) ++ READ_DIGITS_MAX(n); + set_hash("_cent", n); + goto matched; + } +@@ -278,9 +281,9 @@ date__strptime_internal(const char *str, size_t slen, + VALUE n; + + if (NUM_PATTERN_P()) +- READ_DIGITS(n, 4) ++ READ_DIGITS(n, 4); + else +- READ_DIGITS_MAX(n) ++ READ_DIGITS_MAX(n); + set_hash("cwyear", n); + goto matched; + } +@@ -358,9 +361,9 @@ date__strptime_internal(const char *str, size_t slen, + } + osi = si; + if (NUM_PATTERN_P()) +- READ_DIGITS(n, c == 'L' ? 3 : 9) ++ READ_DIGITS(n, c == 'L' ? 3 : 9); + else +- READ_DIGITS_MAX(n) ++ READ_DIGITS_MAX(n); + if (sign == -1) + n = f_negate(n); + set_hash("sec_fraction", +@@ -426,9 +429,7 @@ date__strptime_internal(const char *str, size_t slen, + if (sign == -1) + n = f_negate(n); + set_hash("seconds", +- rb_rational_new2(n, +- f_expt(INT2FIX(10), +- INT2FIX(3)))); ++ rb_rational_new2(n, INT2FIX(1000))); + goto matched; + } + +@@ -529,24 +530,24 @@ date__strptime_internal(const char *str, size_t slen, + goto matched; + + case 'Y': +- { +- VALUE n; +- int sign = 1; +- +- if (issign(str[si])) { +- if (str[si] == '-') +- sign = -1; +- si++; +- } +- if (NUM_PATTERN_P()) +- READ_DIGITS(n, 4) +- else +- READ_DIGITS_MAX(n) ++ { ++ VALUE n; ++ int sign = 1; ++ ++ if (issign(str[si])) { ++ if (str[si] == '-') ++ sign = -1; ++ si++; ++ } ++ if (NUM_PATTERN_P()) ++ READ_DIGITS(n, 4); ++ else ++ READ_DIGITS_MAX(n); + if (sign == -1) + n = f_negate(n); +- set_hash("year", n); +- goto matched; +- } ++ set_hash("year", n); ++ goto matched; ++ } + + case 'y': + { +diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec +index 1256162468..99e18bda9a 100644 +--- a/ext/io/console/io-console.gemspec ++++ b/ext/io/console/io-console.gemspec +@@ -5,7 +5,7 @@ + Gem::Specification.new do |s| + s.name = "io-console" + s.version = _VERSION +- s.date = date ++ s.date = RUBY_RELEASE_DATE + s.summary = "Console interface" + s.email = "nobu@ruby-lang.org" + s.description = "add console capabilities to IO instances." +diff --git a/gc.c b/gc.c +index c02ac627f0..fc303879eb 100644 +--- a/gc.c ++++ b/gc.c +@@ -47,7 +47,9 @@ + # endif + #endif + #ifdef HAVE_MALLOC_USABLE_SIZE +-# ifdef HAVE_MALLOC_H ++# ifdef RUBY_ALTERNATIVE_MALLOC_HEADER ++# include RUBY_ALTERNATIVE_MALLOC_HEADER ++# elif HAVE_MALLOC_H + # include + # elif defined(HAVE_MALLOC_NP_H) + # include +@@ -975,6 +977,31 @@ tick(void) + return val; + } + ++#elif defined(__powerpc64__) && \ ++ ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) ++typedef unsigned long long tick_t; ++#define PRItick "llu" ++ ++static __inline__ tick_t ++tick(void) ++{ ++ unsigned long long val = __builtin_ppc_get_timebase(); ++ return val; ++} ++ ++#elif defined(__aarch64__) && defined(__GNUC__) ++typedef unsigned long tick_t; ++#define PRItick "lu" ++ ++static __inline__ tick_t ++tick(void) ++{ ++ unsigned long val; ++ __asm__ __volatile__ ("mrs %0, cntvct_el0", : "=r" (val)); ++ return val; ++} ++ ++ + #elif defined(_WIN32) && defined(_MSC_VER) + #include + typedef unsigned __int64 tick_t; +diff --git a/gc.h b/gc.h +index 2c91e06620..0f8a56f94d 100644 +--- a/gc.h ++++ b/gc.h +@@ -6,6 +6,8 @@ + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p))) + #elif defined(__i386) && defined(__GNUC__) + #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p))) ++#elif defined(__aarch64__) && defined(__GNUC__) ++#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("mov\t%0, sp" : "=r" (*(p))) + #else + NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p)); + #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p) +diff --git a/include/ruby/defines.h b/include/ruby/defines.h +index 2c72a7cb8a..85f3bda3c1 100644 +--- a/include/ruby/defines.h ++++ b/include/ruby/defines.h +@@ -358,7 +358,7 @@ void rb_ia64_flushrs(void); + #ifndef UNALIGNED_WORD_ACCESS + # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ + defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \ +- defined(__powerpc64__) || \ ++ defined(__powerpc64__) || defined(__aarch64__) || \ + defined(__mc68020__) + # define UNALIGNED_WORD_ACCESS 1 + # else +diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb +index a2155edb77..4410f3174f 100644 +--- a/lib/cgi/cookie.rb ++++ b/lib/cgi/cookie.rb +@@ -40,6 +40,10 @@ class CGI + class Cookie < Array + @@accept_charset="UTF-8" unless defined?(@@accept_charset) + ++ TOKEN_RE = %r"\A[[!-~]&&[^()<>@,;:\\\"/?=\[\]{}]]+\z" ++ PATH_VALUE_RE = %r"\A[[ -~]&&[^;]]*\z" ++ DOMAIN_VALUE_RE = %r"\A\.?(?