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

9710 Коммитов

Автор SHA1 Сообщение Дата
nobu 6ce158ba87 fix typo [ci skip]
* lib/rubygems/specification.rb: reapply 56225.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-30 12:08:00 +00:00
hsbt 9a21c28426 * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
rubygems to 2.6.8.
  Release note of 2.6.8: 9fb8880976

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-30 06:32:48 +00:00
nobu e981862fc9 parse.y: !-operator warning
* parse.y (cond0): !-operator is a method call, no warning for
  literal in condition.  [ruby-core:77801] [Bug #12881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29 10:59:39 +00:00
nobu af1b9db40b compile.c: not flip-flop
* compile.c (iseq_compile_each): turn flip-flop in a not-operator
  into a boolean value.  fix up r56315

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29 01:09:40 +00:00
nobu 693eabb2be vm_eval.c: follow the original class
* vm_eval.c (vm_call0_body): follow the original class, not to
  loop the prepended module.  [ruby-core:77784] [Bug #12876]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-29 00:39:16 +00:00
nobu 703cc6748f test/unit.rb: no file name if idle [ci skip]
* test/lib/test/unit.rb (Test::Unit::Parallel::Worker#to_s): show
  file name if not idling.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 15:28:54 +00:00
nobu b24e093296 Update windows-1255 table
* enc/trans/windows-1255-tbl.rb: update mapping from 0xCA to
  U+05BA.  [Feature #12877]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-28 15:14:32 +00:00
nobu 07acd05ffb test/digest/test_digest.rb: fold long lines
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-27 06:26:09 +00:00
nobu c94855855e object.c: fixable float to fixnum
* object.c (rb_convert_to_integer): convert a fixable float to a
  fixnum directly without the convesion method, as well as bignum
  case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-27 00:42:11 +00:00
nobu 9396660a4a object.c: use converted string
* object.c (rb_convert_to_integer): should not drop the converted
  string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-27 00:12:33 +00:00
nobu d977cd4e0a proc.c: follow the original class
* proc.c (mnew_internal): follow the original class, not to loop
  the prepended module.  [ruby-core:77591] [Bug #12832]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-25 03:54:09 +00:00
nobu e62586fd74 test_thread.rb: count accurately
* test/ruby/test_thread.rb (test_thread_timer_and_interrupt):
  count only signal handling time accurately without setup and
  cleanup time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 03:46:51 +00:00
nobu 3bf10b0464 test/unit.rb: show idling workers
* test/lib/test/unit.rb (Test::Unit::Parallel#deal): update the
  job status after a task finished, to show idling workers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:52:19 +00:00
nobu 052690309a complex.c: undefine Comparable methods
* complex.c (Init_Complex): undefine methods inherited from
  Comparable, because Complex does not have <=> method.
  [Bug #12866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:51:10 +00:00
nobu 3bda73868f refine assertions
* test/ruby/test_complex.rb, test/ruby/test_rational.rb: refine
  assertions for descriptive messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:34:06 +00:00
nobu 7a9812209d complex.c: undefine clamp
* complex.c (Init_Complex): undefine Complex#clamp, which does not
  work like other Comparable methods, because Complex does not
  have <=> method.  patched by Tim Peters <zomg.tim AT gmail.com>
  in [ruby-core:77720].  [Bug #12866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-24 01:19:46 +00:00
nobu 9be1910ae0 test_refinement.rb: Symbol#to_proc test
* test/ruby/test_refinement.rb (test_symbol_proc): a Symbol is
  converted to a Proc in the caller's context.  [Feature #9451]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-23 02:03:56 +00:00
nobu bd3eb8afec numeric.c: fix up r55891
* numeric.c (num_funcall1): check recursion by inverse pair, to
  fix fake infinite recursion.  [ruby-core:77713] [Bug #12864]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22 13:33:34 +00:00
nobu 4154b96068 hash.c: fix Hash#compact! return value
* hash.c (rb_hash_compact_bang): should return nil if no elements
  is deleted.  [ruby-core:77709] [Bug #12863]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22 09:52:35 +00:00
nobu d506a3521c compile.c: order with splatting
* compile.c (setup_args): duplicate splatting array if more
  arguments present to obey left-to-right execution order.
  [ruby-core:77701] [Bug# 12860]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-22 00:52:59 +00:00
nobu e1ff9d68ab fix r56467
* test/ruby/test_dir.rb (test_glob_gc_for_fd): needs
  RLIMIT_NOFILE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 07:55:09 +00:00
nobu 5d20d347c7 dir.c: retry glob with GC
* dir.c (do_opendir): retry after GC when the limit for open file
  descriptors reached.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 07:44:46 +00:00
nobu 0ce605225f test_require.rb: reduce GC
* test/ruby/test_require.rb (test_loading_fifo_fd_leak): invoke GC
  only when FDs exhausted to reduce the test time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-21 02:38:04 +00:00
nobu a6ed6e2b42 test_proc.rb: improve curry tests
* test/ruby/test_proc.rb (test_curry): split.

* test/ruby/test_proc.rb (test_curry_passed_block): simplify the
  assertion.

* test/ruby/test_proc.rb (test_curry_with_trace): run all curry
  tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-20 07:59:44 +00:00
nobu c8fee08a3d vm_insnhelper.c: refinements with send
* vm_insnhelper.c (vm_call_opt_send): enable refinements with
  Kernel#send and BasicObject#__send__.  [Feature #11476]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-19 08:02:17 +00:00
duerst 64b62f40a5 * enc/windows_1254.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1254.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-16 06:09:08 +00:00
nobu 64efbf246e test_io.rb: use assert_not_predicate
* test/ruby/test_io.rb (test_DATA_binmode): assert_not_predicate
  for more descriptive message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15 23:34:27 +00:00
nobu 9ec940a4c9 test_refinement.rb: test_symbol_proc
* test/ruby/test_refinement.rb (test_symbol_proc): move from
  test_symbol.rb  [Feature #9451]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15 22:59:39 +00:00
nobu 9ffaf1405b test_refinement.rb: using without eval
* test/ruby/test_refinement.rb (FooExtClient, FooExtClient2): no
  needs to eval, using works in a class block now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15 22:59:38 +00:00
kazu 371e3f4f1c Add test of DATA.binmode?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15 15:45:04 +00:00
nobu 35a2939019 vm_args.c: allow refinements in Symbol proc
* vm_args.c (refine_sym_proc_call): search and call method with
  refinements.
* vm_args.c (vm_caller_setup_arg_block): enable refinements when
  enabled in the caller.  [Feature #9451]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-15 05:17:07 +00:00
nobu 5d4309d068 process.c: use uaspawn
* process.c (proc_exec_cmd): use UTF-8 version aspawn.
  [ruby-dev:49838] [Bug #12841]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14 15:54:03 +00:00
nobu 0687baaf57 optparse/kwargs.rb
* lib/optparse/kwargs.rb (OptionParser#define_by_keywords):
  [EXPERIMENTAL] extract command line option definitions from the
  information of keyword arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14 13:26:13 +00:00
nobu 99ad512486 optparse.rb: hyphenize
* lib/optparse.rb (make_switch, parse_in_order): unify underscores
  to hyphens.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14 08:20:26 +00:00
nobu 34d420acc4 io.c: copy_stream to duplex IO
* io.c (copy_stream_body): use IO to write to copy to duplex IO.
  http://twitter.com/knu/status/786505317974585344

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13 10:41:34 +00:00
nobu bbd58fa2b9 hash.c: add compact and compact! methods
* hash.c (rb_hash_compact, rb_hash_compact_bang): Removes nil
  values from the original hash, to port Active Support behavior.
  [Feature #11818]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13 08:06:00 +00:00
nobu 7e9112a441 Fix tests depending on sort stability
* test/rexml/xpath/test_text.rb (test_ancestors): Array#sort may
  not be stable.  [ruby-core:76088] [Bug #12509]
* test/rss/test_maker_{0.9,1.0,2.0}.rb (test_items): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13 02:31:43 +00:00
nobu 89230e7ca3 test_array.rb: do not assume stable sort
* test/ruby/test_array.rb (test_sort_bang_with_freeze): make a
  clone to copy a <=> singleton method, instead of dup.  which
  element will be called is not predictable.
  [ruby-core:76088] [Bug #12509]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12 15:39:10 +00:00
nobu 9d8f62d55e better assertion
* test/rexml/xpath/test_text.rb (test_ancestors): use
  assert_kind_of for better assertion message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12 15:29:06 +00:00
kazu c29026204e fix warning: assigned but unused variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12 15:28:03 +00:00
kazu 0c7a092dd2 do not need to downcase twice
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12 15:28:01 +00:00
akr 2db9a0db99 Test URI.find_proxy using env argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-11 17:23:29 +00:00
nobu 8c3af8ecc0 ruby.c: bind fd before waiting
* ruby.c (open_load_file): bind the open fd to an IO instance
  before waiting FIFO, not to leak the fd if interrupted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-10 06:22:30 +00:00
nobu a28d3d591d test_require.rb: use assert_separately
* test/ruby/test_require.rb (test_loading_fifo_threading_raise):
  use assert_separately.

* test/ruby/test_require.rb (test_loading_fifo_threading_success):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-10 06:14:07 +00:00
nobu f0e1d72316 memory_status.c: system call
* ext/-test-/memory_status/memory_status.c: get memory sizes by
  mach task_info system call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-08 01:34:27 +00:00
nobu 8fc170a34e logger: fix monthly log rotate with DST
* lib/logger.rb (Logger::Period#next_rotate_time): fix monthly log
  rotate when DST is applied during a month of 31 days.
  [Fix GH-1458]

With DST the month of october can actually last more than 31 days.
It can last 31 days plus 1 hour. So during october, `t` used to be
equal to "2016-10-31 23:00:00" instead of "2016-11-01 00:00:00".
This was then normalized to "2016-10-01 00:00:00" which lead every
single line of log during october to rotate the log file.
This fix ensure that next_rotate_time(now, 'monthly') always return
the first day of next month in every situation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-08 00:06:57 +00:00
hsbt 6b35c34c68 * basictest/test.rb: Adjust spaces in class declarations
with inheritance. [fix GH-1227] Patch by @adrfer
* lib/irb/*: ditto.
* lib/prime.rb: ditto.
* lib/shell/builtin-command.rb: ditto.
* object.c: ditto.
* sample/*.rb: ditto.
* test/-ext-/method/test_arity.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-07 05:18:57 +00:00
nobu d3cde81666 load.c: setup syntax error backtrace
* load.c (rb_require_safe): SyntaxError created by the parser just
  has the mesage and needs to set up the backtrace.
  [ruby-core:77491] [Bug #12811]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 08:29:46 +00:00
nobu 24b37eb0a6 load.c: fix load/require context
* load.c (rb_load_internal0): load/require is not the main
  script.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 06:53:22 +00:00
nobu 0fe40d4bb8 test_io.rb: split test_gets_rs
* test/ruby/test_io.rb (test_gets_rs): split for each record
  separators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-06 03:53:34 +00:00
nobu 8b583a013a test_io.rb: workaround for Docker
* test/ruby/test_io.rb (test_ioctl_linux2): tty device may not
  work on Docker.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-05 07:01:31 +00:00
marcandre 69846644d2 * enum.c: Make Enumerable#chunk with no block return
an Enumerator [#2172]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 18:25:16 +00:00
nobu cc80f139cd bigdecimal.c: more precision
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2): need more room
  for precision to round.  [ruby-core:77475] [Bug #12805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-04 00:55:15 +00:00
nobu 402f042689 rl_char_is_quoted_p
* ext/readline/readline.c (readline_s_set_quoting_detection_proc):
  support rl_char_is_quoted_p.  [Feature #12659]
* ext/readline/readline.c (readline_s_get_quoting_detection_proc):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-03 08:20:07 +00:00
nobu 8c401de5d9 compile.c: optimize flip-flop
* compile.c (compile_flip_flop): simplify generated code.
* compile.c (compile_branch_condition): flip-flop can appear only
  in coditional expressions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-01 10:19:36 +00:00
nobu ed2af78b67 test_flip.rb: add
* test/ruby/test_flip.rb (test_flip_flop): basic test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-30 12:46:53 +00:00
hsbt 107ba65fba * lib/uri/http.rb: Documentation and code style imrovements.
* test/uri/test_http.rb: Added test for coverage.
  [fix GH-1427][ruby-core:77255][Misc #12756]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-30 10:06:24 +00:00
nobu d84d0f27b9 test_range.rb: all assertions
* test/ruby/test_range.rb (test_range_bsearch_for_floats): test
  all assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-30 04:02:17 +00:00
kazu 158cf62b53 fix YAML::Store
* lib/yaml/store.rb (YAML::Store#initialize): Fix arguments.
  [ruby-dev:49821] [Bug #12800]

* test/yaml/test_store.rb: Add tests from test/test_pstore.rb.

* test/yaml/test_store.rb (YAMLStoreTest#test_with_options): Add options test.

* lib/yaml/store.rb (YAML::Store#dump): Revert to to_yaml.

* lib/yaml/store.rb (YAML::Store#empty_marshal_data): Use to_yaml with options.

* lib/yaml/store.rb (YAML::Store#empty_marshal_checksum): Use CHECKSUM_ALGO.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-29 13:43:46 +00:00
nobu d90b767d2b test_pstore.rb: use queues
* test/test_pstore.rb (PStoreTest#test_thread_safe): handshake by
  queues, and reduce sleeping time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-28 14:12:33 +00:00
nobu b6139464f5 rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
  rubygems to 2.6.7, not the master, with r56225.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-28 01:16:43 +00:00
nobu 69934aeb8d rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
  rubygems to 2.6.7.
  Release note of 2.6.7: 60f35bd1d2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-28 00:57:53 +00:00
nobu d28bac1cae error.c: check argument of Warning.warn
* error.c (rb_warning_s_warn): the argument must be an
  ASCII-compatible string.  [ruby-core:77430] [Bug #12793]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 15:21:01 +00:00
nobu 3d2e45d319 parse.y: fix up r56198
* parse.y (symbol, dsym, parser_set_number_literal): set state to
  ENDARG, so that `do` after a literal should be `do_block` and
  bound to the outer method.  [ruby-core:72482] [Bug #11873]
* parse.y (parse_ident): revert r56198.
* parse.y (warn_balanced): the state of symbol and numeric
  literals is now EXPR_ENDARG, do not exclude it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 14:22:33 +00:00
nobu 0e547e6392 test_syntax.rb: more test_warn_balanced
* test/ruby/test_syntax.rb (test_warn_balanced): more assertions
  for a symbol literal and a local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 14:19:32 +00:00
kazu 078dcd267d * test/ripper/test_ripper.rb: fix squiggly heredoc identifier
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 12:13:52 +00:00
shyouhei 4e60f99803 * error.c: This makes all warnings raised call Warning.warn, which
by default does the same thing it does currently
	  (rb_write_error_str).  You can override Warning.warn to change
	  the behavior. [ruby-core:75016] [Feature #12299]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 09:19:14 +00:00
nobu a38b2f84f4 iseq.c: syntax error in compile_file
* iseq.c (iseqw_s_compile_file): deal with syntax error as well as
  compile, and should not abort when rescued.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 08:35:31 +00:00
nobu 2ca58e4290 assertions.rb: success option
* test/lib/test/unit/assertions.rb (assert_in_out_err): add
  success option to check the exit status.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 08:35:30 +00:00
naruse 5f33c6b0f5 * lib/cgi/cookie.rb (parse): don't allow , as a separator. [Bug #12791]
* lib/webrick/cookie.rb (parse): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27 03:17:47 +00:00
headius fbaa823344 * test/ripper/test_ripper.rb: add a test for dedent_string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 21:12:12 +00:00
nobu 91a32fc030 test_exception.rb: another assertion
* test/ruby/test_exception.rb (test_throw_false): test the thrown
  tag.  [Bug #12743]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 07:33:16 +00:00
rhe e6e66094f9 stringio.c: fix signed integer overflow
* ext/stringio/stringio.c (strio_seek): Avoid signed integer overflow.
  It's not harmful in practice here, but is still undefined behavior.

* ext/stringio/stringio.c (strio_extend): Check that the new length does
  not exceed LONG_MAX. This fixes the invalid write on the overflow.

* test/stringio/test_stringio.rb (test_write_integer_overflow): Add a
  test case for the above fix in strio_extend().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 07:24:55 +00:00
rhe ed5a926b13 eval_intern.h: make TH_PUSH_TAG() initialize rb_vm_tag::tag with Qundef
* eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with
  Qundef rather than 0 which is equal to Qfalse. Since Kernel#throw(obj)
  searches a tag with rb_vm_tag::tag == obj, throw(false) can
  accidentally find an unrelated tag which is not created by
  Kernel#catch.  [ruby-core:77229] [Bug #12743]

* test/ruby/test_exception.rb (test_throw_false): Add a test case for
  this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 06:43:51 +00:00
sonots 64f53f0dbf * lib/tempfile.rb: provide default basename parameter
for Tempfile.create. [Feature #11965] Patch by Yuki Kurihara
* test/test_tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 05:45:29 +00:00
nobu 5ebce690df test_dln.rb: fix constants
* test/-ext-/win32/test_dln.rb (test_check_imported): use toplevel
  constants explicitly to get rid of constants under the scope.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-25 22:29:16 +00:00
nobu 0cc169d1de fid typos [ci skip]
* fix typos, "a" before "Integer" to "an".  [Fix GH-1438]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-24 02:28:25 +00:00
nobu 967c013391 test_ruby_mode.rb: fix for Emacs 25.1
* test/misc/test_ruby_mode.rb (assert_indent): since write-region
  in Emacs 25.1 no longer displays the "Wrote file" message, shows
  the explicit message to check if successfully finished.
  [ruby-core:77355] [Bug #12785]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-24 01:19:43 +00:00
nobu 569d006295 test_ruby_mode.rb: save-buffer 0
* test/misc/test_ruby_mode.rb (EXPR_SAVE): use a numeric prefix
  argument of 0, not to make the previous version into a backup
  file, instead of backup-inhibited.
* test/misc/test_ruby_mode.rb (run_emacs): always save the buffer
  if modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-24 01:18:34 +00:00
shugo a463ab1f05 * eval.c (rb_mod_refine): refine modules as well.
[ruby-core:76199] [Feature #12534]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-23 11:46:33 +00:00
nobu 1e1a114c25 test_fileutils.rb: use Dir.mktmpdir
* test/fileutils/test_fileutils.rb: use Dir.mktmpdir instead of
  fixed name for temporary directory.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-23 05:27:38 +00:00
nobu 958c04898c dlntest.dll: move
* ext/-test-/win32/dln/{depend,extconf.rb} (dlntest.dll): make
  under the extension directory, instead of the top directory.

* test/-ext-/win32/test_dln.rb (test_check_imported): explicit
  PATH environment variable to load the DLL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-22 06:35:27 +00:00
nobu f4ac0d75d9 parse.y: preserve cmdarg_stack
* parse.y (brace_body, do_body): preserve cmdarg_stack so that
  `do` after cmdarg in a block should be `do_block` and bound to
  the outer method.  [ruby-core:72482] [Bug #11873]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21 04:47:35 +00:00
nobu c924e2db96 parse.y: do after cmdarg in paren
* parse.y: `do` after cmdarg in parentheses should be `do_block`
  and bound to the outer method.  [ruby-core:72482] [Bug #11873]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-21 04:38:46 +00:00
rhe 014da9124a openssl: really fix test failure on Ubuntu 16.04
* test/openssl/test_ssl.rb (test_ctx_options): Fix test failure on
  Ubuntu 16.04. The fix in r56147 was incomplete. This is a cherry-pick
  of the commit b039f3e268c2 at ruby/openssl.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-17 10:19:25 +00:00
tenderlove 45e8ccde00 Use JSON lines format for full heap dumps.
This commit changes full heap dumps back to using JSON lines format
(http://jsonlines.org) so that we can process very large heaps without
loading the entire heap in to memory at once.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-16 17:44:45 +00:00
tenderlove c2cbd5528c Don't include bad password in URI exception output
We shouldn't include the bad password in the URI exception output
message.  Just knowing that there is a bad password is enough
information.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-15 21:44:56 +00:00
ko1 d4faa1013e * test/ruby/test_exception.rb: fix thread issues.
* use Queue instead of a local variable for synchronization.
  * join created thread to soleve leaking threads warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 09:39:08 +00:00
rhe be3baa4380 string.c: fix buffer overflow check condition in rb_str_set_len()
* string.c (rb_str_set_len): The buffer overflow check is wrong. The
  space for termlen is allocated outside the capacity returned by
  rb_str_capacity(). This fixes r41920 ("string.c: multi-byte
  terminator", 2013-07-11).  [ruby-core:77257] [Bug #12757]

* test/-ext-/string/test_set_len.rb (test_capacity_equals_to_new_size):
  Test for this change. Applying only the test will trigger [BUG].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 07:08:15 +00:00
rhe b4d0e5a4fb openssl: workaround for Ubuntu's patched OpenSSL
* test/openssl/test_ssl.rb (test_ctx_options): Add a workaround for
  patched OpenSSL to fix the Ruby CI failure on Ubuntu 16.04.
  http://rubyci.s3.amazonaws.com/ubuntu/ruby-trunk/log/20160913T033003Z.fail.html.gz
  This commit is a cherry-pick of the following commit at ruby/openssl:
  f9c04779a8

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 05:59:53 +00:00
hsbt 52f9d387e6 * lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
with class method.
* test/uri/test_mailto.rb: Added tests for coverage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-12 04:46:27 +00:00
nobu 7f6410f02d json_generator_test.rb: no Bignum
* test/json/json_generator_test.rb (test_broken_bignum): get rid
  of use of Bignum, obsolete name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 09:27:38 +00:00
nobu 646c53895f thread.c: set cause by Thread#raise
* thread.c (rb_threadptr_raise): set cause from the called thread,
  but not from the thread to be interrupted.
  [ruby-core:77222] [Bug #12741]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 08:59:48 +00:00
nobu 6054e6d65e variable.c: fix deprecated constant message
* variable.c (rb_const_search): warn with the actual class/module
  name which defines the deprecated constant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 01:10:01 +00:00
nobu a3cc3cc5c9 variable.c: fix private constant message
* variable.c (rb_const_search): raise with the actual class/module
  name which defines the private constant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-09 01:07:41 +00:00
ktsj 1f8765bb2b * array.c (flatten): use rb_obj_class instead of rb_class_of
because rb_class_of may return a singleton class.
  [ruby-dev:49781] [Bug #12738]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 08:56:30 +00:00
shugo 5fac45dc30 * eval.c (rb_mod_s_used_modules): rename Module.used_refinements to
Module.used_modules.  [Feature #7418] [ruby-core:49805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 07:49:02 +00:00
shugo bbd662c8bd * insns.def (setclassvariable, setconstant): warn when self is a
refinement.  [Bug #10103] [ruby-core:64143]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 04:44:51 +00:00
mrkn eaa0a27f61 hash.c: map_v -> transform_values
* hash.c (rb_hash_transform_values, rb_hash_transform_values_bang):
  Rename map_v to transform_values.
  [Feature #12512] [ruby-core:76095]

* test/ruby/test_hash.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 02:33:18 +00:00
rhe a128c0d33f openssl: import v2.0.0.beta.2
* {ext,test}/openssl: Import Ruby/OpenSSL 2.0.0.beta.2. The full commit
  history since v2.0.0.beta.1 can be found at:
  https://github.com/ruby/openssl/compare/v2.0.0.beta.1...v2.0.0.beta.2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-08 01:09:19 +00:00
hsbt ba6ae341ba * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta2
Fixed ri parse defect with left-hand matched classes.
  https://github.com/rdoc/rdoc/pull/420

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 22:23:38 +00:00
svn 806eb7e14d * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 16:15:46 +00:00
shugo 4a660c72a3 * eval.c (rb_mod_s_used_refinements): new method
Module.used_refinements.  based on the patch by Charlie
  Somerville.  [Feature #7418] [ruby-core:49805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 16:15:45 +00:00
kazu d6e4975eaf Use our domain instead of other's domain
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 12:32:04 +00:00
nobu 047ca4ba1a timeout.rb: custom error message
* lib/timeout.rb (Timeout#timeout): add custom error message
  argument.  [Feature #11650]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 08:21:56 +00:00
ktsj b425d4f19a * lib/csv.rb (CSV::{Row,Table}#{each,delete_if}): returns an enumerator
if no block is given. [ruby-core:75346] [Feature #11058]

* test/csv/test_row.rb: add test for above.

* test/csv/test_table.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 06:06:09 +00:00
hsbt a9f63f98ff * ext/psych/*, test/psych/*: Update psych-2.1.1
This version fixed following pull requests.
  https://github.com/tenderlove/psych/pull/284
  https://github.com/tenderlove/psych/pull/276

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 03:16:15 +00:00
hsbt 46e5c5622f * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta1
This version is mostly same as r56072. It contains to remove code
  for Ruby 1.8

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 02:51:12 +00:00
hsbt 23863ff75d * lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016--
  https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-05 10:35:30 +00:00
nobu 4b298ad77a Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
rhe c9dc0164b8 import Ruby/OpenSSL 2.0.0.beta.1
* NEWS, {ext,test,sample}/openssl: Import Ruby/OpenSSL 2.0.0.beta.1.
  ext/openssl is now converted into a default gem. The full commit
  history since r55538 can be found at:
  https://github.com/ruby/openssl/compare/08e1881f5663...v2.0.0.beta.1
  [Feature #9612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 05:47:09 +00:00
rhe e9c410659e assertions.rb: add an alias pend for skip
* test/lib/test/unit/assertions.rb (pend): Add an alias 'pend' for
  'skip'. This is required for test-unit compatibility. In particular,
  ext/openssl uses it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 05:47:08 +00:00
nobu 9387ff7315 multiple arguments
* array.c (rb_ary_concat_multi): take multiple arguments.  based
  on the patch by Satoru Horie.  [Feature #12333]
* string.c (rb_str_concat_multi, rb_str_prepend_multi): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-27 01:26:17 +00:00
nobu f40be5e64a test_regex_casefold.rb: skip if no data file
* test/ruby/enc/test_regex_casefold.rb (setup): skip with error
  message if CaseFolding.txt does not present, instead of printing
  the message, which causes unknown command in parallel test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-26 16:08:40 +00:00
nobu d3e7e3cc8b test_ssl_server.rb: fix FD leak
* test/webrick/test_ssl_server.rb (assert_self_signed_cert): close
  underlying TCP socket to fix FD leak.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-23 02:05:24 +00:00
nobu c58c902576 test_psych.rb: close Tempfile
* test/psych/test_psych.rb (test_load_file_with_fallback): fix
  Tempfile leak.  https://github.com/tenderlove/psych/pull/288

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-23 01:34:42 +00:00
nobu c2bf7e6f7d string.c: rb_fs_setter
* string.c (rb_fs_setter): check and convert $; value at
  assignment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-23 01:15:04 +00:00
nobu bd6fe32691 string.c: $; name in error message
* string.c (rb_str_split_m): show $; name in error message when it
  is a wrong object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-22 17:10:00 +00:00
nobu 36b9a37a80 iseq.c: undef allocator
* iseq.c (Init_ISeq): undefine allocator of InstructionSequence,
  to get rid of segfaults at method call on uninitialized object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-22 00:02:59 +00:00
nobu ec8f8fa4c8 parse.y: lparen_arg statement
* parse.y (primary): allow parenthesised statement as a method
  argument.  [Feature #12686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-19 02:39:09 +00:00
nobu 2edcca66e3 test_rand.rb: refine probability test
* test/ruby/test_rand.rb (test_new_seed): refine probability of
  failure from 1/256 to 1/256**8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-18 03:19:24 +00:00
nobu ba1ef74f05 numeric.c: infinite recursion
* numeric.c (num_funcall0, num_funcall1): get rid of infinite
  recursion in fallback methods of Numeric.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13 14:08:03 +00:00
nobu 85512bdbde test_comparable.rb: fix clamp test
* test/ruby/test_comparable.rb (TestComparable#test_clamp): fix
  test.  the result which is not clamped should be the receiver.
  [Feature #10594]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13 14:04:21 +00:00
nobu 90d9255ec2 parse.y: chained assignments
* parse.y (command_asgn, arg): fix syntax errors with chained
  assignment with op assign.  [Bug #12669]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13 02:10:11 +00:00
nobu 5245e31426 parse.y: rescue modifier in rhs of op asgn
* parse.y (stmt, arg): rescue modifier in command op assignment
  should be limited to rhs only.  [ruby-core:75621] [Bug #12402]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-13 01:52:22 +00:00
nobu a49068f1cb error.c: fix newline in syntax error
* error.c (rb_syntax_error_append): fix newline in syntax error
  message to the beginning, not after file name and line number.
  [Feature #11951]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-12 03:50:33 +00:00
nobu d5a0b8e3cc Comparable#clamp
* compar.c (cmp_clamp): Introduce Comparable#clamp.  [Feature #10594]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-11 07:24:25 +00:00
marcandre 2401c512ef * lib/prime.rb: Optimize prime?
Adapted from patch by Jabari Zakiya [#12665]

* test/test_prime.rb: Improve test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10 18:17:41 +00:00
nobu 064ed74be4 parse.y: rescue modifier in rhs
* parse.y (command_asgn): rescue modifier in command assignment
  should be limited to rhs only.  [ruby-core:75621] [Bug #12402]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-10 08:26:46 +00:00
mrkn ea5184b939 hash.c: implement Hash#map_v and Hash#map_v!
* hash.c (rb_hash_map_v, rb_hash_map_v_bang): impelement Hash#map_v and
  Hash#map_v! [Feature #12512] [ruby-core:76095]

* test/ruby/test_hash.rb: add tests for above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-09 08:54:15 +00:00
nobu 9a9569b1c2 test_objectspace.rb: errors in a finalizer
* test/ruby/test_objectspace.rb (test_finalizer_with_super):
  adjust number of arguments to get rid of errors in a finalizer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-09 07:36:14 +00:00
naruse 303dc3c591 * ext/tk: Tk is removed from stdlib. [Feature #8539]
https://github.com/ruby/tk is the new upstream.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-09 06:44:45 +00:00
nobu d81e5593b7 test/unit.rb: no verbose in worker processes
* test/lib/test/unit.rb (Test::Unit::Parallel::Worker.launch):
  disable verbose flag in worker processes, get rid of unexpected
  output within marshaled results.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-08 05:04:36 +00:00
nobu 41d220441d deprecate TRUE,FALSE,NIL
* object.c (InitVM_Object): deprecate toplevel constants TRUE,
  FALSE, and NIL.  [Feature #12574]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-07 09:08:29 +00:00
normal 7513d54659 openssl: avoid undefined behavior on empty SSL_write
SSL_write(3ssl) manpage has this in the WARNINGS section:

       When calling SSL_write() with num=0 bytes to be sent the
       behaviour is undefined.

And indeed, the new test case demonstrates failures when
empty strings are used.  So, match the behavior of IO#write,
IO#write_nonblock, and IO#syswrite by returning zero, as the
OpenSSL::SSL::SSLSocket API already closely mimics the IO one.

* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal):
  avoid undefined behavior
* test/openssl/test_pair.rb (test_write_zero): new test
  [ruby-core:76751] [Bug #12660]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-06 21:50:10 +00:00
nobu e70df3a701 hash.c: env_name_new
* hash.c (env_enc_str_new): make string for an environment
  variable name or value.
* hash.c (env_name_new): make environment value string with the
  encoding for its name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-05 15:39:46 +00:00
nobu 9e1b9b9c8f hash.c: set encoding
* hash.c (env_assoc): the encoding of the value should be the
  locale, as well as other methods, [], fetch, values, etc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-04 02:54:32 +00:00
nobu 18cf70ebf6 parse.y: reg_fragment_enc_error
* parse.y (reg_fragment_enc_error): compile_error is different
  between parser and ripper.  [ruby-core:76397] [Bug #12651]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03 12:31:25 +00:00
nobu 83cfc94563 math.c: tanh overflow
* math.c (tanh): check overflows, and return +-1.0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-02 12:40:51 +00:00
svn 0a86f7ff71 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 05:55:36 +00:00
shyouhei 320ae01c5f Object#clone with freeze: false [Feature #12300]
* object.c (rb_obj_clone2): Allow Object#clone to take freeze:
	  false keyword argument to not freeze the clone.
  	  [ruby-core:75017][Feature #12300]

 	* test/ruby/test_object.rb (TestObject): test for it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 05:55:35 +00:00
hsbt 11a94f2a36 * ext/json/*, test/json/json_parser_test.rb: Update json-2.0.2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-01 03:16:30 +00:00
duerst 4abdd6c5aa * enc/iso_8859_2.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-2, by Yushiro Ishii.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-30 03:00:09 +00:00
nobu 01fb7e5b71 dtrace: wait command
* test/dtrace/helper.rb (DTrace::TestCase::READ_PROBES): wait
  the spawned command not to make a waiter thread.  fix up r55736.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 16:22:56 +00:00
nobu e7440de279 test: use assert_include
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 13:02:33 +00:00
nobu 7b3473a13a dtrace: chomp CR
* test/dtrace/helper.rb (DTrace::TestCase::READ_PROBES): chomp CR
  by pty.  fix up r55736.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 12:51:50 +00:00
duerst 7b2b2869c9 * enc/windows_1257.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1257, by Sho Koike.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 07:33:18 +00:00
duerst 14dd8a17e8 * enc/windows_1250.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1250, by Sho Koike.
* ChangeLog: Fixed order of previous two entries.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 07:19:43 +00:00
duerst aec1ac6e51 * enc/windows_1251.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1251, by Shunsuke Sato.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 06:54:18 +00:00
duerst c8a1d8b33b * enc/windows_1251.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1251, by Shunsuke Sato.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 06:30:39 +00:00
svn aa1bf14f9c * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 04:05:04 +00:00
duerst c2b500a000 * test/ruby/enc/test_case_comprehensive.rb: Add explicit skip test for
availability of Unicode data files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-26 04:05:03 +00:00
nobu ceff9c8dcb dtrace: simplify
* test/dtrace/helper.rb (DTrace::TestCase::RUBYBIN): simply
  substitute basename.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-24 21:43:05 +00:00
nobu 106445d144 dtrace: suppress an empty line
* test/dtrace/helper.rb (DTrace::TestCase#trap_probe): suppress
  an extra empty line to the controlling tty by dtrace on Darwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23 15:04:12 +00:00
nobu d98dd47313 dtrace: use miniruby instead of ruby-runner
* test/dtrace/helper.rb (DTrace::TestCase#trap_probe): ruby-runner
  cannot be the target of dtrace, use miniruby instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-23 14:59:25 +00:00
normal dafeebf12d webrick: filter out HTTP_PROXY for CGIHandler
* lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY
* test/webrick/test_cgi.rb (test_cgi_env): new test
* test/webrick/webrick.cgi (do_GET): new endpoint to dump env
  [ruby-core:76511] [Bug #12610]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-22 16:43:12 +00:00
duerst c6692d9410 * string.c (String#dump): Change escaping of non-ASCII characters in
UTF-8 to use upper-case four-digit hexadecimal escapes without braces
  where possible [Feature #12419].
* test/ruby/test_string.rb (test_dump): Add tests for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-22 08:13:38 +00:00
kazu 14a145095f fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 15:58:59 +00:00
nobu 6882b35460 enumerator.c: Enumerator::Lazy#uniq
* enumerator.c (lazy_uniq): new method Enumerator::Lazy#uniq.
  [Feature #11090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 08:44:08 +00:00
nobu 42c6a5137e enum.c: Enumerable#uniq
* enum.c (enum_uniq): new method Enumerable#uniq.
  [Feature #11090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-20 08:39:12 +00:00
nobu 6ea002a7a2 variable.c: exclude private constants
* variable.c (rb_local_constants_i): exclude private constants
  when excluding inherited constants too.  [Bug #12345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-19 06:39:01 +00:00
mrkn 94468b4ea5 numeric.c, complex.c: Add finite? and infinite? consistent with Float
* numeric.c (num_finite_p, num_infinite_p): Add Numeric#finite? and
  Numeric#infinite?  [Feature #12039] [ruby-core:73618]

* complex.c (rb_complex_finite_p): Add Complex#finite?

* complex.c (rb_complex_infinite_p): Add Complex#infinite?

* test/ruby/test_bignum.rb: Add test for Integer#finite? and
  Integer#infinite?

* test/ruby/test_fixnum.rb: ditto.

* test/ruby/test_rational.rb: Add test for Rational#finite? and
  Rational#infinite?

* test/ruby/test_complex.rb: Add test for Complex#finite? and
  Complex#infinite?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-17 14:53:00 +00:00
nobu 5292b2727a util.c: do not underflow
* util.c (ruby_strtod): do not underflow only by preceeding zeros,
  which may be canceled out by the exponent.
  http://twitter.com/kazuho/status/753829998767714305

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-15 08:08:59 +00:00
hsbt bdda54c064 * test/json/json_common_interface_test.rb: use assert_raise instead of
assert_raises.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 13:27:08 +00:00
hsbt a7b5d45466 * test/lib/test/unit.rb: added test files with `_test` suffix for json
upstream.
* test/json: merge original test files from json upstream.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 13:27:07 +00:00
duerst 2ac58e6891 * enc/iso_8859_9.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-9, by Kazuki Iijima.
* enc/iso_8859_9.c: Exclude dotless i/I with dot from case-insensitive
  matching because they are not a case pair.
* test/ruby/enc/test_iso_8859.rb: Make test coverage for ISO-8859-9
  a bit more complete.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 09:09:47 +00:00
duerst 9f74ae4cf5 * enc/windows_1252.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for Windows-1252, by Serina Tai.
* test/ruby/enc/test_case_comprehensive.rb: Fix order of encodings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 08:21:29 +00:00
duerst 6a52a5488a * enc/iso_8859_7.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-7, by Kosuke Kurihara.
* test/ruby/enc/test_case_comprehensive.rb: Fix order of encodings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 07:19:25 +00:00
ko1 d7eb7bbcce * gc.c (gc_mark_roots): should mark the VM object itself to mark
singleton class of the VM object.
  Before this patch, we only set mark bit for the VM object and
  invoke mark function separately.
  [Bug #12583]

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 07:08:32 +00:00
duerst e3600eaca1 * enc/iso_8859_5.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-5, by Masaru Onodera.
* test/ruby/enc/test_case_comprehensive.rb: Fix order of encodings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 05:40:12 +00:00
ko1 d8c3672b01 * iseq.c (Init_ISeq): undef ISeq.translate and ISeq.load_iseq
to prevent calling super classes' methods.

  Without this patch, you can write workaround like:

    class << RubyVM::InstructionSequence
      def translate; end
      undef translate
    end

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 05:26:00 +00:00
duerst 336b6b1980 * enc/iso_8859_13.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-13, by Kanon Shindo.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 01:50:17 +00:00
duerst 19b5e818dd * enc/iso_8859_3.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-3, by Takuya Miyamoto.
* test/ruby/enc/test_case_comprehensive.rb: Extend special treatment
  for Turkic.
* enc/iso_8859_3.c: Exclude dotless i/I with dot from case-insensitive
  matching because they are not a case pair.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13 00:02:34 +00:00
duerst 0e29256175 * test/ruby/enc/test_iso_8859.rb: Excluded dotless i/I with dot from
case-insensitive matching because they are not a case pair.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 23:40:26 +00:00
duerst 7c0cb4351a * revert r55642 (previous commit) because of test failure at
https://travis-ci.org/ruby/ruby/builds/144148780


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 12:59:46 +00:00
duerst 7b66f0bae9 * enc/iso_8859_3.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-3, by Takuya Miyamoto.
* test/ruby/enc/test_case_comprehensive.rb: Extend special treatment
  for Turkic.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12 12:33:17 +00:00
duerst 07ac66ccec * enc/iso_8859_10.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-10, by Toya Hosokawa.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-10 10:53:45 +00:00
duerst 8f0b58d36a * test/ruby/enc/test_case_comprehensive.rb: Changed testing logic in to
catch unintended modifications of characters that do not have a case
  equivalent in the respective encoding.
* enc/iso_8859_1.c, enc/iso_8859_15.c: Fixed unintended modifications of
  micro sign and y with diaeresis.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-10 10:33:51 +00:00
duerst 3a2553c356 * enc/iso_8859_4.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-4, by Kotaro Yoshida.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-10 08:05:39 +00:00
duerst 0657672a0c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e 2016-07-10 07:14:34 +00:00
nobu 295f60b94d util.c: round nearly middle value
* util.c (ruby_dtoa): [EXPERIMENTAL] adjust the case that the
  Float value is close to the exact but unrepresentable middle
  value of two values in the given precision, as r55604.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-10 05:27:27 +00:00
naruse c016898e79 * vm_args.c (setup_parameters_complex): don't raise ArgumentError
if an array is given for instance_exec with optional argument.
  [ruby-core:76300] [Bug #12568]
  https://github.com/rails/rails/pull/25699

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 18:59:38 +00:00
naruse e4d4172bef suppress warnings: unused variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 18:59:38 +00:00
shugo 68260018df * vm_args.c (vm_caller_setup_arg_block): disable symbol block
argument optimization when tail call optimization is enabled,
  in order to avoid SEGV.  [ruby-core:76288] [Bug #12565]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 11:08:52 +00:00
nobu 9bb27fa318 numeric.c: round nearly middle value
* numeric.c (flo_round): [EXPERIMENTAL] adjust the case that the
  receiver is close to the exact but unrepresentable middle value
  of two values in the given precision.
  http://d.hatena.ne.jp/hnw/20160702

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 07:37:55 +00:00
nobu 415059abf1 io.c: convert arguments just once
* io.c (rb_io_s_foreach, rb_io_s_readlines): convert arguments
  just once before reading, instead of conversions for each lines.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-07 07:31:09 +00:00
naruse 8667e8b186 require "rbconfig/sizeof"
They may fail parallel test-all

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 18:17:36 +00:00
duerst 1edb021b5c * enc/iso_8859_14.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-14, by Yutaro Tada.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 10:54:24 +00:00
duerst 6fb97b3f32 * enc/iso_8859_15.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-15, by Maho Harada.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 09:59:23 +00:00
duerst 79b1758b65 * enc/iso_8859_16.c, test/ruby/enc/test_case_comprehensive.rb:
Implement non-ASCII case conversion for ISO-8859-16, by Satoshi Kayama.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 09:34:23 +00:00
shugo c74aaed016 Add an assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 00:16:17 +00:00
shugo 554c879f1f * lib/net/http/generic_rquest.rb (write_header): A Request-Line must
not contain CR or LF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 00:01:20 +00:00
shugo 34a0e098f7 * lib/net/ftp.rb (putline): raise an ArgumentError when
CR or LF is included in a line.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 22:14:18 +00:00
hsbt 1130658738 * ext/json/*, test/json/*: Update json-2.0.1.
Changes of 2.0.0: f679ebd0c6/CHANGES.md (2015-09-11-200)
  Changes of 2.0.1: f679ebd0c6/CHANGES.md (2016-07-01-201)
  [Feature #12542][ruby-dev:49706][fix GH-1395]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-05 11:49:39 +00:00
duerst 4a41a0f7d6 * test/ruby/enc/test_case_comprehensive.rb, test_regex_casefold.rb,
test/test_unicode_normalize.rb: Replace UNICODE_VERSION from
  UnicodeNormalize with RbConfig::CONFIG['UNICODE_VERSION'] from
  feature 12460.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-03 09:51:46 +00:00
naruse 79f86a67d0 * lib/uri/mailto.rb (initialize): RFC3986_Parser#split sets opaque
only if the URI has path-rootless, not path-empty.
  [ruby-core:76055] [Bug #12498]
  patched by Chris Heisterkamp <cheister@squareup.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-02 09:05:05 +00:00
naruse 1e3fc7dcfa * regcomp.c (noname_disable_map): don't optimize out group 0
Ruby's Regexp doesn't allow normal numbered groups if the regexp
  has named groups. On such case it optimizes out related NT_ENCLOSE.
  But even on the case it can use \g<0>.
  This fix not to remove NT_ENCLOSE whose regnum is 0.
  [ruby-core:75828] [Bug #12454]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-01 19:37:43 +00:00
ngoto 053c1e08e3 * test/fiddle/test_pointer.rb (test_to_str, test_to_s, test_aref_aset):
Attempt to use independent strings for destructive tests that
  directly modify values on memory by using Fiddle::Pointer.
  [Bug #12537] [ruby-dev:49700]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-01 10:43:07 +00:00
nobu 7d4db05679 test_stringio.rb: reduce retry count
* test/stringio/test_stringio.rb (test_overflow): reduce maximum
  retry count to get rid of timeout on some platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-30 08:13:27 +00:00
shugo a1d17c5907 * test/ruby/test_refinement.rb: skip
test_prepend_after_refine_wb_miss on ARM or MIPS.
  [ruby-core:76031] [Bug #12491]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-29 03:45:23 +00:00
nobu 86a756ae15 Passed block symbol to proc
* proc.c (passed_block): convert passed block symbol to proc.
  based on the patch by Daisuke Sato in [ruby-dev:49695].
  [Bug #12531]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 23:45:55 +00:00
nobu ad72430863 Move CaseTest
* test/ruby/enc/test_case_comprehensive.rb (CaseTest): move under
  the test case not to pollute the global name space.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 07:04:13 +00:00
nobu 023aaa51a2 Skip unavailable tests
* test/ruby/enc/test_case_comprehensive.rb: noting to test if
  Unicode data files are available.
  [ruby-core:76160] [Bug #12433]
* test/test_unicode_normalize.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-28 06:56:50 +00:00
nobu 10fcca8f15 FileUtils#install: owner/group options
* lib/fileutils.rb (FileUtils#install): add owner and group
  options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-27 07:55:17 +00:00
nobu f540475134 Coverage on non-positive lines
* compile.c (ADD_TRACE): ignore trace instruction on non-positive
  line.
* parse.y (coverage): get rid of ArgumentError when the starting
  line number is not positive.  [ruby-core:76141] [Bug #12517]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-26 23:56:57 +00:00
nobu 38f6fe64aa Refine assertion
* test/openssl/test_ocsp.rb: assert_in_delta for better message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-25 02:32:06 +00:00
rhe 5ff2e41845 openssl: ignore test failure caused by LibreSSL bug
* test/openssl/test_ocsp.rb: Ignore errors caused by bugs that exist in
  LibreSSL >= 2.3.1.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-25 01:08:15 +00:00
nobu b51174a6b0 No respond_to? as if the default definition
* vm_method.c (vm_respond_to): try method_missing if respond_to?
  is undefined, as if it is the default definition.
  [ruby-core:75377] [Bug #12353]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 17:33:35 +00:00
hsbt a099c5420c * ext/psych/*, test/psych/*: Upate psych 2.1.0
This version fixed [Bug #11988][ruby-core:72850]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 09:06:08 +00:00
hsbt bddf4b0237 * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*:
Update rubygems 2.6.5 and 2.6.6.
  Release note of 2.6.5: 656f5d94dc
  Release note of 2.6.6: ccb9c3300c

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-24 04:13:11 +00:00
duerst 0546930ecb * test/ruby/enc/test_regex_casefold.rb: Add Windows-1251, KOI8-R, and
KOI8-U to encodings; definitely removed EUC-JP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 10:44:57 +00:00
nobu 978ee6d1ef Multiple values X-Forwarded-Proto in webrick
* lib/webrick/httprequest.rb (setup_forwarded_info): Use the first
  value in X-Forwarded-Proto, if header contains multiple comma
  separated values.  Some middlewares may add these values to the
  list, not replacing.  [Fix GH-1386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 10:32:26 +00:00
duerst 0f8a24a706 * test/ruby/test_io.rb: Skip test_readpartial_with_not_empty_buffer,
test_read_buffer_error, test_read_unlocktmp_ensure,
  test_readpartial_unlocktmp_ensure, and
  test_sysread_unlocktmp_ensure on cygwin,
  because these tests repeatedly hang. This makes test_io.rb
  complete in finite time on cygwin.
* ChangeLog: Fix test_in.rb -> test_io.rb (two instances).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 08:17:50 +00:00
naruse c9e9236173 It takes still too many memory...
/usr/bin/time -l make RUBYOPT=-w TESTS='-v ruby/enc/test_case_comprehensive.rb' test-all
ruby -v: ruby 2.4.0dev (2016-06-21 trunk 55473) [x86_64-freebsd10.3]
       27.74 real        27.57 user         0.16 sys
    115308  maximum resident set size
         5  average shared memory size
         4  average unshared data size
       128  average unshared stack size
     28443  page reclaims
         0  page faults
         0  swaps
         2  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
        93  voluntary context switches
      1123  involuntary context switches

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 07:14:03 +00:00
duerst 8ee8a6f93c * test/ruby/test_in.rb: Skip test_read_buffer_error on cygwin,
because this test repeatedly hangs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-21 06:42:27 +00:00
naruse f79df8459a Optimize to speed up
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 19:01:37 +00:00
naruse a8e5eaa4b9 Don't cache simple data to reduce memory usage
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 18:27:45 +00:00
duerst fda9ce3edd * test/ruby/test_in.rb: Skip test_open_fifo_does_not_block_other_threads
on cygwin. Fifos seem to work okay in cygwin, but this test repeatedly
  hangs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 09:39:31 +00:00
shugo 76941e5f54 * vm.c (invoke_bmethod, invoke_block_from_c_0): revert r52104
partially to avoid "self has wrong type to call super in this
  context" errors.
  [ruby-core:72724] [Bug #11954]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 04:37:19 +00:00
rhe 5336399e8b rubygems: fix test for OpenSSL 1.1.0
* test/rubygems/test_gem_remote_fetcher.rb: OpenSSL::PKey::DH#priv_key=
  is not defined when ext/openssl is built with OpenSSL 1.1.0.
  https://github.com/rubygems/rubygems/pull/1648
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-20 03:54:22 +00:00
rhe 102815b046 openssl: add OpenSSL::OCSP::SingleResponse
* ext/openssl/ossl_ocsp.c: Add OCSP::SingleResponse that represents an
  OCSP SingleResponse structure. Also add two new methods #responses
  and #find_response to OCSP::BasicResponse. A BasicResponse has one or
  more SingleResponse. We have OCSP::BasicResponse#status that returns
  them as an array of arrays, each containing the content of a
  SingleResponse, but this is not useful. When validating an OCSP
  response, we need to look into the each SingleResponse and check their
  validity but it is not simple. For example, when validating for a
  certificate 'cert', the code would be like:

    # certid_target is an OpenSSL::OCSP::CertificateId for cert
    basic = res.basic
    result = basic.status.any? do |ary|
      ary[0].cmp(certid_target) &&
        ary[4] <= Time.now && (!ary[5] || Time.now <= ary[5])
    end

  Adding OCSP::SingleResponse at the same time allows exposing
  OCSP_check_validity(). With this, the code above can be rewritten as:

    basic = res.basic
    single = basic.find_response(certid_target)
    result = single.check_validity

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 12:26:27 +00:00
rhe f31f1f1adf openssl: implement initialize_copy for OpenSSL::OCSP::*
* ext/openssl/ossl_ocsp.c: Implement OCSP::{CertificateId,Request,
  BasicResponse,Response}#initialize_copy.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_ocsp.rb: Test them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:42:29 +00:00
rhe be1baf4a9a openssl: implement initialize_copy method for PKey classes
* ext/openssl/ossl_pkey_dh.c, ext/openssl/ossl_pkey_dsa.c,
  ext/openssl/ossl_pkey_ec.c, ext/openssl/ossl_pkey_rsa.c: Implement
  initialize_copy method for OpenSSL::PKey::*.
  [ruby-core:75504] [Bug #12381]

* test/openssl/test_pkey_dh.rb, test/openssl/test_pkey_dsa.rb,
  test/openssl/test_pkey_ec.rb, test/openssl/test_pkey_rsa.rb: Test they
  actually copy the OpenSSL objects, and modifications to cloned object
  don't affect the original object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 09:29:59 +00:00
duerst b67ead1452 * test/ruby/test_dir_m17n.rb: Skip tests with non-UTF-8 encodings
on cygwin. Cygwin can use the Unicode PUA (private use area) to store
  bytes from non-UTF-8 filenames (see
  https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars),
  but we are not supporting this. [Bug #12443]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 07:55:25 +00:00
nobu 0ce3fab422 variable.c: consider length
* variable.c (rb_path_to_class): consider the string length
  instead of a terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 02:19:45 +00:00
nobu b569971422 Normalization test iff UTF-8 file system
* test/ruby/test_file_exhaustive.rb (test_expand_path_compose):
  normalization is meaningless unless file system encoding is UTF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-19 01:48:27 +00:00
rhe c2158dd55e openssl: avoid test crash on Ubuntu 16.04
* test/openssl/test_pkey_ec.rb (setup): Don't call EC#generate_key! for
  Oakley-* curves. This causes an odd error on Ubuntu 16.04 with openssl
  1.0.2g-1ubuntu4.1.

    begin
      OpenSSL::PKey::EC.new("Oakley-EC2N-4").generate_key
    rescue
      p $!
    end
    OpenSSL::PKey::RSA.new(512)

  This sometimes causes:

    #<OpenSSL::PKey::ECError: EC_KEY_generate_key: pairwise test failed>
    fips.c(139): OpenSSL internal error, assertion failed: FATAL FIPS SELFTEST FAILURE

  [ruby-dev:49670] [Bug #12504]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 09:10:19 +00:00
hsbt 7376907959 * test/rubygems/test_gem_installer.rb: Fixed broken test with extension
build. https://github.com/rubygems/rubygems/pull/1645

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:57 +00:00
hsbt f20ad4889d * lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems
HEAD(2c6d256). It contains to update vendored Molinillo to 0.5.0.
  https://github.com/rubygems/rubygems/pull/1638

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 05:11:55 +00:00
nobu 513345607d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): could occur only
  on sizeof(long) >= sizeof(void*).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:50:14 +00:00
nobu 815e8e992d Refine test of r55432
* test/stringio/test_stringio.rb (test_overflow): refine the
  conditinon, try to allocate strings until the buffer is located
  in higher half address.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-18 04:40:15 +00:00
nobu ed4aed86fb stringio.c: fix index overflow
* ext/stringio/stringio.c (strio_getline): fix pointer index
  overflow.  reported by Guido Vranken <guido AT guidovranken.nl>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-17 23:52:48 +00:00
rhe 2851f19f49 openssl: allow specifying hash algorithm in OCSP::*#sign
* ext/openssl/ossl_ocsp.c (ossl_ocspreq_sign, ossl_ocspbres_sign): Allow
  specifying hash algorithm used in signing. They are hard coded to use
  SHA-1.
  Based on a patch provided by Tim Shirley <tidoublemy@gmail.com>.
  [ruby-core:70915] [Feature #11552] [GH ruby/openssl#28]

* test/openssl/test_ocsp.rb: Test sign-verify works.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-15 10:52:37 +00:00
kazu fb1cee9b6f use \A and \z instead of ^ and $ in regexp
* test/ruby/enc/test_case_comprehensive.rb
  (TestComprehensiveCaseFold::read_data): use \A and \z instead of
  ^ and $ in regexp.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-14 15:01:37 +00:00
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