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

10116 Коммитов

Автор SHA1 Сообщение Дата
yui-knk a7452a8f4f test_lexer.rb: require ripper directly
* test/ripper/test_lexer.rb: This file does not use
  DummyParser, so requiring ripper directly instead of
  requiring dummyparser.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-15 07:24:12 +00:00
nobu 57464618ab io.c: textmode if newline decorator
* io.c (validate_enc_binmode): newline decorator implies text mode
  now.  [ruby-core:80270] [Bug #13350]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 10:53:35 +00:00
naruse 7c9c2bc1dd Zlib::GzipReader#pos underflows after calling #ungetbyte or #ungetc at start of file [Bug #13616]
patched by Andrew Haines <andrew@haines.org.nz> [ruby-core:81488]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 09:17:55 +00:00
knu d893c123f6 Alias Set#to_s to #inspect [ruby-core:81753] [Feature #13676]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 08:46:13 +00:00
knu cb1d634d6a Make tests for Set#inspect more straightforward
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 08:46:10 +00:00
mrkn 1405111722 hash.c: Add Hash#transform_keys and Hash#transform_keys!
* hash.c (transform_keys_i, rb_hash_transform_keys): Add Hash#transform_keys.
  [Feature #13583] [ruby-core:81290]

* hash.c (rb_hash_transform_keys_bang): Add Hash#transform_keys!.
  [Feature #13583] [ruby-core:81290]

* test/ruby/test_hash.rb: Add tests for above changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 06:44:00 +00:00
hsbt 0b396d5880 Merge psych-3.0.0.beta3 from ruby/psych.
* Rely on encoding tags to determine if string should be dumped as binary.
    8949a47b8c
  * Specify "frozen_string_literal: true".
  * Support to binary release for mingw32 platform.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 06:15:58 +00:00
nobu 1e84c8343f process.c: null bytes
* process.c (rlimit_type_by_sym): prohibit null bytes in key
  names.  [ruby-core:82033] [Bug #13744]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-14 04:43:16 +00:00
kazu a39ad0f065 Use tr! instead of gsub!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-13 23:55:41 +00:00
normal 5c4db58b12 process.c: handle dynamic :rlimit_* symbols in spawn execopts
* process.c (rb_execarg_addopt_rlimit): hoist out of rb_execarg_addopt
  (rlimit_type_by_sym): new wrapper for dynamic symbol
  (rb_execarg_addopt): check for dsym via rlimit_type_by_sym
* test/ruby/test_process.rb (test_execopts_rlimit): check dsym w/o pindown
  Add extra check for bogus rlimit args, too.
  [ruby-core:82033] [Bug #13744]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-13 20:47:36 +00:00
hsbt 24873d1a05 Use Test::Unit::TestCase instead of MiniTest::Unit::TestCase. Because
tests of fiddle already used customized assertions of ruby core.

  * test/fiddle/helper.rb: Use Test::Unit::TestCase for base class of
    testcase.
  * test/fiddle/test_*.rb: Use assert_raise instead of assert_raises.
    Remove needless includes for Test::Unit::Assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-13 09:46:16 +00:00
nobu 89bf90a370 optparse.rb: get rid of eval
* lib/optparse.rb: try Float() and Integer() instead of eval,
  which does too much things.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-12 02:49:53 +00:00
ko1 5168fb54e3 tainted string should be tainted.
* hash.c (hash_aset_str): create frozen string for tainted objects.
  (should not use fsting table on this case).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-11 07:42:27 +00:00
nobu 5ed1d88eda test_rubyoptions.rb: assert -00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-10 07:37:18 +00:00
nobu 1d6c1d20fd assertions.rb: syntax_check for other impl
* test/lib/test/unit/assertions.rb (syntax_check): use eval
  instead of RubyVM::InstructionSequence.compile so that other
  implementations can share the tests.
  [ruby-core:81935] [Bug #13723]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-08 02:22:20 +00:00
normal 08bdbef5ca webrick: add Server Name Indication (SNI)
* lib/webrick/https.rb: servername_cb implementation.
* lib/webrick/ssl.rb: abstract servername_cb.
* test/webrick/test_https.rb: test.
  [ruby-dev:50165] [Feature #13729]
  Author: Tietew <tietew@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-07 17:09:39 +00:00
nobu 8ddf0263bb Fix DecimalInteger converting to octal bug
Previously if the input started with a '0' then it will be converted
as octal even though it has been specified as a decimal. This commit
forces the number to be interpreted as a decimal.

[ruby-core:81927] [Bug #13722] [Fix GH-1665]
Author:    william <william.mccumstie@outlook.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-06 11:49:03 +00:00
nobu d9d8ca0b8f lexer.rb: ignore dedented space
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): replace an
  empty string content because of dedentation with :on_ignored_sp.
  an empty token makes the sorted order unstable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-06 04:12:51 +00:00
nobu 1c34f0b837 vm_args.c: improve keyword argument errors
* vm_args.c (argument_arity_error): improve required keyword
  argument errors when non-keyword arguments given.
  [ruby-core:79439] [Bug #13196]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-04 05:42:04 +00:00
nobu 202fbe3046 time.c: preserve marshalled timezone
* time.c (time_add): preserve timezone name restored by Marshal.
  [ruby-core:81892] [Bug #13710]

* time.c (time_mload): reset localtime if having timezone.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-04 04:23:06 +00:00
naruse 7ac29740a1 Suppress warning: method redefined; discarding old ==
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-03 08:08:29 +00:00
ktsj 0ff27c4604 Symbol#== should be able to be redefined
* vm.c (vm_init_redefined_flag): set redefinition flag for Symbol#==.
  The bug was introduced in r58895.

* test/ruby/test_symbol.rb: test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-02 10:38:38 +00:00
nobu f2d1848441 parse.y: f_margs parser events
* parse.y (f_margs): implemented parser events for massign
  formal arguments.  [ruby-core:81848] [Bug #13701]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-01 02:01:05 +00:00
nobu 844ca35a92 parse.y: mlhs_add_post
* parse.y (mlhs_add_post): new parser event corresponding to
  POSTARG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-01 01:51:17 +00:00
nobu 046f8469f3 test_parser_events.rb: simplify
* test/ripper/dummyparser.rb (DummyParser): simplified mlhs node
  representation.

* test/ripper/test_parser_events.rb (test_mlhs_add_star):
  simplified assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-01 01:29:22 +00:00
nobu 0a11abfc7e compile.c: disallow next in once
* compile.c (iseq_compile_each0): turned dregx context in "once"
  into "guarded" type from "block" type, to disallow `next`,
  `break`, `redo` as well as outside "once".
  [ruby-core:81805] [Bug #13690]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-29 04:01:30 +00:00
ko1 5041f548dd introduce rb_fiber_t::first_proc.
* cont.c (rb_fiber_t): add rb_fiber_t::first_proc and do not use
  rb_thread_t::first_proc which should be thread local.
  [Bug #13689]

* test/ruby/test_thread.rb: test for [Bug #13689].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 15:25:30 +00:00
nobu f78d92c5ca parse.y: fix token
* parse.y (parser_parse_string): return proper token tREGEXP_END
  at unterminated regexp.  [Bug #13363]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 06:13:00 +00:00
nobu 7c7d74365d parse.y: add ellipsis
* parse.y (parser_yyerror): add ellipsis properly when error line
  is truncated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 05:38:27 +00:00
nobu e42a16190c parse.y: flush numeric token
* parse.y (parser_number_literal_suffix, parse_numeric): flush
  numeric token so following unexpected token part is marked.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 04:08:51 +00:00
duerst b3f38b57e7 add two tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 02:28:00 +00:00
nobu ff36c25f47 parse.y: fix parser_yyerror
* parse.y (parser_yyerror): fix buffer overflow at truncation of
  error line.  [ruby-core:81790] [Bug #13687]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-28 02:02:38 +00:00
nobu 5cfda37971 fix return in toplevel ensure
* compile.c (iseq_compile_each0): adjust stack after return in
  toplevel ensure, when the value is used.
  [ruby-core:81777] [Bug #13682]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27 14:09:08 +00:00
nobu 1474acff3c fix return in toplevel rescue/ensure
* compile.c (iseq_compile_each0): throw TAG_RETURN at return in
  toplevel rescue/ensure to adjust VM stack properly.
  [ruby-core:81777] [Bug #13682]

* vm_insnhelper.c (vm_throw_start): allow return in toplevel
  rescue/ensure.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27 06:57:34 +00:00
nobu 49160c7115 vm_insnhelper.c: break in once
* vm_insnhelper.c (vm_throw_start): size of catch table has been
  included in iseq_catch_table struct, which could be NULL, since
  2.2.  e.g., proc-closure in `once'.
  [ruby-core:81775] [Bug #13680]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-27 03:45:55 +00:00
nobu 8f1c93f409 compile.c: toplevel return in argument
* compile.c (iseq_compile_each0): adjust the stack before return
  in an evstr/argument (reported by Balazs <balazs@kutilovi.cz>)
  to fix stack consistency error.  [ruby-core:81761] [Bug #13678]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-25 05:10:48 +00:00
nobu 3c45a7899e Delegate to `eql?` [Fix GH-1564]
* lib/delegate.rb (eql?): Delegate to `eql?` of the inner object.
  based on the patch by giginet <giginet.net@gmail.com>.
  [ruby-core:76950] [Bug #12684]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-24 03:35:29 +00:00
nobu ebf1da9de3 test_command_processor.rb: add suffix
* test/shell/test_command_processor.rb (test_option_type): Windows
  needs a suffix to execute.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 15:08:50 +00:00
nobu af4ba5c12a parse.y: should not warn op method call
* parse.y (void_expr_gen): should warn operator expression style
  calls only, but not method style calls.  [Fix GH-1660]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 11:56:48 +00:00
nobu d391697331 parse.y: check multibyte char
* parse.y (parser_precise_mbclen): check invalid multibyte char at
  skipping strings following `?x` literal string, not to stuck in
  a infinite loop.  [ruby-core:81746] [Bug #13672]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 11:20:29 +00:00
ko1 931cc441e5 skip on other threads (again).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 05:52:28 +00:00
ko1 23206859bc revert r59151 which introduce failures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 05:50:35 +00:00
ko1 25566b05fc skip on other threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 05:45:50 +00:00
glass 2fd3a2e2f7 Revert "Allow IO#reopen to take a block"
This reverts r59142.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-23 04:19:53 +00:00
nobu ae6ebbb3fa fix mortal_dynamic_symbol count
* test/objspace/test_objspace.rb (test_count_symbols): exclude a
  dynamic symbol which has been turned into immortal by
  define_method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 12:53:05 +00:00
glass b906f78855 Fix exception type in option type checker
* lib/shell/system-command.rb (SystemCommand#initialize):
  `def_e2message` wraps error message, but does not define new exception

* test/shell/test_command_processor.rb: add a test

This patch is authored by Kenichi Kamiya <kachick1@gmail.com>
close #1657

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 10:56:49 +00:00
ko1 dc44df8a06 try to fix symbol duplication.
* test/objspace/test_objspace.rb (test_count_symbols): make more complex dynamic
  symbols to avoid conflict with other existing static symbols.
  Sometimes this test fails with "mortal_dynamic_symbol=>127".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 08:33:33 +00:00
glass f1b7003f35 Allow IO#reopen to take a block
* io.c (rb_io_reopen): take a block and ensure the IO closed
  [Feature #2631]

* test/ruby/test_io.rb: add a test

* NEWS: add an entry for this change

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 06:50:32 +00:00
ko1 a48fecd3b9 catch up frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 05:51:43 +00:00
nobu 7a1c10ba08 gc.c: expand sorted pages
* gc.c (heap_page_allocate): expand sorted pages before inserting
  allocated new page.  [Bug #12670]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22 00:59:54 +00:00
sonots 0d03650599 test/ruby/test_string.rb: add tests to chomp substr
* test/ruby/test_string.rb (TestString#test_chomp): add tests
  to chomp substr

* test/ruby/test_string.rb (TestString#test_chomp!): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-21 07:43:27 +00:00
sonots 10082360b9 string.c: add String#delete_prefix and String#delete_prefix!
to remove leading substr [Feature #12694] [fix GH-1632]

* string.c (rb_str_delete_prefix_bang): add a new method
  to remove prefix destuctively.

* string.c (rb_str_delete_prefix): add a new method
  to remove prefix non-destuctively.

* test/ruby/test_string.rb: add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-21 07:43:26 +00:00
nobu 9cacc53d4a Fix Enumerable#uniq with non single yield arguments
* enum.c (uniq_func, uniq_iter): need packed value as the unique
  key.  [ruby-core:81734] [Bug #13669] [Fix GH-1658]

Author:    Kenichi Kamiya <kachick1@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-21 02:25:27 +00:00
hsbt 8ae9de372a Fixed missing handling for frozen object at r59121.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-20 11:43:05 +00:00
hsbt d5f86e836f Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-20 11:10:37 +00:00
ko1 4d932a68ff skip unresolved issue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-20 05:34:33 +00:00
nobu 263a0f7f16 test for [Bug #12670]
heap corruption by deferred free.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-19 14:36:17 +00:00
nobu f5052d45be string.c: check just before modification
* string.c (rb_str_chomp_bang): check if modifiable after checking
  an argument and just before modification, as it can get frozen
  during the argument conversion to String.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-18 04:38:01 +00:00
nobu 80aa1e6218 test_string.rb: chomp! frozen string
* test/ruby/test_string.rb (TestString#test_chomp): should raise
  if frozen.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-18 04:29:05 +00:00
nobu b89367d6d5 test/unit.rb: close jobserver
* test/lib/test/unit.rb (Test::Unit::Parallel#flush_job_tokens):
  close jobserver auth fds aflter flush, not to  release tokens
  more than acquired.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-18 04:29:04 +00:00
nobu 2875337533 pathname.rb: UNC root pathname needs a separator
* ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname
  needs a separator.  File.basename returns "/" on UNC root, as
  well as sole drive letter, even if it does not end with a
  separator.  [ruby-core:80900] [Bug #13515]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-16 14:44:01 +00:00
hsbt 5a13c6bcd9 Merge psych-3.0.0.beta2 from https://github.com/ruby/psych
It contains following changes from 3.0.0.beta1

    * Preserve time zone offset when deserializing times
      https://github.com/ruby/psych/pull/316

    * Enable YAML serialization of Ruby delegators
      https://github.com/ruby/psych/pull/158

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-16 07:02:22 +00:00
ko1 ab8e756de0 require 'bigdecimal'
* test/json/json_parser_test.rb: this test needs bigdecimal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-16 04:04:53 +00:00
hsbt b304078ae6 Merge json-2.1.0 from https://github.com/flori/json
https://github.com/flori/json/blob/master/CHANGES.md#2017-04-18-210

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-16 03:04:46 +00:00
nobu bacadbe9bf proc.c: infect inspect result
* proc.c (method_inspect): the result should be infected by the
  object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 14:02:33 +00:00
nobu 452f46b751 test/ruby/test_method.rb: refined [ruby-core:81666] [Bug #13656]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 13:08:50 +00:00
rhe 9eb92007b6 openssl: import v2.0.4
Import Ruby/OpenSSL 2.0.4. Only bug (and typo) fixes. The full commit
history since v2.0.3 (imported at r57482) can be found at:

  https://github.com/ruby/openssl/compare/v2.0.3...v2.0.4

This contains the fix for [Bug #11033].

----------------------------------------------------------------
Jun Aruga (1):
      Update .travis.yml and Dockerfile

Kazuki Yamaguchi (9):
      test/test_pkey_ec: do not use dummy 0 order
      test/test_ssl: fix typo in test_sysread_and_syswrite
      ssl: check return value of SSL_set_fd()
      Fix typos
      test/test_x509store: skip OpenSSL::TestX509Store#test_set_errors
      tool/sync-with-trunk: 'LASY' -> 'LAST'
      x509store: clear error queue after calling X509_LOOKUP_load_file()
      extconf.rb: simplify searching libraries logic
      Ruby/OpenSSL 2.0.4

SHIBATA Hiroshi (1):
      Fix typos

Vladimir Rybas (1):
      Fix documentation for OpenSSL::Cipher#final

nobu (2):
      openssl: fix broken openssl check
      openssl: fix broken openssl check

usa (1):
      Search SSL libraries by testing various filename patterns

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 09:49:09 +00:00
nobu dbf67bf02d proc.c: skip prepended modules
* proc.c (method_super_method): skip prepended modules and
  continue from the super class of the original class.
  [ruby-core:81666] [Bug #13656]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 06:03:55 +00:00
ko1 6c3f1461cd remove ruby_kill() introduced for [Bug #7951].
* thread.c (rbuy_kill): removed. This function is used
  with SIGSEGV, SIGBUS, SIGKILL, SIGILL, SIGFPE and SIGSTOP
  and these signals are affect immediately. So that `kill(2)'
  is enough for them.

* signal.c (rb_f_kill): ditto.

* vm_core.h (rb_thread_t::interrupt_cond): removed because
  only `ruby_kill()' uses this field.

* test/ruby/test_signal.rb: Without this patch sending SIGSTOP to own
  process wait another interrupt even if another process sends SIGCONT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 04:52:25 +00:00
nobu a57d295e36 iseq.c: preserve encoding
* iseq.c (iseqw_inspect): preserve path encoding in the result.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 04:35:53 +00:00
ko1 fccbc2d278 * proc.c (get_local_variable_ptr): return found env ptr. Returned env
will be used by write barrier at `bind_local_variable_set()'.
  [Bug #13605]

* test/ruby/test_proc.rb: add a test for this issue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12 02:20:09 +00:00
nobu 51982c8139 enumerator.c: fix nested maps
* enumerator.c (lazy_map_proc, lazy_grep_iter_proc): marks values
  returned by blocks are not packed in the case of nested maps, so
  that the result will be same as non-lazy version.  based on the
  patch by akihikodaki (Akihiko Odaki) at [ruby-core:81638],
  without GCC extension.  [Bug#13648]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-10 10:26:32 +00:00
ko1 7d8a415bc2 check break target correctly.
* compile.c (iseq_compile_each0): save target child_iseq in the catch-table
  for break. This iseq is not for continuation, but for search key at
  vm_throw_start().

* vm_insnhelper.c (vm_throw_start): check saved iseq first.

* iseq.h: add comment for it.

* test/ruby/test_iterator.rb (test_ljump): add a test for the issue:
    def call b; b.call; end
    call(Proc.new{break}){} #=> (1) should raise LocalJumpError
    call(Proc.new{break})   #=> (2) shoudd raies LocalJumpError, too.
  but (1) doesn't raise LocalJumpError.

  This issue is reported by Matz.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-08 04:13:51 +00:00
kou d311921d31 rexml: add close tag check on end of document to StreamParser
[ruby-core:81593] [Bug #13636]

Reported by Anton Sivakov. Thanks!!!


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-07 13:01:28 +00:00
normal 27b8ef7ff7 thread.c: avoid busy looping on rb_thread_fd_close
We no longer use it this function, but extensions do, and
we need to ensure it continues to work for them.

* thread.c (rb_thread_fd_close): schedule other threads in loop
* ext/-test-/thread_fd_close/thread_fd_close.c: new file
* ext/-test-/thread_fd_close/depend: ditto
* ext/-test-/thread_fd_close/extconf.rb: ditto
* test/-ext-/thread_fd_close/test_thread_fd_close.rb: new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-07 00:32:02 +00:00
normal 10421fb1f2 IO#close: do not enqueue redundant interrupts (take #2)
Enqueuing multiple errors for one event causes spurious errors
down the line, as reported by Nikolay Vashchenko in
https://bugs.ruby-lang.org/issues/13632

This should fix bad interactions with test_race_gets_and_close
in test/ruby/test_io.rb since we ensure rb_notify_fd_close
continues returning the busy flag after enqueuing the interrupt.

Backporting changes to 2.4 and earlier releases will be more
challenging...

* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
  [ruby-core:81581] [Bug #13632]
* test/ruby/test_io.rb (test_single_exception_on_close):
  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 22:55:35 +00:00
duerst 267323cad5 add test_ill_formed_utf_8_replace to test recommended number of \uFFFD
Add test method test_ill_formed_utf_8_replace to test/ruby/test_transcode.rb
to check for the recommended number of \uFFFD replacement characters.
This is the first part, using ill-formed prefixes, with suffixes up to
the length of the original UTF-8 structure (including overlongs and
the full 31-bit space.)

For more details, see Unicode 9.0.0, Section 3.9, Best Practices for Using U+FFFD.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 10:34:10 +00:00
ko1 7d041e87c6 re-revert r59020
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 07:11:28 +00:00
ko1 e9c440815e revert r59023 because it contans unrelated developping code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 07:10:19 +00:00
ko1 b0c9215f72 revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 06:58:54 +00:00
normal 59fb92971f IO#close: do not enqueue redundant interrupts
Enqueuing multiple errors for one event causes spurious errors
down the line, as reported by Nikolay Vashchenko in
https://bugs.ruby-lang.org/issues/13632

* thread.c (rb_notify_fd_close): do not enqueue multiple interrupts
  [ruby-core:81581] [Bug #13632]
* test/ruby/test_io.rb (test_single_exception_on_close):
  new test based on script from Nikolay

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06 00:13:47 +00:00
nobu 0866b8e83a test_require.rb: fix expected path
* test/ruby/test_require.rb (test_require_with_unc): remove extra
  slash.  the result of File.expand_path has a slash just follows
  the drive letter.
  4ef849bd90 (commitcomment-22391133)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-04 06:24:04 +00:00
nobu 4ef849bd90 test_require.rb: ignore EPERM at UNC
* test/ruby/test_require.rb (test_require_with_unc): ignore EPERM.
  GetFileAttributes and CreateFile with backup semantics fail at a
  symlink in a shared folder to another shared folder.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 17:11:43 +00:00
nobu a75bc36dd2 file.c: preserve encoding
* file.c (path_check_0): preserve encoding of path name in warning
  message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 14:40:05 +00:00
nobu 08d44417e0 test/ruby/test_require.rb: remove duplicate assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 09:35:43 +00:00
nobu 0a733176da test_require.rb: untouch default internal encoding
* test/ruby/test_require.rb (assert_require_insecure_path): get
  rid of setting Encoding.default_internal, which affects load
  path conversion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 09:18:44 +00:00
normal e6e292121a test: attempt to reduce failures in assert_cpu_usage_low
Try to make this test less fragile by taking into account
the worst case kernel timing resolution.
[ruby-core:81540]

* test/lib/test/unit/assertions.rb (assert_cpu_usage_low):
  clamp measurement to minimum measurable time and warn
  about tests being too short to measure
* test/ruby/test_io.rb (test_copy_stream_no_busy_wait):
  remove pct kwarg and rely on assert_cpu_usage_low defaults

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03 01:04:30 +00:00
nobu eb4a2c374e test_require.rb: assert_require_insecure_path
* test/ruby/test_require.rb (assert_require_insecure_path): more
  tests for loading insecure path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 14:52:49 +00:00
nobu 311e650334 test_require.rb: fallback encoding
* test/ruby/test_require.rb (assert_require_nonascii_path):
  fallback when LANG=C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 04:32:47 +00:00
nobu 51e738561a test_require.rb: filesystem encoding
* test/ruby/test_require.rb (assert_require_nonascii_path): the
  path in error message is converted to filesystem encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 04:10:36 +00:00
nobu 1e1964b8f2 file.c: preserve encoding
* file.c (rb_find_file_safe): preserve encoding of path in
  SecurityError messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-02 03:54:19 +00:00
ko1 648e0a9775 fix failure on r58981
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01 04:48:05 +00:00
nobu e4cc791f87 enum.c: check if reentered
* enum.c (cmpint_reenter_check): extract from nmin_cmp and
  nmin_block_cmp.

* enum.c (nmin_cmp): check if reentered before rb_cmpint.
  [Feature #13437]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 13:12:22 +00:00
nobu 76be4743ba test_rubyoptions.rb: ruby-runner sets $0 to install name now
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30 11:59:26 +00:00
k0kubun 26e32b7d65 test/erb/test_erb.rb: Fix unused variable warning
ruby/test/erb/test_erb.rb:575: warning: assigned but unused variable - foo

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-29 10:22:47 +00:00
normal a028cfc597 test/ruby/test_io.rb: adjust CPU usage check to 10%
I miscalculated for r58934, since we sleep 100ms, and
the worst possible case is 100 Hz in the kernel meaning
we only have 10ms resolution.  So, we need to increase
our CPU percentage to >= 10% for this.

This should be more than enough for our CI machines which
have 300 Hz kernels [ruby-core:81429]:

 http://ci.rvm.jp/results/trunk-test@sasada-8core/1495942555

* test/ruby/test_io.rb (test_copy_stream_no_busy_wait):
  override default percentage

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28 05:39:29 +00:00
normal 109ccfdb2c tests: increase CPU percentage threshold for assert_cpu_usage_low
When sleeping for the tick rate of 100ms (defined in
thread_pthread.c) as we do in test/ruby/test_io.rb
(test_copy_stream_no_busy_wait), it may not be possible to
measure with <= 10ms resolution on 100HZ systems (CONFIG_HZ in
the Linux kernel).  So increase the threshold to 15ms (10ms +
5ms slack for slow systems).

* test/lib/test/unit/assertions.rb (assert_cpu_usage_low):
  increase pct default value [ruby-core:81427]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28 01:43:38 +00:00
normal b3d126d5de rb_wait_for_single_fd: do not OOM or segfault with invalid FD on select()
Instead, match the poll() implementation used on Linux for now;
as the Linux poll(2) manpage describes using negative FD to
easily ignore an FD in a larger FD set while (sleeping the given
timeout).  I'm not entirely sure if matching poll() behavior
is a good idea for a single FD, but it's better than segfaulting
or NoMemoryError.

* thread.c (init_set_fd): ignore negative FD
* test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
  (test_wait_for_invalid_fd): check values which may trigger
  segfaults or OOM

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 08:26:47 +00:00
normal 71dca4b60d test for IO.copy_stream CPU usage (r58534)
I'm likely to make similar mistakes in the future when working
on Fiber auto-scheduling.  Start adding assertions for existing
code, first.

* test/ruby/test_io.rb (test_copy_stream_no_busy_wait): added
* test/lib/test/unit/assertions.rb (assert_cpu_usage_low): added

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 07:23:02 +00:00
ko1 b3a9fd0d1f apply timeout scale
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 02:01:41 +00:00
nobu 9f5a468cf9 numeric.c: fix for small number
* numeric.c (flo_floor, flo_ceil): should not return zero for small
  number.  [ruby-core:81394] [Bug #13599]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27 01:26:31 +00:00
nobu 5e7ce51911 dir.c: yield without base part
* dir.c (glob_helper): yield globbed part only without the base
  directory path part if the base is given.  [Feature#13056]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26 07:04:43 +00:00
ko1 7d52ed594e use timeout scale.
* test/lib/envutil.rb: introduce EnvUtil.apply_timeout_scale to use
  this scale from outside.

* test/ruby/test_thread.rb (test_fork_in_thread): respect timeout scale.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 23:43:33 +00:00
k0kubun eb1652b571 erb.rb: Add ERB#result_with_hash
[ruby-core:55985] [Feature #8631] [fix GH-1623]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 15:38:25 +00:00
eregon fd8df3ab3d Raise ArgumentError if sprintf format string ends with %
* Add tests and specs. See ruby/spec#401.
  Patch by Yuta Iwama and Shintaro Morikawa.
  [ruby-core:80153] [Bug #13315] [Fix GH-1560]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 15:33:28 +00:00
nobu 944c455b38 dir.c: Dir.each_child and Dir.children
* dir.c (dir_s_each_child, dir_s_children): Dir.each_child and
  Dir.children which are similar to Dir.foreach and Dir.entries
  respectively, except to exclude "."  and "..".  [Feature #11302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 02:50:21 +00:00
nobu 5a302b3098 test_dir.rb: test Dir.entries
* test/ruby/test_dir.rb (test_entries): test class singleton
  method Dir.entries too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-25 02:50:20 +00:00
normal 2079b71000 string.c: fix String#crypt leak introduced in r58866
* string.c (rb_str_crypt): define LARGE_CRYPT_DATA when allocating

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 21:26:14 +00:00
nobu c31de52fa5 test_http.rb: fix r58855
* test/net/http/test_http.rb (test_s_start): git rid of error when
  failed to start a connection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 13:30:54 +00:00
nobu 5e25bfa2fb enum.c: respect method visibility
* enum.c (ary_inject_op): should respect method visibility, do not
  optimize uncallable method.  [ruby-core:81349] [Bug #13592]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 08:00:42 +00:00
nobu da9d5db8bd test_enum.rb: test_inject_array_op_redefined
* test/ruby/test_enum.rb (test_inject_array_op_redefined): test
  other operators too.  [Bug#12178]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 07:57:19 +00:00
nobu 73d797ad48 assertions.rb: AllFailures#foreach
* test/lib/test/unit/assertions.rb (AllFailures#foreach):
  shortcircuit for `each` and `AllFailures#for`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 07:57:18 +00:00
nobu d7015ae4ee duplicate method
* test/ruby/test_enum.rb (assert_float_equal): remove overridden
  definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24 07:11:41 +00:00
naruse 6a15378169 skip on Solaris 11
On Solaris 11, MSG_OOB is in readfds?
http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-trunk/log/20170523T152403Z.fail.html.gz
http://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20170523T152503Z.fail.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 16:51:48 +00:00
nobu 6d06aadd8e Dir as base option
* dir.c (glob_helper): support Dir instance as `base` option.
  [Feature#13056]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 14:34:12 +00:00
nobu 58b6c42207 test_dir.rb: sort
* test/ruby/test_dir.rb (test_glob_base): sort the globbed result
  to compare.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 13:54:10 +00:00
nobu 52419a6e10 Dir.glob base option
* dir.c (dir_s_aref, dir_s_glob): add new optional keyword
  argument, `base`.  [Feature#13056]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 13:47:36 +00:00
nobu 0a2546842f fix FD leaks
* test/net/http/test_http.rb (test_s_start): finish connections to
  get rid of FD leaks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-23 12:38:01 +00:00
normal cbedbaf9d9 lib/net/protocol.rb: account read_bytes before caller sees it
Users may modify the chunk yielded to them in Net::HTTPResponse#read_body.
This will allow users to reduce memory usage by calling
String#clear on the buffer once they're done using it.

* lib/net/protocol.rb (read): increment read_bytes earlier
  (read_all): ditto
* test/net/http/test_httpresponse.rb (test_read_body_block_mod): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 07:36:00 +00:00
shugo 27fb27ff42 net/imap: separate @continuation_request_exception from @exception
Otherwise literal data will be sent even if NO response is returned
because @exception is set to nil in receive_responses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-22 06:13:11 +00:00
stomar 40bc846bf8 string.c: fix String#{casecmp,casecmp?} for non-string arguments
* string.c: make String#{casecmp,casecmp?} return nil for
  non-string arguments instead of raising a TypeError.

* test/ruby/test_string.rb: add tests.

Reported by Marcus Stollsteimer.  Based on a patch by Shingo Morita.
[ruby-core:80145] [Bug #13312]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21 19:28:48 +00:00
stomar 913afdf95c test_string.rb,test_symbol.rb: add some tests
* test/ruby/test_string.rb: add more test cases for String#casecmp.
* test/ruby/test_symbol.rb: ditto for Symbol#{casecmp,casecmp?}.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-21 19:27:08 +00:00
k0kubun 64c914706e erb.rb: Allow trimming CR in all trim_modes
to unify a behavior with r58823 and r58825.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:36:09 +00:00
k0kubun b82ed2ce61 erb.rb: Allow explicit trimming carriage return
when trim_mode is "-", for Windows environments.

[ruby-core:39625] [Bug #5339]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 17:17:22 +00:00
k0kubun 040f275690 erb.rb: Allow trimming carriage return
when trim_mode is "<>", for Windows environments.

[Bug #11464]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 16:50:33 +00:00
naruse a1b924f0f1 Clean proxy
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 15:58:16 +00:00
stomar 82092f4bb7 prime.rb: remove alias after timeout test
* test/test_prime.rb: remove alias after timeout test.

* lib/prime.rb: fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 10:21:44 +00:00
nobu 35c54a11b3 compile.c: fix catch-table labels optimization
* compile.c (remove_unreachable_chunk): do not eliminate chunks
  followed by labels in catch-table entries.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 02:11:24 +00:00
marcandre 68354c350a lib/prime: Fix primality of some large integers [#13492].
* lib/prime.rb: Use accurate sqrt to insure all factors are tested.
  Patch by Marcus Stollsteimer.

* test/test_prime.rb: Adapt test for timeout

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-20 00:36:55 +00:00
normal c018d46413 fix off-by-one in r58806
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 21:34:04 +00:00
normal b9f8fc510f test/ruby/test_io.rb: new test for IO.select exception set
Ensure this rarely-used feature of IO.select continues
to work properly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 21:33:15 +00:00
naruse 67723c1e46 Net::HTTP#start now pass :ENV to p_addr by default [Bug #13351]
To avoid this, pass nil explicitly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 15:13:42 +00:00
naruse 7be47caa88 Merge latest dtoa.c [Bug #13545]
Apply some part of http://www.netlib.org/fp/dtoa.c with my eyes...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 14:14:52 +00:00
usa a4d51619e9 Of course, opened file is not able to unlink on Windows
* test/test_tempfile.rb (test_create_with_block): close the tempfile before
  unlink.  fixed a failure on Windows introduced at r58791.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 12:44:46 +00:00
shugo 84c1596342 net/imap: Net::IMAP#append should not block when NO response is received
[ruby-dev:50129] [Bug#13579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:25:52 +00:00
nobu 3c5344bf30 tempfile.rb: remove in Tempfile.create
* lib/tempfile.rb (Tempfile.create): should not fail even if the
  temporary file has been removed in the block, just ignore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:20:14 +00:00
k0kubun c26a9a7338 Fix strange indentation
which I introduced at r58773.
Hard tabs and spaces are mixed...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-18 15:13:30 +00:00
k0kubun e1b4327545 cgi/util.rb: Don't escape tilde in #escape
to make it compatible with ERB::Util.url_encode.

ext/cgi/escape/escape.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 12:34:59 +00:00
k0kubun 53127c2410 erb.rb: Don't encode tilde in #url_encode
Based on patch by madeofcode (Mark Dodwell).
[ruby-core:46168] [Bug #6696] [Fix GH-54]

`~` is a unreserved character.
https://tools.ietf.org/html/rfc3986#section-2.3

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 11:58:09 +00:00
nobu a0b6e36609 test_dir_m17n.rb: read in filesystem encoding
* test/ruby/test_dir_m17n.rb (test_entries_compose): read in
  filesystem encoding instead of default external encoding on
  Windows too.  these two encodings may differ on some
  environments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-17 00:28:01 +00:00
normal 8dbf0f2ac7 Revert "test/test_extilibs.rb: do not check the existence of fiddle"
This reverts r58761 since fiddle is considered critical.
[ruby-core:81201] [ruby-core:81203]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 23:59:01 +00:00
normal c836e8ddd5 test/test_extilibs.rb: do not check the existence of fiddle
libffi is not installed on all systems, and is not needed
for most of the tests.

Tested on a fresh FreeBSD 11.0 VM

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 22:05:39 +00:00
nobu fab2a5ed6b test/unit.rb: fix returning job tokens
* test/lib/test/unit.rb (_run_parallel): flush job tokens after
  quitting workers when normally finished too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 15:17:39 +00:00
nobu ec5184afa7 test_process.rb: compare in UTF-8
* test/ruby/test_process.rb (test_execopts_open_chdir_m17n_path):
  compare directory name in UTF-8.  encoding of `Dir.pwd` is
  affected by filesystem encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 14:53:04 +00:00
hsbt 87acdae43d Strip punctuation from CSV headers in symbol converter.
Patch by @cllns. [Fix GH-957]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 09:32:32 +00:00
hsbt 3b77cb2a64 Added accessor of original line when parsing.
[Feature #11865][ruby-core:72452][fix GH-1170]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 09:17:09 +00:00
naruse 0e7c81a713 fix words
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 05:02:23 +00:00
ko1 a9b001a4eb skip openssl related tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16 04:23:10 +00:00
usa a852853f44 Should call `ln_s` only when symlink is available
* test/fileutils/test_fileutils.rb (test_ln_s): skip if symlink is not
  available.

* test/fileutils/test_fileutils.rb (test_ln_s): remove created symlink
  certainly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-15 07:35:26 +00:00
normal fba0b81e18 test/socket/test_basicsocket.rb (socks): bind explicitly to localhost
Binding to a potentially public IP in a test can cause problems
if hit by a random port scanner or something...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-15 07:33:10 +00:00