Граф коммитов

9326 Коммитов

Автор SHA1 Сообщение Дата
rhe 0a97832e6a openssl: add some accessor methods for OCSP::CertificateId
* ext/openssl/ossl_ocsp.c (ossl_ocspcid_get_issuer_name_hash,
  ossl_ocspcid_get_issuer_key_hash, ossl_ocspcid_get_hash_algorithm):
  Add accessor methods OCSP::CertificateId#issuer_name_hash,
  #issuer_key_hash, #hash_algorithm.
  Based on a patch provided by Paul Kehrer <paul.l.kehrer@gmail.com>.
  [ruby-core:48062] [Feature #7181]

* test/openssl/test_ocsp.rb: Test these new methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:12:20 +00:00
nobu 58e8c9c895 date_strftime.c: check precision
* ext/date/date_strftime.c (date_strftime_with_tmx): reject too
  large precision to get rid of buffer overflow.
  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 13:07:27 +00:00
rhe 40799e5ef9 openssl: add missing #to_der to OCSP::{CertificateId,BasicResponse}
* ext/openssl/ossl_ocsp.c (ossl_ocspbres_to_der, ossl_ocspcid_to_der):
  Implement #to_der methods for OCSP::BasicResponse and
  OCSP::CertificateId.

  (ossl_ocspreq_initialize, ossl_ocspres_initialize): Use GetOCSP*()
  instead of raw DATA_PTR().

  (ossl_ocspbres_initialize, ossl_ocspcid_initialize): Allow
  initializing from DER string.

  (Init_ossl_ocsp): Define new #to_der methods.

* test/openssl/test_ocsp.rb: Test these changes. Also add missing tests
  for OCSP::{Response,Request}#to_der.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 12:40:55 +00:00
naruse 6965be6896 fix test of r55397
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 12:46:44 +00:00
nobu 75a68057c7 parse.y: no named capture conflict warnings
* parse.y (reg_named_capture_assign_iter): remove named capture
  conflict warnings.  it is just annoying rather than useful.
  [ruby-core:75416] [Bug #12359]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 11:50:09 +00:00
mrkn 9042cf217e numeric.c: Add Integer#digits [Feature #12447] [ruby-core:75799]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 11:43:54 +00:00
duerst 86e9f85553 * test/ruby/enc/test_case_comprehensive.rb: Add tests for full Unicode
swapcase.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-13 07:58:57 +00:00
nobu f54490251a dump to stdout
* test/objspace/test_objspace.rb (test_dump_all): dump to stdout
  instead of a string, get rid of hung up.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 14:20:50 +00:00
nobu 58edb064c3 File.expand_path compose test only on OS X
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  valid only on OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 09:45:09 +00:00
duerst 60095cecc7 * test/ruby/enc/test_case_comprehensive.rb: Add tests for ASCII-only
swapcase; store calculated values in hashes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 05:48:04 +00:00
rhe aefb79c24f openssl: avoid test failure in test_engine.rb
* test/openssl/test_engine.rb (test_openssl_engine_builtin,
  test_openssl_engine_by_id_string): Skip test if 'openssl' engine is
  already loaded. And test the number increased by Engine.load{_by_id,},
  not the total count of loaded engines. Previously, we called
  OpenSSL::Engine.cleanup every time running a test case, but we no
  longer can do it.
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 04:48:10 +00:00
nobu 797f2eda58 file.c: normalize cwd
* file.c (append_fspath): normalize directory name to be appended
  on OS X.  [ruby-core:75957] [Ruby trunk Bug#12483]
  https://github.com/rails/rails/issues/25303#issuecomment-224834804

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-12 00:24:36 +00:00
nobu cfb2b14ddc ObjectSpace.dump_all: valid JSON
* ext/objspace/objspace_dump.c: generate valid JSON for dump_all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 05:04:22 +00:00
duerst 02f7ad6237 * enc/iso_8859_1.c: Implement non-ASCII case mapping.
* test/ruby/enc/test_case_comprehensive.rb: Tests for above.
* string.c: Add iso-8859-1 to supported encodings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 00:46:21 +00:00
nobu e8700ab03d forwardable.rb: backtrace
* lib/forwardable.rb (_delegator_method): leave the backtrace
  untouched during accessor.  forwardable.rb does not appear in
  the backtrace during delegated method because of tail-call
  optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-11 00:31:30 +00:00
nobu 094a3b1162 test_forwardable.rb: operators
* test/test_forwardable.rb: add tests for operators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 16:01:25 +00:00
nobu b661824e75 forwardable.rb: fix for non-module objects
* lib/forwardable.rb (Forwardable._delegator_method): extract
  method generator and deal with non-module objects.
  [ruby-dev:49656] [Bug #12478]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 12:54:25 +00:00
nobu 2667d1b38f hash.c: ensure NUL-terminated for ENV
* hash.c (get_env_cstr): ensure NUL-terminated.
  [ruby-dev:49655] [Bug #12475]
* string.c (rb_str_fill_terminator): return the pointer to the
  NUL-terminated content.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-10 05:48:38 +00:00
rhe f9843bc4dc openssl: use ASN1_ENUMERATED_to_BN() if needed
* ext/openssl/ossl_asn1.c (asn1integer_to_num): Use
  ASN1_ENUMERATED_to_BN() to convert an ASN1_ENUMERATED to a BN.
  Starting from OpenSSL 1.1.0, ASN1_INTEGER_to_BN() rejects
  non-ASN1_INTEGER objects. The format of INTEGER and ENUMERATED are
  almost identical so they behaved in the same way in OpenSSL <= 1.0.2.
  [ruby-core:75225] [Feature #12324]

* test/openssl/test_asn1.rb (test_decode_enumerated): Test that it
  works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-09 12:42:08 +00:00
rhe dd05607f9a openssl: fix build with OPENSSL_NO_EC
* ext/openssl/ossl_ssl.c: Add define guards for OPENSSL_NO_EC.
  SSL_CTX_set_ecdh_auto() is defined even when ECDH is disabled in
  OpenSSL's configuration. This fixes r55214.

* test/openssl/test_pair.rb (test_ecdh_curves): Skip if the OpenSSL does
  not support ECDH.

* test/openssl/utils.rb (start_server): Ignore error in
  SSLContext#ecdh_curves=.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-09 10:46:46 +00:00
shugo 0827a7e52b * lib/net/smtp.rb (getok, get_response): raise an ArgumentError when
CR or LF is included in a line, because they are not allowed in
RFC5321.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 07:06:57 +00:00
nobu 9a4a04fe15 test_proc.rb: test_lambda?
* test/ruby/test_proc.rb (test_lambda?): lambda-ness should be
  preserved across proc, lambda, and Proc.new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-08 02:08:00 +00:00
rhe b90516659f rubygems: regenerate server certificates used in tests
* test/rubygems/*_{cert,cert_32}.pem: Regenerate test certificates for
  OpenSSL 1.1.0. This is already in upstream.
  9be5c53939
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:37 +00:00
svn 3cb56e8e3a * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:37 +00:00
rhe 06552d56d1 open-uri: regenerate server certificates used in tests
* test/open-uri/test_ssl.rb: Regenerate test certificates. The test CA
  certificate was incorrectly generated. A CA certificate must have the
  basic constraints extension with cA bit set to TRUE. OpenSSL <= 1.0.2
  allowed the error when the certificate is in the trusted store but
  OpenSSL 1.1.0 no longer does.
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:29:36 +00:00
rhe b257af8859 openssl: adjust tests for OpenSSL 1.1.0
This fixes `make test-all TESTS=openssl` with OpenSSL master.

* test/openssl/test_x509name.rb: Don't register OID for 'emailAddress'
  and 'serialNumber'. A recent change in OpenSSL made OBJ_create()
  reject an already existing OID. They were needed to run tests with
  OpenSSL 0.9.6 which is now unsupported.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=52832e470f5fe8c222249ae5b539aeb3c74cdb25
  [ruby-core:75225] [Feature #12324]

* test/openssl/test_ssl_session.rb (test_server_session): Duplicate
  SSL::Session before re-adding to the session store. OpenSSL 1.1.0
  starts rejecting SSL_SESSION once removed by SSL_CTX_remove_session().
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=7c2d4fee2547650102cd16d23f8125b76112ae75

* test/openssl/test_pkey_ec.rb (setup): Remove X25519 from @keys. X25519
  is new in OpenSSL 1.1.0 but this is for key agreement and not for
  signing.

* test/openssl/test_pair.rb, test/openssl/test_ssl.rb,
  test/openssl/utils.rb: Set security level to 0 when using aNULL cipher
  suites.

* test/openssl/utils.rb: Use 1024 bits DSA key for client certificates.

* test/openssl/test_engine.rb: Run each test in separate process.
  We can no longer cleanup engines explicitly as ENGINE_cleanup() was
  removed.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=6d4fb1d59e61aacefa25edc4fe5acfe1ac93f743

* ext/openssl/ossl_engine.c (ossl_engine_s_cleanup): Add a note to the
  RDoc for Engine.cleanup.

* ext/openssl/lib/openssl/digest.rb: Don't define constants for DSS,
  DSS1 and SHA(-0) when using with OpenSSL 1.1.0. They are removed.

* test/openssl/test_digest.rb, test/openssl/test_pkey_dsa.rb,
  test/openssl/test_pkey_dsa.rb, test/openssl/test_ssl.rb,
  test/openssl/test_x509cert.rb, test/openssl/test_x509req.rb: Don't
  test unsupported hash functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 12:20:46 +00:00
nobu 52ccfbcdd3 test_syntax.rb: formal argument name tests
* test/ruby/test_syntax.rb: add invalid formal argument name
  tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 08:57:36 +00:00
duerst 768b130238 * test/ruby/enc/test_case_comprehensive: Change test for encodings
without any non-ASCII case conversions from ASCII-only test
  to full test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 08:49:55 +00:00
rhe 1f5784ecaf openssl: add SSL::SSLContext#security_level{=,}
* ext/openssl/extconf.rb: Check for SSL_CTX_get_security_level().
  OpenSSL 1.1.0 introduced "security level".
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_ssl.c (ossl_sslctx_{get,set}_security_level): Add
  SSLContext#security_level and #security_level=.

* test/openssl/test_ssl.rb (test_security_level): Add test. ...but this
  doesn't actually test it. Because #security_level= is necessary in
  order to run other tests on OpenSSL 1.1.0, go without tests for now.
  Will fix after converting SSLContext#key= and #cert= to normal methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 07:52:24 +00:00
duerst 1b98612090 * test/ruby/enc/test_case_comprehensive: Add regression tests for
current ASCII-only case conversion.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 07:13:39 +00:00
duerst b5baea5f87 * test/ruby/enc/test_case_comprehensive: Fix method name
(generate_casefold_tests -> generate_case_mapping_tests).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-07 06:28:47 +00:00
nobu 65ac4a5602 vm_insnhelper.c: check symbol proc to throw
* vm_insnhelper.c (vm_throw_start): check if the iseq is symbol
  proc, class definition should not be a symbol proc.
  [ruby-core:75856] [Bug #12462]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 09:37:59 +00:00
duerst ab5f23f26c * string.c: Added UTF-16BE/LE and UTF-32BE/LE to supported encodings
for Unicode case mapping.
* test/ruby/enc/test_case_comprehensive.rb: Tests for above
  functionality; fixed an encoding issue in assertion error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 09:36:36 +00:00
duerst a4ccbb63cd * test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small
encodings by preselecting codepoints.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 08:29:38 +00:00
duerst b09795d803 * test/ruby/enc/test_case_mapping.rb:
Remove :lithuanian guard for Unicode case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 04:16:49 +00:00
nobu 2e71c75278 Thread.report_on_exception
* thread.c (thread_start_func_2): report raised exception if
  report_on_exception flag is set.  [Feature #6647]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-06 00:25:38 +00:00
rhe 0a523ab20d openssl: adapt to OpenSSL 1.1.0 opaque structs
* ext/openssl/extconf.rb: Check existence of accessor functions that
  don't exist in OpenSSL 0.9.8. OpenSSL 1.1.0 made most of its
  structures opaque and requires use of these accessor functions.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/openssl_missing.[ch]: Implement them if missing.

* ext/openssl/ossl*.c: Use these accessor functions.

* test/openssl/test_hmac.rb: Add missing test for HMAC#reset.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:35:12 +00:00
rhe 63abe00785 openssl: adapt OpenSSL::PKey to OpenSSL 1.1.0 opaque structs
* ext/openssl/openssl_missing.[ch]: Implement EVP_PKEY_get0_*() and
  {RSA,DSA,EC_KEY,DH}_get0_*() functions.
  OpenSSL 1.1.0 makes EVP_PKEY/RSA/DSA/DH opaque. We used to provide
  setter methods for each parameter of each PKey type, for example
  PKey::RSA#e=, but this is no longer possible because the new API
  RSA_set0_key() requires the 'n' at the same time. This commit adds
  deprecation warning to them and adds PKey::*#set_* methods as direct
  wrapper for those new APIs. For example, 'rsa.e = 3' now needs to be
  rewritten as 'rsa.set_key(rsa.n, 3, rsa.d)'.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_pkey*.[ch]: Use the new accessor functions. Implement
  RSA#set_{key,factors,crt_params}, DSA#set_{key,pqg}, DH#set_{key,pqg}.
  Emit a warning with rb_warning() when old setter methods are used.

* test/drb/ut_array_drbssl.rb, test/drb/ut_drb_drbssl.rb,
  test/rubygems/test_gem_remote_fetcher.rb: Don't set a priv_key for DH
  object that are used in tmp_dh_callback. Generating a new key pair
  every time should be fine - actually the private exponent is ignored
  in OpenSSL >= 1.0.2f/1.0.1r even if we explicitly set.
  https://www.openssl.org/news/secadv/20160128.txt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:00:47 +00:00
rhe 9199bec9e8 openssl: check existence of RAND_pseudo_bytes()
* ext/openssl/extconf.rb: Check if RAND_pseudo_bytes() is usable. It is
  marked as deprecated in OpenSSL 1.1.0.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_rand.c: Disable Random.pseudo_bytes if
  RAND_pseudo_bytes() is unavailable.

* test/openssl/test_random.rb: Don't test Random.pseudo_bytes if not
  defined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 12:38:34 +00:00
duerst 2cd799b967 * test/ruby/enc/test_case_comprehensive.rb:
Remove :lithuanian guard for Unicode case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 06:24:36 +00:00
duerst 3dd98b2446 * string.c: Raise ArgumentError when invalid string is detected in
case mapping methods.
* enc/unicode.c: Check for invalid string and signal with negative
  length value.
* test/ruby/enc/test_case_mapping.rb: Add tests for above.
* test/ruby/test_m17n_comb.rb: Add a message to clarify test failure.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-02 01:24:52 +00:00
rhe 1978ce784b openssl: add missing test for r55219
* test/openssl/test_asn1.rb: Add missing regression test for r55219. It
  fixed the year 2038 issue but the test code was missing.
  [ruby-core:45552] [Bug #6571]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 14:10:11 +00:00
nobu dd1be236d9 optparse.rb: fix char class option
* lib/optparse.rb (OptionParser::Completion.candidate): get rid of
  nil as key names.  [ruby-core:75773] [Bug #12438]
* lib/optparse.rb (OptionParser#make_switch): char class option
  cannot be NoArgument, default to RequiredArgument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 08:28:48 +00:00
naruse e6ff652ce8 Revert r55225
Run test-all before large commit:
"* string.c: Activate full Unicode case mapping for UTF-8 by removing"

This reverts commit 3fb0fcd1e8.
http://rubyci.s3.amazonaws.com/centos5-64/ruby-trunk/log/20160531T013303Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 02:56:09 +00:00
duerst 3fb0fcd1e8 * string.c: Activate full Unicode case mapping for UTF-8 by removing
the protective check for the presence of an option.
  Update documentation.
* test/ruby/enc/test_case_comprehensive.rb: Adjust tests for above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 01:10:06 +00:00
rhe b9f3d4b836 openssl: fix test failure on Fedora 23
* test/openssl/test_pair.rb (test_ecdh_curves): Avoid P-224. The FIPS
  patch from RHEL disables it. The curve has to be chosen from: {
  secp256k1, secp384r1, secp521r1, prime256v1 }.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 16:52:10 +00:00
usa 3912e4fa3b * ext/socket/raddrinfo.c (host_str, port_str): Use StringValueCStr
instead of (Safe)StringValue, to detect NUL byte in the string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 15:33:06 +00:00
nobu 77a8772b11 test_file_exhaustive.rb: writable open
* test/ruby/test_file_exhaustive.rb (test_flock_shared): open
  in writable mode for exclusive lock.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 14:07:01 +00:00
usa 0e94f4a002 * test/socket/test_addrinfo.rb (TestSocketAddrinfo#test_addrinfo_ip): previous
test logic depended on platform specific implementation.  use more portable
  logic.  this fixes a test failure on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 12:51:14 +00:00
nobu 632097082b test_addrinfo.rb: signle digit address
* test/socket/test_addrinfo.rb (test_addrinfo_ip): use single
  digit address so that the values are same in both decimal and
  octal.  some platform zero-prefixed dotted-decimal is parsed as
  an octal value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 11:23:32 +00:00
rhe f26f358930 openssl: add SSLContext#ecdh_curves=
* ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): Enable the automatic
  curve selection for ECDH by calling SSL_CTX_set_ecdh_auto(). With
  this a TLS server automatically selects a curve which both the client
  and the server support to use in ECDH. This changes the default
  behavior but users can still disable ECDH by excluding 'ECDH' cipher
  suites from the cipher list (with SSLContext#ciphers=). This commit
  also deprecate #tmp_ecdh_callback=. It was added in Ruby 2.3.0. It
  wraps SSL_CTX_set_tmp_ecdh_callback() which will be removed in OpenSSL
  1.1.0. Its callback receives two values 'is_export' and 'keylength'
  but both are completely useless for determining a curve to use in
  ECDH. The automatic curve selection was introduced to replace this.

  (ossl_sslctx_setup): Deprecate SSLContext#tmp_ecdh_callback=. Emit a
  warning if this is in use.

  (ossl_sslctx_set_ecdh_curves): Add SSLContext#ecdh_curves=. Wrap
  SSL_CTX_set1_curves_list(). If it is not available, this falls back
  to SSL_CTX_set_tmp_ecdh().

  (Init_ossl_ssl): Define SSLContext#ecdh_curves=.

* ext/openssl/extconf.rb: Check the existence of EC_curve_nist2nid(),
  SSL_CTX_set1_curves_list(), SSL_CTX_set_ecdh_auto() and
  SSL_CTX_set_tmp_ecdh_callback().

* ext/openssl/openssl_missing.[ch]: Implement EC_curve_nist2nid() if
  missing.

* test/openssl/test_pair.rb (test_ecdh_callback): Use
  EnvUtil.suppress_warning to suppress deprecated warning.

  (test_ecdh_curves): Test that SSLContext#ecdh_curves= works.

* test/openssl/utils.rb (start_server): Use SSLContext#ecdh_curves=.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 09:30:38 +00:00
nobu 94a91b1d60 raddrinfo.c: fix for SHARABLE_MIDDLE_SUBSTRING
* ext/socket/raddrinfo.c (host_str, port_str): use RSTRING_LEN
  instead of strlen, since RSTRING_PTR StringValueCStr may not be
  NUL-terminated when SHARABLE_MIDDLE_SUBSTRING=1.  reported by
  @tmtms, http://twitter.com/tmtms/status/736910516229005312

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:28:55 +00:00
nobu 79a85b18cc string.c: return reallocated pointer
* string.c (str_fill_term): return new pointer reallocated by
  filling terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:20:28 +00:00
nobu bfc9c3766f test_addrinfo.rb: special hostnames
* test/socket/test_addrinfo.rb (test_addrinfo_ip): add tests for
  special hostnames, <any> and <broadcast>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 06:12:13 +00:00
duerst 3883bb6bae * test/test_unicode_normalize.rb: Add test to check for availability of
Unicode data file; refactoring; fix an error with tests for destructive
  method (unicode_normalize!).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 11:34:20 +00:00
nobu 7a622b18d9 test_file_exhaustive.rb: blocking flock
* test/ruby/test_file_exhaustive.rb (test_flock): add assertions
  for the blocking cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:45:48 +00:00
svn 9646e588cb * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:08:37 +00:00
duerst 62efd110f2 * test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests
for data file availability; refactoring.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 10:08:37 +00:00
duerst 6375ad2815 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e 2016-05-28 01:37:49 +00:00
nobu c57c719e4a variable.c: hidden constants
* variable.c (rb_local_constants_i): exclude hidden constants.
  [ruby-core:75575] [Bug #12389]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:38:50 +00:00
nobu 4fad63da01 transcode.c: scrub in the given encoding
* transcode.c (str_transcode0): scrub in the given encoding when
  the source encoding is given, not in the encoding of the
  receiver.  [ruby-core:75732] [Bug #12431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-27 08:09:46 +00:00
svn 46f6abd476 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 00:45:45 +00:00
duerst c1fedc8de7 * test/ruby/enc/test_case_comprehensive.rb: Add set of comprehensive
(across most Unicode characters; later across most character encodings)
  tests for case mapping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-26 00:45:44 +00:00
naruse 05c631eefd * regparse.c (fetch_token_in_cc): raise error if given octal escaped
character is too big. [Bug #12420] [Bug #12423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 09:45:22 +00:00
rhe cf2792d591 openssl: drop OpenSSL 0.9.6/0.9.7 support
* ext/openssl, test/openssl: Drop OpenSSL < 0.9.8 support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 08:50:03 +00:00
naruse 8c2ddab57a * regcomp.c (compile_length_tree): return error code immediately
if compile_length_tree raised error [Bug #12418]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 04:21:31 +00:00
duerst ef6405f71c * enc/unicode.c: Fix flag error for switch from titlecase to lowercase.
* test/ruby/enc/test_case_mapping.rb: Tests for above error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 23:01:39 +00:00
rhe 85500b6634 openssl: add EC.generate
* ext/openssl/ossl_pkey_ec.c (ec_key_new_from_group): Create a new
  EC_KEY on given EC group. Extracted from ossl_ec_key_initialize().
  (ossl_ec_key_s_generate): Added. Create a new EC instance and
  generate a random private and public key.
  (ossl_ec_key_initialize): Use ec_key_new_from_group().
  (Init_ossl_ec): Define the new method EC.generate. This change is
  for consistency with other PKey types.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb: Test that EC.generate works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 16:30:15 +00:00
rhe 8cbd74a362 openssl: rename EC#generate_key to EC#generate_key!
* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_generate_key): Fix up RDoc.
  (Init_ossl_ec): Rename EC#generate_key to EC#generate_key!. Make the
  old name an alias of #generate_key!. This change is for consistency
  with other PKey types.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb: Use EC#generate_key! instead of
  EC#generate_key.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 16:27:11 +00:00
rhe ce635262f5 openssl: make Cipher#key= and #iv= reject too long values
* ext/openssl/ossl_cipher.c (ossl_cipher_set_key, ossl_cipher_set_iv):
  Reject too long values as well as too short ones. Currently they
  just truncate the input but this would hide bugs and lead to
  unexpected encryption/decryption results.

* test/openssl/test_cipher.rb: Test that Cipher#key= and #iv= reject
  Strings with invalid length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-24 13:09:03 +00:00
nobu 4a574f7ad9 bigdecimal.c: fix FloatDomainError
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider
  non-finite float values not to raise FloatDomainError.
  [ruby-core:75682] [Bug #12414]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 03:30:30 +00:00
seki 021e8ead5c use finalizer trick instead of thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 11:03:43 +00:00
duerst 0bf2e5c70b * test/ruby/enc/test_case_options.rb: adjust test class name
to match file name


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 08:25:18 +00:00
duerst de305716c2 * rename test/ruby/enc/test_casing_options.rb to test_case_options.rb
for consistency


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 08:24:08 +00:00
nobu 006634b489 -test-/integer
* ext/-test-/integer/core_ext.c: move testutil/integer.c.
* test/lib/-test-/integer.rb: extract implementation details from
  test/unit/assertions.rb.  [Bug #12408]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 07:27:02 +00:00
nobu b9fe5948f3 move duplicate assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 02:28:03 +00:00
nobu 45e3b48be5 just check Integer
* test/ruby/test_bignum.rb (test_pow): just assert to be an
  Integer.

* test/ruby/test_integer_comb.rb (check_class): ditto.

* test/ruby/test_numeric.rb (test_coerce): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 18:09:05 +00:00
nobu a7955b31c0 hash method values
* test/ruby/test_{complex,range,rational,struct}.rb (test_hash):
  hash values should be an Integer, not only a Fixnum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 18:06:04 +00:00
rhe 118ee2a734 openssl: fix possible SEGV on race between SSLSocket#stop and #connect
* ext/openssl/ossl_ssl.c (ossl_ssl_stop): Don't free the SSL struct
  here. Since some methods such as SSLSocket#connect releases GVL,
  there is a chance of use after free if we free the SSL from another
  thread. SSLSocket#stop was documented as "prepares it for another
  connection" so this is a slightly incompatible change. However when
  this sentence was added (r30090, Add toplevel documentation for
  OpenSSL, 2010-12-06), it didn't actually. The current behavior is
  from r40304 (Correct shutdown behavior w.r.t GC., 2013-04-15).
  [ruby-core:74978] [Bug #12292]

* ext/openssl/lib/openssl/ssl.rb (sysclose): Update doc.

* test/openssl/test_ssl.rb: Test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 07:25:00 +00:00
rhe 7c971e61f0 openssl: add OpenSSL::PKey::EC#private? and #public?
* ext/openssl/ossl_pkey_ec.c: rename PKey::EC#private_key? and
  #public_key? to #private? and #public? for consistency with other
  PKey types. Old names remain as alias.  [ruby-core:45541] [Bug #6567]

* test/openssl/test_pkey_ec.rb (test_check_key): check private? and
  public? works correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 05:30:48 +00:00
rhe f52ab6e494 openssl: improve handling of password for encrypted PEM
* ext/openssl/ossl.c (ossl_pem_passwd_value): Added. Convert the
  argument to String with StringValue() and validate the length is in
  4..PEM_BUFSIZE. PEM_BUFSIZE is a macro defined in OpenSSL headers.
  (ossl_pem_passwd_cb): When reading/writing encrypted PEM format, we
  used to pass the password to PEM_def_callback() directly but it was
  problematic. It is not NUL character safe. And surprisingly, it
  silently truncates the password to 1024 bytes.  [GH ruby/openssl#51]

* ext/openssl/ossl.h: Add function prototype declaration of newly
  added ossl_pem_passwd_value().

* ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): Use
  ossl_pem_passwd_value() to validate the password String.

* ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize, ossl_dsa_export):
  ditto.

* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_initialize,
  ossl_ec_key_to_string): ditto.

* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize, ossl_rsa_export):
  ditto.

* test/openssl/test_pkey_{dsa,ec,rsa}.rb: test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 15:05:25 +00:00
rhe c06a990806 openssl: don't test default session lifetime value
OpenSSL's default session timeout for TLS v1.0 method is not 300 seconds
but 7200. The TLS v1.0 specification[1] mentions about it as just "An
upper limit of 24 hours is suggested for session ID lifetimes,". And
according to OpenSSL 1.0.2h source comment[2], the value 7200 is decided
just because "the 24 hours mentioned in the TLSv1 spec is way too long
for http, the cache would over fill".

The reason why the default lifetime is set to 300 is maybe an OpenSSL
bug. We always call SSL_CTX_new() with SSLv23_method(), and this set
ssl_ctx->session to 300, the default value for SSLv23_method(). But the
following SSL_set_ssl_method() call does not update it. By the way this
will be fixed in OpenSSL 1.1.0.

[1] https://tools.ietf.org/html/rfc2246#appendix-F.1.4
[2] https://git.openssl.org/?p=openssl.git;a=blob;f=ssl/t1_lib.c;h=dd5bd0050d89f5585c1b06a227eb8221ebf984f1;hb=5dd94f1847c744929a3bd24819f1c99644bb18c7#l193

* test/openssl/test_ssl_session.rb (test_session): remove assertion of
  the default session timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 04:36:03 +00:00
kazu 02942a6b90 fix document of Regexp#match?
* re.c (rb_reg_match_m_p): [DOC] fix return value in rdoc.

* test/ruby/test_regexp.rb (TestRegexp#test_match_p): add some
  tests from document.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 12:23:57 +00:00
usa 345d2ba145 * test/ruby/test_array.rb (TestArray#test_push_over_ary_max): it seems to take
long time on mswinci.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 04:34:30 +00:00
rhe a24fe080a4 openssl: check argument type in OpenSSL::X509::Attribute#value=
* ext/openssl/ossl_x509attr.c (ossl_x509attr_set_value): check that the
  argument is an OpenSSL::ASN1::Data before converting to ASN1_TYPE.
  This fixes SEGV on OpenSSL::X509::Attribute#value=(non-asn1-value).

* test/openssl/test_x509attr.rb: add tests for OpenSSL::X509::Attribute.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 04:12:57 +00:00
nobu 4176db205e assertions.rb: leave timeout to invoke_ruby
* test/lib/test/unit/assertions.rb (assert_separately): leave
  timeout to invoke_ruby, which handles outputs and status of the
  target process since r51539.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 03:46:20 +00:00
nobu a28c12af14 re.c: fix match?
* re.c (rb_reg_match_m_p): fix match against empty string.
  rb_str_offset returns the end when the position exceeds the
  length.  fix the range parameter of onig_search.
  [ruby-core:75604] [Bug #12394]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 03:10:12 +00:00
nobu 780c056dad re.c: match? should return nil if no match
* re.c (rb_reg_match_m_p): should return nil if no match, as the
  document says.  [Feature #8110]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19 02:37:38 +00:00
naruse f09574c879 * re.c (rb_reg_match_m_p): Introduce Regexp#match?, which returns
bool and doesn't save backref.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 10:37:13 +00:00
rhe 898aeb8779 openssl: fix test failure due to the previous commit
* test/openssl/test_pkey_ec.rb (test_ec_point_mul): My previous commit
  r55059 was broken. I should have been more careful. Sorry.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 10:07:38 +00:00
rhe 1d1efeeafa openssl: fix test failure of OpenSSL::TestEC#test_ec_point_mul
* test/openssl/test_pkey_ec.rb (test_ec_point_mul): CentOS 7 patches
OpenSSL to reject curves defined over a small field.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 08:52:37 +00:00
nobu bbc4fd8895 test_random.rb: skip old OpenSSL
* test/openssl/test_random.rb (OpenSSL::TestRandom): ignore
  out-of-date OpenSSL before 1.0, as well as other tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 08:06:23 +00:00
nobu 1fcce422d8 openssl/test_random.rb: requires utils.rb
* test/openssl/test_random.rb: requires test/openssl/utils.rb for
  OpenSSL::TestCase now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 07:24:02 +00:00
nobu b493d156de string.c: integer overflow
* string.c (rb_str_modify_expand): check integer overflow.
  [ruby-core:75592] [Bug #12390]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 05:52:40 +00:00
naruse b8fde96861 * re.c (match_ary_subseq): get subseq of match array without creating
temporary array.

* re.c (match_ary_aref): get element(s) of match array without creating
  temporary array.

* re.c (match_aref): Use match_ary_subseq with handling irregulars.

* re.c (match_values_at): Use match_ary_aref.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 04:56:02 +00:00
rhe c8cb26252a openssl: clear OpenSSL error queue before return to Ruby
* ext/openssl/ossl_x509cert.c (ossl_x509_verify): X509_verify()
  family may put errors on 0 return (0 means verification failure).
  Clear OpenSSL error queue before return to Ruby. Since the queue is
  thread global, remaining errors in the queue can cause an unexpected
  error in the next OpenSSL operation.  [ruby-core:48284] [Bug #7215]

* ext/openssl/ossl_x509crl.c (ossl_x509crl_verify): ditto.

* ext/openssl/ossl_x509req.c (ossl_x509req_verify): ditto.

* ext/openssl/ossl_x509store.c (ossl_x509stctx_verify): ditto.

* ext/openssl/ossl_pkey_dh.c (dh_generate): clear the OpenSSL error
  queue before re-raising exception.

* ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto.

* ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto.

* ext/openssl/ossl_ssl.c (ossl_start_ssl): ditto.

* test/openssl: check that OpenSSL.errors is empty every time after
  running a test case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 04:07:47 +00:00
rhe 01801f2afd ext/openssl: refactor OpenSSL::PKey::EC::Point#mul
* ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): Validate the
  arguments before passing to EC_POINT(s)_mul(). Add description of this
  method.  [ruby-core:65152] [Bug #10268]

* test/openssl/test_pkey_ec.rb (test_ec_point_mul): Test that
  OpenSSL::PKey::EC::Point#mul works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:55:46 +00:00
rhe b43fd8e080 openssl: fix equality test methods of OpenSSL::BN
* ext/openssl/ossl_bn.c (try_convert_to_bnptr): Extracted from
  GetBNPtr(). This doesn't raise exception but returns NULL on error.
  (GetBNPtr): Raise TypeError if conversion fails.
  (ossl_bn_eq): Implement BN#==.
  (ossl_bn_eql): #eql? should not raise TypeError even if the argument
  is not compatible with BN.
  (ossl_bn_hash): Implement BN#hash.

* ext/openssl/ossl_bn.c (Init_ossl_bn): Define #== and #hash.

* test/openssl/test_bn.rb: Test BN#eql?, #== and #hash

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:55:45 +00:00
nobu 2bedfc6627 test/win32ole/test_win32ole_variant.rb: use other than Integer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:05:30 +00:00
nobu 7f860741b9 re.c: fix up r55036
* re.c (match_values_at): fix regression at r55036.
  MatchData#values_at accepts Range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 18:16:08 +00:00
naruse 92f8d74a3e * re.c (match_values_at): MatchData#values_at supports named captures
[Feature #9179]

* re.c (namev_to_backref_number): separeted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 17:10:01 +00:00
mrkn d5595a9627 Optimize enum_sum for a range from int to int
* enum.c (enum_sum): Optimize for a range from int to int.

* test/ruby/test_enum.rb (test_range_sum): Move from test_range.rb,
  and add assertions for some conditions.

* test/ruby/test_enum.rb (test_hash_sum): Move from test_hash.rb.

* test/ruby/test_hash.rb, test/ruby/test_range.rb: Remove test_sum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 15:08:33 +00:00
mrkn 41ef7ec381 Implement Enumerable#sum
* enum.c (enum_sum): Implement Enumerable#sum.

* test/ruby/test_enum.rb (test_sum): Test sum for Enumerable.

* test/ruby/test_hash.rb (test_sum): Test sum for Hash.

* test/ruby/test_range.rb (test_sum): Test sum for Range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:58:46 +00:00
akr 449fbfd4d4 Use Integer instead of Fixnum and Bignum.
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
  lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
  lib/rubygems/specification.rb, lib/uri/generic.rb,
  bootstraptest/test_eval.rb, basictest/test.rb,
  test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
  test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
  test/csv/test_data_converters.rb, test/date/test_date.rb,
  test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
  test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
  test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
  test/ruby/test_bignum.rb, test/ruby/test_case.rb,
  test/ruby/test_class.rb, test/ruby/test_complex.rb,
  test/ruby/test_enum.rb, test/ruby/test_eval.rb,
  test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
  test/ruby/test_math.rb, test/ruby/test_module.rb,
  test/ruby/test_numeric.rb, test/ruby/test_range.rb,
  test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
  test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
  test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
  test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:15:57 +00:00
akr f9727c12cc [Feature #12005] Unify Fixnum and Bignum into Integer
* [Feature #12005] Unify Fixnum and Bignum into Integer

* include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums.

* insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from
  FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG.

* vm_core.h: Ditto.

* vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead
  of FIXNUM_REDEFINED_OP_FLAG.

* vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of
  rb_cFixnum and rb_cBignum.
  (C): Use Integer instead of Fixnum and Bignum.

* numeric.c (fix_succ): Removed.
  (Init_Numeric): Define Fixnum as Integer.

* bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum.
  (rb_int_coerce): replaced from rb_big_coerce and return fixnums
  as-is.
  (Init_Bignum): Define Bignum as Integer.
  Don't define ===.

* error.c (builtin_class_name): Return "Integer" for fixnums.

* sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum.

* ext/-test-/testutil: New directory to test.
  Currently it provides utilities for fixnum and bignum.

* ext/json/generator/generator.c: Define mInteger_to_json.

* lib/mathn.rb (Fixnum#/): Redefinition removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 06:53:48 +00:00
nobu 9a9d375f73 * test_handle.rb: refine test_fallback_to_ansi
* test/fiddle/test_handle.rb (test_fallback_to_ansi): ensure that
  the fallback result equals to ANSI version.
  [ruby-core:75494] [Bug #12377]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-16 06:26:56 +00:00
nobu c7d11ee1ba configure.in: revert macro names
* configure.in (FUNC_STDCALL, FUNC_CDECL, FUNC_FASTCALL): set
  macro names explicitly to the old names, which are accidentally
  changed at r54985, for backward compatibilities.
  fiddle also depends on these names to fallback to ANSI names.
  [ruby-core:75494] [Bug #12377]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-16 04:29:01 +00:00
hsbt e2bb529c8f * lib/xmlrpc.rb, lib/xmlrpc/*, test/xmlrpc: XMLRPC is bundled gem
on Ruby 2.4. [Feature #12160][ruby-core:74239]
* gems/bundled_gems: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-16 02:41:11 +00:00
seki e143a74191 don't use keeper thread. [Bug #12342]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-15 11:59:00 +00:00
nobu 5cb5692ac8 vm_insnhelper.c: deprecated constant in class
* vm_insnhelper.c (vm_get_ev_const): warn deprecated constant even
  in the class context.  [ruby-core:75505] [Bug #12382]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-15 01:57:28 +00:00
nobu fc9bc88390 test_rand.rb: tests for seeds
* test/ruby/test_rand.rb: tests for Random.raw_seed and
  Random.new_seed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-13 16:36:41 +00:00
nobu ac8c23f1b5 test_minitest_unit.rb: fix "random" sort
* test/minitest/test_minitest_unit.rb (test_test_methods_random):
  hack to fix the order by avoiding duplicate keys.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-11 12:24:16 +00:00
eregon 06dd20f7fe * insns.def (defineclass): Also raise an error when redeclaring the
superclass of a class as Object and it has another superclass.
  [Bug #12367] [ruby-core:75446]
* test/ruby/test_class.rb: test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-10 12:46:43 +00:00
nobu b402cc7161 random.c: use bytes
* random.c (obj_random_bytes): base on bytes method instead of
  rand method, not to call toplevel rand method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-10 05:57:11 +00:00
nobu abfc0b18d5 webrick/utils.rb: suppress messages
* test/webrick/utils.rb (TestWEBrick#start_server): suppress
  progress messages from WEBrick::Utils#create_self_signed_cert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-09 00:05:32 +00:00
nobu 4a46404a71 test_ssl_server.rb: assert_self_signed_cert
* test/webrick/test_ssl_server.rb (assert_self_signed_cert):
  extract common assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-09 00:05:30 +00:00
nobu f0355ae707 file.c: home dir fall back
* file.c (rb_home_dir_of): return the default home path if the
  user name is the current user name, on platforms where struct
  pwd is not supported.  a temporary measure against
  [Bug #12226].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-08 09:51:34 +00:00
hsbt a6e805f75e * lib/webrick/ssl.rb: Accept string value for SSLCertName. It is used
to invoke ssl server with command line.
  [fix GH-1329] Patch by @kerlin
* test/webrick/test_ssl_server.rb: Added test for GH-1329

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-07 13:37:18 +00:00
hsbt b39d4eac28 * test/webrick/test_ssl_server.rb: Added basic test for `webrick/ssl`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-07 12:55:17 +00:00
nobu 48ed66868c process.c: argument types over conversion
* process.c (rb_exec_getargs): honor the expected argument types
  over the conversion method.  the basic language functionality
  should be robust.  [ruby-core:75388] [Bug #12355]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-06 22:58:03 +00:00
yui-knk a22221caca * test/ruby/test_complexrational.rb: Remove duplicated raise.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-05 09:06:39 +00:00
ktsj 6da2214119 * lib/net/http/header.rb (Net::HTTPHeader#{each_header,each_name,
each_capitalized_name,each_value,each_capitalized}): Return
  sized enumerators.

* test/net/http/test_httpheader.rb: add test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04 09:46:46 +00:00
ktsj 803177b38e * test/net/http/test_httpheader.rb: add missing test of
Net::HTTPHeader#each_capitalized_name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04 09:46:43 +00:00
ktsj 80ccb8e86f * lib/set.rb (Set#{delete_if,keep_if,collect!,reject!,select!,classify,divide},
SortedSet#{delete_if,keep_if}): Return sized enumerators.

* test/test_set.rb: add test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04 09:06:59 +00:00
ktsj 315a136ec0 * test/test_set.rb: add missing test of Set#select!.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-04 09:06:58 +00:00
nobu e0611820df parse.y: trace elsif
* parse.y (new_if_gen): set newline flag to NODE_IF to trace all
  if/elsif statements.  [ruby-core:67720] [Bug #10763]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-03 05:19:20 +00:00
svn 7f50d69c4a * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 14:03:22 +00:00
usa 42ebe37b88 * test/ruby/test_file_exhaustive.rb: test UTF-8 filename. see [Bug #12340]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 14:03:21 +00:00
akr 74b314e41f * test/ruby/test_refinement.rb (test_inspect): Use Integer instead of Fixnum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-02 03:35:52 +00:00
akr af97057c4d * test/ruby/test_numeric.rb (test_step): Use Integer::FIXNUM_MAX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 16:28:18 +00:00
akr 76be3f22c7 test_name use Integer instead of Fixnum.
* test/ruby/test_module.rb (test_name): Use Integer instead of Fixnum.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 16:15:29 +00:00
akr 5ea4824508 test/lib/test/unit/assertions.rb defines assert_fixnum and assert_bignum.
* test/lib/test/unit/assertions.rb (assert_fixnum): Defined.
  (assert_bignum): Defined.

* test/ruby/test_bignum.rb: Use assert_bignum.

* test/ruby/test_integer_comb.rb: Use assert_fixnum and assert_bignum.

* test/ruby/test_optimization.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 16:01:36 +00:00
akr de2f7416d2 envutil.rb defines Integer::{FIXNUM_MIN,FIXNUM_MAX}.
* test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}.

* test/ruby/test_bignum.rb: Use Integer::{FIXNUM_MIN,FIXNUM_MAX}.

* test/ruby/test_bignum.rb: Ditto.

* test/ruby/test_integer_comb.rb: Ditto.

* test/ruby/test_marshal.rb: Ditto.

* test/ruby/test_optimization.rb: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 15:16:17 +00:00
mrkn 78729a59a2 Fix rb_ary_sum for mathn
* array.c (rb_ary_sum): fix for mathn

* test/ruby/test_array.rb (test_sum): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 15:02:47 +00:00
usa b1376614de * test/logger/test_logdevice.rb (TestLogDevice#test_shifting_period_suffix):
too many shifting.  the last shifting created logs named as `*.3`, and
  they were never unlinked.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 14:56:45 +00:00
usa b1ec36b2e6 * test/lib/test/unit.rb (Options#non_options): fixed wrong regexp.
if both positives and negatives were specified, postives had to
  be spcicifed from the beginning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 14:54:44 +00:00
akr 0565551930 update comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 12:50:19 +00:00
akr 9ac296698a Fix a test message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01 12:30:51 +00:00
hsbt 4e53f3ad72 * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.4.
Please see entries of 2.6.4 on
  https://github.com/rubygems/rubygems/blob/master/History.txt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-28 00:33:08 +00:00
nobu 7a5b56677a stringio.c: warn block for new
* ext/stringio/stringio.c (strio_s_new): warn if a block is given,
  as well as IO.new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 06:47:56 +00:00
nobu 6ef87aa633 Fix -e script encoding
* ruby.c (process_options): convert -e script to the encoding
  given by a command line option on Windows.  assume it is the
  expected encoding.  [ruby-dev:49461] [Bug #11900]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 14:35:24 +00:00
yui-knk 7e5b1b65f5 * test/ruby/test_array.rb: Add test cases for Array#sum with
non-numeric objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-24 00:32:21 +00:00
nobu 88783116e0 ruby.c: fix command line encoding on cygwin
* ruby.c: cygwin does not use w32_cmdvector, command line can be
  other than UTF-8.  [ruby-dev:49519] [Bug #12184]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23 00:03:37 +00:00
akr c5c60ded6d * test/ruby/test_time_tz.rb: Tests depends on Europe/Moscow removed
to avoid test failures due to the tzdata change.
  8ee11a301c
  Found by naruse.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 12:20:06 +00:00
nobu 1fbe0943cc eval_jump.c: restore previous error info
* eval_jump.c (exec_end_procs_chain): restore previous error info
  for each end procs.  [ruby-core:75038] [Bug #12302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-22 06:09:29 +00:00
nobu 20cd25c86f cgi/util.rb: remove CGI::Util#_unescape
* ext/cgi/escape/escape.c (cgiesc_unescape): define unescape
  method instead of _unescape, and should pass the optional
  argument to the super method.
* lib/cgi/util.rb (CGI::Util#_unescape): remove intermediate
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20 08:33:33 +00:00
nobu e06aaf699d assertions.rb: return the exception
* test/lib/test/unit/assertions.rb (assert_syntax_error): return
  the rescued exception object as well as assert_raise.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20 04:37:26 +00:00
sonots 64231b49ca * lib/time.rb: revert r54167 because it would break
backward compatibilities, and it is documented that
  Time.parse does not take into account time zone
  abbreations other than ones described in RFC 822

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19 04:20:48 +00:00
nobu b48c212ec9 use more descriptive assertions
* test/logger/test_logdevice.rb: use assert_predicate,
  assert_not_predicate, and assert_file instead of bare assert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-19 04:14:38 +00:00
sonots dd4f590196 * test/logger/test_logdevice.rb: fix tests to pass on windows
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 15:54:45 +00:00
sonots 2c6f15b1ad * lib/logger.rb: Add shift_period_suffix option [Fix GH-10772]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 15:07:31 +00:00
sonots a040953386 Allow specifying logger parameters in constructor
* lib/logger.rb: Allow specifying logger prameters such as level,
  progname, datetime_format, formatter in constructor [Bug #12224]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 10:45:40 +00:00
nobu 6ee3a2cd15 compile.c: fix dangling link
* compile.c (iseq_peephole_optimize): should not replace the
  current target INSN, not to follow the replaced dangling link in
  the caller.  [ruby-core:74993] [Bug #11816]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 07:07:03 +00:00
nobu fe96a2495c numeric.c: flo_truncate
* numeric.c (flo_truncate): add an optional parameter, digits, as
  well as Float#round.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 03:56:33 +00:00
nobu 39f31b8c87 numeric.c: int_truncate
* numeric.c (int_truncate): add an optional parameter, digits, as
  well as Integer#round.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 03:55:33 +00:00
nobu adc7cb240a test_float.rb: assertions for negative floats
* test/ruby/test_float.rb: add assertions for round,floor,ceil on
  negative floats.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-18 03:40:03 +00:00
nobu da2e0721b1 struct.c: unique members
* struct.c (struct_make_members_list, rb_struct_s_def): member
  names should be unique. [ruby-core:74971] [Bug #12291]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-16 01:00:13 +00:00
akr b59a158a18 * array.c (rb_ary_sum): Don't yield same element twice.
Found by nagachika.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 16:26:38 +00:00
akr 72305d2531 * array.c (rb_ary_sum): Fix SEGV by [1/2r, 1].sum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 16:04:18 +00:00
mrkn 0a267b79f6 array.c (rb_ary_sum): use rb_rational_add directly
* rational.c (rb_rational_add): rename from nurat_add.

* array.c (rb_ary_sum): use rb_rational_add directly.

* test/ruby/test_array.rb (test_sum): add assertions for an array of
  Rational values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 14:46:35 +00:00
mrkn a945eb9dda array.c: sum for Rational and Float mixed arrays
* array.c (rb_ary_sum): apply the precision compensated algorithm
  for an array in which Rational and Float values are mixed.

* test/ruby/test_array.rb (test_sum): add assertions for the above
  change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 13:33:05 +00:00
nobu 4bf8fa83b7 thread.c: defer setting name in initialize
* thread.c (rb_thread_setname): defer setting native thread name
  set in initialize until the native thread is created.
  [ruby-core:74963] [Bug #12290]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 13:30:03 +00:00
nobu f7d0059e36 thread.c: must be initialized to set name
* thread.c (get_initialized_threadptr): extract ensuring that the
  thread is initialized.
* thread.c (rb_thread_setname): thread must be initialized to set
  the name.  [ruby-core:74963] [Bug #12290]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 12:12:25 +00:00
mrkn 741229b413 * test/ruby/test_array.rb (test_sum): add assertions for Rational and
Complex numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 05:16:04 +00:00
nobu e78beed499 io/console: unknown key code for names with nul
* ext/io/console/console.c (console_key_pressed_p): raise the same
  exception, "unknown virtual key code", for names with nul chars.
  though console_win32_vk() considers the length and can deal with
  nul chars, rb_sprintf() raised at PRIsVALUE previously, so quote
  it if it is unprintable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 01:07:14 +00:00
nobu caaf4f2aea io/console: move conditions
* test/io/console/test_io_console.rb: move conditions for method
  definitions before the bodies.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 01:06:49 +00:00
akr 32959b0b5c add assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-14 16:19:33 +00:00
akr c0e3b20e99 add an assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-14 12:57:07 +00:00
akr 76426c7ea5 * array.c (rb_ary_sum): Support the optional argument, init, and block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-14 12:48:44 +00:00
akr b359d20352 * array.c (rb_ary_sum): Array#sum is implemented.
Kahan's compensated summation algorithm for precise sum of float
  numbers is moved from ary_inject_op in enum.c.

* enum.c (ary_inject_op): Don't specialize for float numbers.

  [ruby-core:74569] [Feature#12217] proposed by mrkn.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 13:51:53 +00:00
nobu c258535186 numeric.c: flo_ceil
* numeric.c (flo_ceil): add an optional parameter, digits, as
  well as Float#round.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 06:56:36 +00:00
nobu d56b277684 numeric.c: flo_floor
* numeric.c (flo_floor): add an optional parameter, digits, as
  well as Integer#floor.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 06:54:38 +00:00
nobu a1542d33ca numeric.c: int_ceil
* numeric.c (int_ceil): add an optional parameter, digits, as
  well as Integer#round.  [Feature #12245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 06:50:24 +00:00
nobu 15558a8f57 numeric.c: int_floor
* numeric.c (int_floor): add an optional parameter, digits, as
  well as Integer#round.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 06:47:55 +00:00
nobu 096137e84f file.c: File.empty?
* file.c (Init_File): add alias File.empty? to File.zero?.
  [Feature #9969]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 05:47:49 +00:00
nobu 134d1ce892 parse.y: massign in cond
* parse.y (assign_in_cond): allow multiple assignment in
  conditional expression.  [Feature #10617]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 05:36:26 +00:00
ko1 9d25813745 * test/ruby/test_basicinstructions.rb: add a test to check access
instance variables on special const objects.

  All of such objects are frozen, so that we can not set instance
  variables for them. But we can read instance variables and return
  default value (nil).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 03:03:37 +00:00
nobu 456523e2ed date_core.c: preserve timezone
* ext/date/date_core.c (time_to_time): should preserve timezone
  info.  [ruby-core:74889] [Bug #12271]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-12 11:40:37 +00:00
nobu 263177507e test_optimization.rb: disasm
* test/ruby/test_optimization.rb (disasm): dump disassembled code
  for investigation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-12 00:30:55 +00:00
nobu f0226f0a3c compile.c: disable tco with rescue
* compile.c (iseq_optimize): disable tail call optimization in
  rescued, rescue, and ensure blocks.
  [ruby-core:73871] [Bug #12082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:43:06 +00:00
nobu 0ebf3849e4 TestException.rb: suppress warning
* test/excludes/TestException.rb: suppress "ambiguous first
  argument" warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:27:19 +00:00
nobu 316bb88f5a test/unit.rb: show warning locations
* test/lib/test/unit.rb (ExcludedMethods.load): supply the path to
  show the warning locations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:27:17 +00:00
nobu ba001b4160 test_whileuntil.rb: fix old behavior
* test/ruby/test_whileuntil.rb (test_while): fix old behavior.
  mere numeric literal in condition no longer matches $. global
  variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:06:23 +00:00
nobu 015b492281 test_rubyoptions.rb: suppress warning
* test/ruby/test_rubyoptions.rb (test_indentation_check): remove
  unused variable to suppress warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:06:22 +00:00
nobu d9f6850ef3 test_regexp.rb: suppress warning
* test/ruby/test_regexp.rb (test_named_capture): suppress
  "assigned but unused variable" warning by prefixing '_'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:06:21 +00:00
nobu c372b1236e test_iterator.rb: suppress warnings
* test/ruby/test_iterator.rb (test_break): suppress "statement not
  reached" warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 08:06:19 +00:00
nobu ba56de8b06 test_coverage.rb: suppress warnings
* test/coverage/test_coverage.rb (test_coverage_snapshot),
  (test_restarting_coverage): use unique names to suppress method
  redefinition warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11 05:13:31 +00:00
nobu 404bf57aaf assertions.rb: set default internal encoding
* test/lib/test/unit/assertions.rb (assert_raise_with_message):
  set default internal encoding to the excpected message, which
  affects String#inspect in messages.

* test/lib/test/unit/assertions.rb (assert_warning): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-09 01:25:11 +00:00
nobu 7aa83cd0f8 test_io_m17n.rb: nil default internal encoding
* test/ruby/test_io_m17n.rb (test_bom_non_utf): ensure default
  internal encoding is not set.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-09 00:59:53 +00:00
nobu 3b6c4dad0c bignum.c: rb_cstr_parse_inum
* bignum.c (rb_cstr_parse_inum): [EXPERIMENTAL] new function to
  parse integer in C-string with length.  the name and the
  arguments may be changed in the future.
* bignum.c (rb_str_to_inum): preserve encoding of the argument in
  error messages, and no longer needs to copy non-terminated
  strings.
* bignum.c (rb_str2big_{poweroftwo,normal,karatsuba,gmp}): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-08 17:05:12 +00:00
nobu f0cee0c6b8 test_ssl.rb: skip unsupported ciphers
* test/openssl/test_ssl.rb (test_get_ephemeral_key): skip
  unsupported ciphers.  [GH-1318]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-07 00:10:41 +00:00
eregon 4225b29df9 * ext/coverage/coverage.c: Fully reset coverage to not persist global state.
It was returning old file coverages as empty arrays to the user.
  [ruby-core:74596] [Bug #12220]
* ext/coverage/coverage.c (rb_coverages): remove unused static state.
* thread.c: Moved and renamed coverage_clear_result_i to reset_coverage_i.
* test/coverage/test_coverage.rb: improve precision of tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06 14:29:17 +00:00
hsbt 469bac0f92 * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.3.
Please see entries of 2.6.3 on
  https://github.com/rubygems/rubygems/blob/master/History.txt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06 06:01:14 +00:00
nobu 9d31efc6f0 test_ssl.rb: skip unavailable pkeys
* test/openssl/test_ssl.rb (test_get_ephemeral_key): skip
  unavailable public keys.  [GH-1318]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06 04:38:49 +00:00
nobu 542d3a071f math.c: fix lgamma
* math.c (ruby_lgamma_r): fix lgamma(-0.0) on mingw and OSX.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05 15:53:32 +00:00
nobu 41c533446f math.c: fix tgamma
* math.c (ruby_tgamma): fix tgamma(-0.0) on mingw.
  [ruby-core:74817] [Bug #12249]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05 15:52:02 +00:00
nobu d1683b59b0 test_get_ephemeral_key: use assert_instance_of
* test/openssl/test_ssl.rb (test_get_ephemeral_key): should use
  assert_instance_of instead of comparison of classes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 15:08:20 +00:00
nobu 176976db33 openssl: Access to ephemeral TLS session key
* ext/openssl/ossl_ssl.c (ossl_ssl_tmp_key): Access to ephemeral
  TLS session key in case of forward secrecy cipher.  Only
  available since OpenSSL 1.0.2.  [Fix GH-1318]
* ext/openssl/extconf.rb: Check for SSL_get_server_tmp_key.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 15:06:46 +00:00
nobu 990d709eeb at_exit list
* vm_core.h (rb_vm_struct): make at_exit a single linked list but
  not RArray, not to mark the registered functions by the write
  barrier.  based on the patches by Evan Phoenix.
  [ruby-core:73908] [Bug #12095]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 14:37:07 +00:00
duerst 5e9d33ad49 * enc/unicode/case-folding.rb, casefold.h: Data generation to implement
swapcase functionality for titlecase characters. Swapcase isn't defined
  by Unicode, because the purpose/usage of swapcase is unclear anyway.
  The implementation follows a proposal from Nobu, swaping the case of
  each component of a titlecase character individually.
  This means that the titlecase characters have to be decomposed.
* enc/unicode.c: Code using the above data.
* test/ruby/enc/test_case_mapping.rb: Tests for the above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-01 11:58:47 +00:00