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

10917 Коммитов

Автор SHA1 Сообщение Дата
nobu b7d260f185 test_numeric.rb: loose precision assertion
* test/ruby/test_numeric.rb (TestNumeric#test_step): remove a
  loose precision assertion, as Float cannot keep complete
  precision.  [ruby-core:86684] [Bug #14712]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-26 00:12:35 +00:00
nobu 067066fc9b compile.c: fix unconditional branch optimization
* compile.c (iseq_peephole_optimize): add dummy `putnil` after a
  `jump` replacing an unconditional branch, to adjust removed
  `dup`.  [ruby-core:86666] [Bug #14708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25 06:45:05 +00:00
nobu 2c8f16e6c0 string.c: fix scanned substring with `\K`
* string.c (scan_once): fix the matched substring with `\K`, the
  beginning of that string may differ from the matched position.
  [ruby-core:86663] [Bug #14707]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-24 12:25:46 +00:00
nobu 3471d0f6d6 rescue Errno::EPROTOTYPE
* test/webrick/test_httpserver.rb (test_gigantic_request_header):
  Errno::EPROTOTYPE is sometimes raised on Mac OS X 10.10.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23 23:46:26 +00:00
normal 87ca4f3065 test/ruby/test_io.rb: add extra Thread#join to delay close
Maybe this fixes some CI failures.  Also, use different timeouts
for each item for hopefully easier diagnosis.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-23 05:54:06 +00:00
ko1 dd45691dbc Skip some tests to make CI healthy.
r63236 (or r63237) introduces test failures and CI shows errors.
This commit makes skipping these tests.  Please revert this commit
after tests (and rubyspec) work fine.

Failure log example:
https://gist.github.com/ko1/8456cf25fe35a696bd33ac86135092e4


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 16:03:09 +00:00
kou 7a6f34103d rexml: Fix XPath bug of //#{ELEMENT_NAME}[#{POSITION}]
The position should be counted for each nodeset but the previous
implementation counts position for union-ed nodeset.

For example, "/a/*/*[1]" should be matched to "<c1/>" and "<c2/>" with
the following XML.

    <a>
      <b>
        <c1/>
      </b>
      <b>
        <c2/>
      </b>
    </a>

But the previous implementation just returns only "<c1/>".

* lib/rexml/element.rb (REXML::Attributes#each_attribute):
  Support Enumerator for no block use.

* lib/rexml/element.rb (REXML::Attributes#each):
  Support Enumerator for no block use.

* lib/rexml/functions.rb (REXML::Functions.string):
  Support NaN again.

* lib/rexml/xpath_parser.rb: Re-implement "Step" evaluator.
  It should evaluate "AxisSpecifier", "NodeTest" and "Predicate" in one
  step to respect position for each nodeset.

* test/rexml/test_jaxen.rb: Enable more tests. Remained tests should
  be also enabled but it'll not be near future.

* test/rexml/xpath/test_base.rb: Fix expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 09:38:06 +00:00
kou 4d15e619eb rexml: Fix XPath bug of /#{ELEMENT_NAME}
It doesn't mean that all elements which name "ELEMENT_NAME" with any
namespace URI including null namespace URI. It means that all elements
which name "ELEMENT_NAME" with null namespace URI.

https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NodeTest

> if the QName does not have a prefix, then the namespace URI is null
> (this is the same way attribute names are expanded).

We need to use "*[local-name()='#{ELEMENT_NAME}']" for all elements
which name "ELEMENT_NAME" with any namespace URI including null
namespace URI in XPath 1.0. But it's inconvenient. So this change
includes "*:#{LOCAL_NAME}" syntax support that is introduced since
XPath 2.0.

* lib/rexml/parsers/xpathparser.rb: Support "*:#{LOCAL_NAME}" syntax that
  is introduced since XPath 2.0.

* lib/rexml/xpath_parser.rb:
  * Fix namespace URI processing for "#{ELEMENT_NAME}". Now,
    "#{ELEMENT_NAME}" doesn't accept elements with null namespace URI.
  * Add "*:#{LOCAL_NAME}" support.

* test/rexml/test_contrib.rb,
  test/rexml/test_core.rb,
  test/rexml/xpath/test_base.rb: Follow this change.

* test/rexml/test_jaxen.rb: Fix namespace processing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 08:09:04 +00:00
normal fed7f81b37 test/ruby/test_io.rb: try to diagnose stuck test_recycled_fd_close
I can't reproduce the problem myself, but gets loop seems ought
to give more useful information for tracking down where we're
stuck, at least.

Followup-to: r63217

cf. http://ci.rvm.jp/results/trunk-test@frontier/804284

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 23:32:18 +00:00
k0kubun c04881f94a test_jit.rb: follow the change of instruction
in r63225. Not strictly needed but to avoid confusion.

The JIT compiler itself seems working fine.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 13:15:43 +00:00
kou ee29985ded rexml: Enable more tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:45:42 +00:00
kou da89931dcc rexml: Fix XPath concat() implementation
* lib/rexml/functions.rb (REXML::Functions.concat): Implement.

* test/rexml/test_jaxen.rb: Enable one more test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:43:58 +00:00
kou 6793c0a227 rexml: Fix XPath string() implementation
* lib/rexml/functions.rb( REXML::Functions.string):
  * Support context node.
  * Fix implementation for document node to remove out of root nodes.
  * Support processing instruction node.
  * Improve implementation for integer to omit decimals.

* test/rexml/test_jaxen.rb: Enable processing instruction test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:39:43 +00:00
kou e044924ee5 rexml: Make more readable
test/rexml/test_jaxen.rb: Use more meaningful name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:41 +00:00
kou 1992cec52d rexml: Fix a test bug
test/rexml/test_jaxen.rb: Fix wrong assert_raise usage. Note that this code
isn't used yet.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:02 +00:00
kou daec80fe98 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for readability.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:18:08 +00:00
normal 7e9c19ad3d test/ruby/test_io.rb: add closing recycled FD test
Followup-to: r63216

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 04:02:41 +00:00
k0kubun e72a86fc93 _mjit_compile_send.erb: inline attr_reader call
_mjit_compile_send_guard.erb: carve out the shared logic to invalidate
inlined method call

common.mk: update dependency for this change

test_jit.rb: add test for attr_reader optimization

* Benchmark

```
require 'benchmark_driver'

Benchmark.driver do |x|
  x.prelude %{
    class C
      attr_reader :a
      def initialize
        @a = 1
      end
    end

    o = C.new

    def l o
      i = 0
      while i < 1000000
        o.a
        i += 1
      end
    end
  }
  x.report 'aread', %{ l o }
  x.loop_count 1000

  x.rbenv 'before', 'before,--jit', 'after,--jit'
  x.verbose
end
```

```
before: ruby 2.6.0dev (2018-04-20 trunk 63211) [x86_64-linux]
before,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
after,--jit: ruby 2.6.0dev (2018-04-20 trunk 63211) +JIT [x86_64-linux]
last_commit=_mjit_compile_send.erb: inline attr_reader call
Calculating -------------------------------------
                         before  before,--jit  after,--jit
               aread     54.597       122.894      218.574 i/s -      1.000k times in 18.316102s 8.137089s 4.575106s

Comparison:
                            aread
         after,--jit:       218.6 i/s
        before,--jit:       122.9 i/s - 1.78x  slower
              before:        54.6 i/s - 4.00x  slower

```

* Optcarrot

A little made faster?

fps: 71.35 -> 72.11

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 13:42:08 +00:00
normal b456eab2ea variable.c: fix thread + fork errors in autoload
This is fairly non-intrusive bugfix to prevent children
from trying to reach into thread stacks of the parent.
I will probably reuse this idea and redo r62934, too
(same bug).

* vm_core.h (typedef struct rb_vm_struct): add fork_gen counter
* thread.c (rb_thread_atfork_internal): increment fork_gen
* variable.c (struct autoload_data_i): store fork_gen
* variable.c (check_autoload_data): remove (replaced with get_...)
* variable.c (get_autoload_data): check fork_gen when retrieving
* variable.c (check_autoload_required): use get_autoload_data
* variable.c (rb_autoloading_value): ditto
* variable.c (rb_autoload_p): ditto
* variable.c (current_autoload_data): ditto
* variable.c (autoload_reset): reset fork_gen, adjust indent
* variable.c (rb_autoload_load): set fork_gen when setting state
* test/ruby/test_autoload.rb (test_autoload_fork): new test
  [ruby-core:86410] [Bug #14634]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 03:22:26 +00:00
nobu db885d0850 range.c: step in bignum
* range.c (range_step): honor step in bignum addition.
  [Feature #12912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 00:23:01 +00:00
nobu ad5a6aa790 range.c: fix fixnum loop condition
* range.c (range_step): FIXABLE + FIXABLE never overflow, but may
  not be FIXABLE.  [Feature #12912]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-20 00:10:46 +00:00
nobu 5a5c9a706c fiddle/test_import.rb: fix warnings by rubygems
[Bug #14686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 23:46:55 +00:00
nobu eb02a846a4 fiddle/import.rb: suppress warning
* ext/fiddle/lib/fiddle/import.rb: suppress exception report when
  $DEBUG is enabled.  [ruby-core:86536] [Bug #14686]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 23:35:39 +00:00
kou 9090241e61 rexml: Fix a XPath bug that white spaces aren't ignored
lib/rexml/parsers/xpathparser.rb: Ignore white spaces in relative
location path.

test/rexml/xpath/test_base.rb: Add more test patterns and use more
debug friendly assertion style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 21:34:40 +00:00
kou 632e10cad3 rexml: Fix wrong assertion
test/rexml/xpath/test_base.rb: Use constant value for the expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:51:07 +00:00
kou 8257fcb1db rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Expand loop assertion and stop to checking
just the first value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:49:53 +00:00
kou b5321ba446 rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Stop to use separated assertions for
checking array value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:48:28 +00:00
kou be000dcc15 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for XML.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:45:16 +00:00
mame d658a8d568 range.c: Make Range#bsearch support endless ranges
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:57 +00:00
mame db1bdecb0d Make Range#min, max, include?, cover?, and === to support endless range
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:53 +00:00
mame 7f95eed19e Introduce endless range [Feature#12912]
Typical usages:
```
p ary[1..]          # drop the first element; identical to ary[1..-1]
(1..).each {|n|...} # iterate forever from 1; identical to 1.step{...}
```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 15:18:50 +00:00
nobu c635662d7f dir.c: warning for NUL
* dir.c (rb_push_glob): warn NUL-separated glob patterns.
  [Feature #14643]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 07:05:39 +00:00
nobu 9760a7f905 Add slice method to ENV like Hash#slice
[Feature #14559]

From:    Benoit Tigeot <benoit@hopsandfork.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 05:55:42 +00:00
mame 8cd5ccdc7f test/ruby/test_super.rb: Remove unused assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:52:25 +00:00
mame a30d133a03 The test for TracePoint with thread had never worked correctly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:58 +00:00
mame fcdabb50b8 The test for TracePoint#raised_exception had never worked correctly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:56 +00:00
mame 2881a6d412 Remove the old disabled assertions for 1.8/1.9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:47:56 +00:00
mame 84934e4f24 Enable the assertions that had been disabled for historical reason
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:26:20 +00:00
mame 035145722d Remove the assertions that have no meaning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:26:19 +00:00
mame dae960ed1d Remove the disabled old tests for Ruby 1.8/1.9 feature change
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:58 +00:00
mame 91596bb719 Use assert(false) for the path that is expected unreachable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:57 +00:00
mame c80339d05f test/date/test_date_base.rb: removed
It depends upon calendar.so which is not bundled.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 08:18:56 +00:00
mame c1d0768f34 test/csv/test_features.rb: enable accidentally-disabled assertions
CSV.new does not yield the instance.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 07:03:44 +00:00
mame 7735e2da11 test/zlib/test_zlib.rb (test_path): enable the accidentally-disabled assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 06:38:08 +00:00
nobu f168dbd9ef parse.y: fix cmdarg in command_args
* parse.y (call_args): fix invalid CMDARG state after command_args
  followed by tLBRACE_ARG.  [ruby-core:86551] [Bug #14690]

From: Ilya Bylich <ibylich@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-17 01:22:26 +00:00
nobu 58a2084483 compile.c: align range
* compile.c (ibf_dump_object_struct): align range elements.
  [ruby-core:86548] [Bug #14689]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 12:46:08 +00:00
nobu cea438b0ca string.c: fix dumped suffix
* string.c (rb_str_dump): get rid of an error on evaling with
  frozen-string-literal enabled.  [ruby-core:86539] [Bug #14687]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 07:12:06 +00:00
nobu 5b2b1130cf string.c: fix checking order
* string.c (str_undump): check for suffix before if Unicode escape
  conflicts with it.  the message "but used force_encoding" sounds
  strange when it is not used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-16 06:37:42 +00:00
naruse 0cd595cb47 Extend timeout
On armv7 environment, the timeout is too short
http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180319T191706Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14 14:05:38 +00:00
nobu 9fa0d0058d irb.rb: restore the last error
* lib/irb.rb (eval_input): restore the last error `$!`, as the
  previous result.  [Feature #14684]

* lib/irb/context.rb (evaluate): add `exception` keyword argument
  to set the last error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14 13:05:52 +00:00
nobu d6dc676d07 irb/{context,workspace}.rb: use local_variable_set
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-14 12:49:30 +00:00
nobu 081df64083 file.c: chardev is loadable
* file.c (ruby_is_fd_loadable): allow character devices to load,
  e.g., `ruby /dev/null` exits successfully.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-13 06:26:30 +00:00
nobu a3a5f38d09 parse.y: `when` indent
* parse.y (k_when): warn less-indented `when` than `case`.
  [ruby-core:86492] [Bug #14674]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12 22:13:09 +00:00
nobu b6490ddd97 assert indents of `case` and `end`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12 12:01:51 +00:00
nobu a72581d70f error.c: super in method_missing
* error.c (nometh_err_initialize): do not shirtcut rb_call_super,
  to push proper control frame.  [ruby-dev:50522] [Bug #14670]

* error.c (rb_nomethod_err_new): allocate and initialize a new
  NoMethodError instance.

* vm_eval.c (rb_make_no_method_exception): create a new exception
  instance directly without method calls, to prevent influence of
  ruby level method definitions, which can cause an unpredictable
  behavior, e.g., infinite recursion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12 03:48:48 +00:00
nobu 2e501b0a8b marshaltestlib.rb: use clean object for exception
* test/ruby/marshaltestlib.rb (test_exception): use separate
  clean object to raise an exception.  TestCase instance often has
  modules included.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12 03:40:16 +00:00
nobu aa2b32ae4b eval_error.c: fix loop on exception in message
* error.c (rb_get_message): accessor to the message.

* eval_error.c (rb_ec_error_print): handle exceptions on fetching
  the message.  [Bug #14566]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-11 08:03:43 +00:00
nobu f852af0e59 symbol.c: non-ASCII constant names
* symbol.c (rb_sym_constant_char_p): support for non-ASCII
  constant names.  [Feature #13770]

* object.c (rb_mod_const_get, rb_mod_const_defined): support for
  non-ASCII constant names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-10 00:41:47 +00:00
nobu 6a57127222 parse.y: extra error message after no digits
* parse.y (no_digits): return tINTEGER instead of unexpected
  end-of-input, to get rid of extra error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-09 11:09:30 +00:00
nobu 066af25b58 test_literal.rb: use assert_syntax_error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-09 09:59:36 +00:00
nobu b6185e175c compile.c: align IBF dumped data
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-08 05:22:49 +00:00
nobu 2de68923da test/ruby/test_iseq.rb: hexdump to diff
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-07 03:48:45 +00:00
nobu eaf5e34b70 Use assert_include
For better failure message:

- by assert_operator: Expected "X" to be include? "Y"
- by assert_include: Expected "X" to include "Y"

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-07 03:48:44 +00:00
kazu f7faedc715 Use assert_operator instead of assert
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-06 15:06:52 +00:00
nobu 7084c015bf compile.c: fix positions encode
* compile.c (ibf_load_iseq_each): iseq_size necessary to encode
  positions is set in ibf_load_code().  [Bug #14660]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-05 13:13:00 +00:00
usa 97d610becd * test/test_tempfile.rb (test_{new,create}_traversal_dir): should not assume `t`
is always set.  if `t` is nil, `NoMethodError` will be raised and the real
  cause will be hidden.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 15:44:56 +00:00
mame 2de0c72947 test/test_tempfile.rb: close a file object created by Tempfile.create
To stop a "Leaked file descriptor" warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 15:26:11 +00:00
mame 85bcd2b35f bignum.c: Bignum#fdiv avoids double division when divisor is bignum
`Rational(int, bignum).to_f` sometimes returned a wrong result because
`Bignum#div` casted its divisor to double.  [Bug #14637] [ruby-core:86330]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 14:02:59 +00:00
kou e440bfaed1 rexml: Fix a XPath bug of /child::node()
[Bug #14600]
    
* lib/rexml/xpath_parser.rb: Fix a bug that "/child::node()" returns
  XML declaration and text nodes out of root element.

* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 06:53:57 +00:00
ko1 c563210532 use Queue for inter-thread synchronization.
* test/ruby/test_bignum.rb (test_interrupt_during_to_s): should not use
  "while" synchronization, but should use Queue.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 05:00:52 +00:00
kou b537823f3d rexml: Fix a XPath bug of @attribute/parent
[Bug #14600]
    
* lib/rexml/functions.rb: Fix a bug that "@attribute/parent" doesn't
  return element of its attribute.

* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 03:27:20 +00:00
nobu c79307c0dc test_fiber.rb: fix test_create_fiber_in_new_thread
* test/ruby/test_fiber.rb (test_create_fiber_in_new_thread):
  prefix to run, and get the result value not only waiting.
  [Bug #14642]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 16:54:27 +00:00
nobu 9ba849e631 Fix typo
[Bug #14642]
[Fix GH-1855]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 16:50:17 +00:00
kou c592ce4023 rexml: Fix a XPath bug of name(node-set)
[Bug #14600]
    
* lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns
  element instead of element name.
  
* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 15:51:08 +00:00
nobu 7f30b84c4f adjust indent [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 11:27:00 +00:00
ko1 1751ea76a4 repatch r62966 and r62969.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 10:22:45 +00:00
ko1 db3cc675f3 Fix Fiber with Thread issue on Windows [Bug #14642]
* cont.c (rb_threadptr_root_fiber_setup): divide into two functions:
  * rb_threadptr_root_fiber_setup_by_parent(): called by the parent thread.
  * rb_threadptr_root_fiber_setup_by_child(): called by the created thread.

  `rb_threadptr_root_fiber_setup()` is called by the parent thread and
  set fib->fib_handle by ConvertThreadToFiber() on the parent thread on
  Windows enveironment.
  This means that root_fib->fib_handle of child thread is initialized
  with parent thread's Fiber handle. Furthermore, second call of
  `ConvertThreadToFiber()` for the same thread fails.

  This patch solves this weird situateion. However, maybe we can make more
  clean code.

* thread.c (thread_start_func_2): call
  `rb_threadptr_root_fiber_setup_by_child()` at thread initialize routine.

* vm.c (th_init): call `rb_threadptr_root_fiber_setup_by_parent()`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 10:21:47 +00:00
nobu f687794964 adjust indent [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 08:10:32 +00:00
naruse 0c632c6fd3 Revert r62966 and r62969
It breaks mswin's test-all

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 07:54:18 +00:00
nobu 60f0e763a4 proc.c: fix segfault when no singleton class
* proc.c (rb_obj_singleton_method): bail out if the receiver does
  not have the singleton class without accessing the origin class
  not to segfault.  [Bug #14658]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 06:57:44 +00:00
nobu c7770f90bd Fix Kernel#singleton_method with Module#Prepend
* proc.c (rb_obj_singleton_method): search the method entry from
  the origin class, for fix prepended modules.  [Bug #14658]

From: Vasiliy Ermolovich <younash@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 06:57:43 +00:00
nobu bae19b5547 error.c: prepend "warning: " always
* error.c (rb_warn_m): prepend the string "warning: " if uplevel
  keyword is given, even if caller file and line information are
  not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-02 11:39:10 +00:00
kou f0c734660f Start re-enabling Jaxen tests
[Bug #14600]
Reported by MSP-Greg. Thanks!!!

* lib/rexml/xpath_parser.rb: Fix a bug that "following_siblings::*[N]"
  doesn't work.

* test/rexml/test_jaxen.rb: Enable only axis test for now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01 16:17:52 +00:00
nobu a0e6607a81 test_time_tz.rb: Lisbon tzdata fix
* test/ruby/test_time_tz.rb (gen_variational_zdump_test): Update
  Lisbon zdump data, which fixed the 1912-01-01 transition for
  Portugual and its colonies.  [Bug #14655]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01 13:16:14 +00:00
nobu 584b5929f9 test_time_tz.rb: Kiritimati tzdata fix
* test/ruby/test_time_tz.rb (gen_zdump_test): fix the expected
  data at the Kiritimati's skip of New Year's Eve 1994.
  [Bug #14655]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01 13:02:11 +00:00
nobu 2965c2d4df test_time_tz.rb: Kiritimati tzdata fix
* test/ruby/test_time_tz.rb (TestTimeTZ#test_pacific_kiritimati):
  fix the expected data at the skip of New Year's Eve 1994.
  [Bug #14655]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01 02:00:36 +00:00
kazu d0775a1120 test/lib/leakchecker.rb: Add check_verbose
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-31 02:29:19 +00:00
k0kubun 378c0bcd4f test_jit.rb: loosen CC check condition
see also: r63037. Probably it was not enough.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-30 15:08:52 +00:00
nobu 484cc6b3bc compile.c: do not dump unused callinfos
* compile.c (compile_if): rewind callinfo indexes used in
  unreachable paths, to get rid of dumping unused callinfos.
  [ruby-core:86399] [Bug #14553]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-30 05:15:07 +00:00
k0kubun 46b391ff73 test_jit.rb: loosen debug log check
We couldn't catch log with
https://gist.github.com/ko1/0fdc6a8d4add70cd8648000b16a3da38#file-brlog-trunk_gcc6-20180329-003723-L370
because the error message started with "gcc-6:".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-29 12:37:31 +00:00
nobu 9c5d90b516 Use only CMDARG/COND _PUSH/POP for cmdarg/cond management.
From: Ilya Bylich <ibylich@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-29 03:42:32 +00:00
nobu e42f4ae773 array.c: yield blockarg in collect
* array.c (rb_ary_collect): yield in block argument semantics
  always to splat array elements to lambda, for the backward
  compatibility.  [ruby-core:86362] [Bug #14639]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-29 00:05:45 +00:00
nobu d02b7bd864 pack.c: fix underflow
* pack.c (pack_unpack_internal): get rid of underflow.
  https://hackerone.com/reports/298246

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:12:17 +00:00
nobu 8794dec6a5 unixsocket.c: check NUL bytes
* ext/socket/unixsocket.c (rsock_init_unixsock): check NUL bytes.
  https://hackerone.com/reports/302997

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:08:57 +00:00
hsbt 10b96900b9 Ignore file separator from tmpfile/tmpdir name.
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:03:03 +00:00
nobu bd5661a3cb dir.c: check NUL bytes
* dir.c (GlobPathValue): should be used in rb_push_glob only.
  other methods should use FilePathValue.
  https://hackerone.com/reports/302338

* dir.c (rb_push_glob): expand GlobPathValue

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 09:58:52 +00:00
nobu 22a4e6ac7a adjust indents [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:48:52 +00:00
normal d9d4a28f1c webrick: prevent response splitting and header injection
Original patch by tenderlove (with minor style adjustments).

* lib/webrick/httpresponse.rb (send_header): call check_header
  (check_header): raise on embedded CRLF in header value
* test/webrick/test_httpresponse.rb
  (test_prevent_response_splitting_headers): new test
* (test_prevent_response_splitting_cookie_headers): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:38:26 +00:00
normal 7292569d3f io.c: IO#write without args returns 0
This is consistent with other implementations of .write
in openssl and stringio.

* io.c (io_write_m): return 0 on argc == 0
  [ruby-core:86285] [Bug #14338]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:38:21 +00:00
normal 706c028909 webrick/httpproxy: stream request and response bodies
Reading entire request or response bodies into memory can lead
to trivial denial-of-service attacks.  Introduce Fibers in both
cases to allow streaming.

WEBrick::HTTPRequest gains a new body_reader method to prepare
itself as a source for IO.copy_stream.  This allows the
WEBrick::HTTPRequest object to be used as the
Net::HTTPGenericRequest#body_stream= arg for Net::HTTP.

For HTTP proxy response bodies, we also use a Fiber to
to make the HTTP request and read the response body.

* lib/webrick/httprequest.rb (body_reader): new method
  (readpartial): ditto
* lib/webrick/httpproxy.rb (perform_proxy_request): use Fiber
  to stream response body
  (do_GET, do_HEAD): adjust call
  (do_POST): adjust call and supply body_reader
* test/webrick/test_httprequest.rb (test_chunked): test
  for IO.copy_stream compatibility
* test/webrick/test_httpproxy.rb (test_big_bodies): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:55 +00:00
normal df2ce3434f webrick: add test for Digest auth-int
No changes to the actual code, this is a new test for
a feature for which no tests existed.  I don't understand
the Digest authentication code well at all, but this is
necessary for the subsequent change.

* test/webrick/test_httpauth.rb (test_digest_auth_int): new test
  (credentials_for_request): support bodies with POST

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:44 +00:00
normal 2d41d88c4d webrick/httprequest: use InputBufferSize for chunked requests
While WEBrick::HTTPRequest#body provides a Proc interface
for streaming large request bodies, clients must not force
the server to use an excessively large chunk size.

* lib/webrick/httprequest.rb (read_chunk_size): limit each
  read and block.call to :InputBufferSize in config.
* test/webrick/test_httpserver.rb (test_big_chunks): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:39 +00:00
normal 6db6eb572b webrick/httprequest: raise correct exception
"BadRequest" alone does not resolve correctly, it is in the
HTTPStatus namespace.

* lib/webrick/httprequest.rb (read_chunked): use correct exception
* test/webrick/test_httpserver.rb (test_eof_in_chunk): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:34 +00:00
normal 7e1f2a5aa9 webrick/httprequest: limit request headers size
We use the same 112 KB limit started (AFAIK) by Mongrel, Thin,
and Puma to prevent malicious users from using up all the memory
with a single request.  This also limits the damage done by
excessive ranges in multipart Range: requests.

Due to the way we rely on IO#gets and the desire to keep
the code simple, the actual maximum header may be 4093 bytes
larger than 112 KB, but we're splitting hairs at that point.

* lib/webrick/httprequest.rb: define MAX_HEADER_LENGTH
  (read_header): raise when headers exceed max length

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:23 +00:00
normal 0478a37903 test/webrick/test_filehandler.rb: stricter multipart range test
We need to ensure we generate compatibile output in
the face of future changes

* test/webrick/test_filehandler.rb (test_make_partial_content):
  check response body

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:06:02 +00:00
normal 6360243fd2 webrick: use IO.copy_stream for single range response
This is also compatible with range responses generated
by Rack::File (tested with rack 2.0.3).

* lib/webrick/httpresponse.rb (send_body_io): use Content-Range
* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
  use File object for the single range case
* test/webrick/test_filehandler.rb (get_res_body): use send_body
  to test result

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 08:05:57 +00:00
nobu ebf5348528 win32/file.c: relative path with drive letter
* win32/file.c (IS_ABSOLUTE_PATH_P): home directory should not be
  a relative path regardless a drive letter.   PathIsRelativeW
  returns FALSE on such path.  [ruby-core:86356] [Bug #14638]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 07:01:48 +00:00
normal a2d63ea2fb thread_sync.c: avoid reaching across stacks of dead threads
rb_ensure is insufficient cleanup for fork and we must
reinitialize all waitqueues in the child process.

Unfortunately this increases the footprint of ConditionVariable,
Queue and SizedQueue by 8 bytes on 32-bit (16 bytes on 64-bit).

[ruby-core:86316] [Bug #14634]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-27 09:28:37 +00:00
kazu ec74ad7cba Fix test error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-26 10:18:46 +00:00
hsbt 98c7058bf7 Merge RDoc 6.0.3 from upstream.
It fixed the several bugs that was found after RDoc 6 releasing.

From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-26 05:56:26 +00:00
nobu f28d6165f6 assertions for r62914
* test/ruby/test_keyword.rb (test_splat_hash): assertion on
  mandatory and rest arguments.  r62914 is not only for optional
  argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-25 14:06:06 +00:00
nobu a23eca2672 vm_args.c: warn splat to var
* vm_args.c (setup_parameters_complex): [EXPERIMENTAL] warn when
  splat keyword arguments is passed as a single ordinary argument,
  not as a keyword rest argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-25 02:22:14 +00:00
nobu f3fbf1dfad parse.y: k_else in bodystmt
* parse.y (bodystmt): expand opt_else to show the error message at
  the right place.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-23 01:09:57 +00:00
nobu 140512d222 parse.y: else without rescue
* parse.y (bodystmt): [EXPERIMENTAL] make `else` without `rescue`
  a syntax error.  [DevelopersMeeting20180315Japan]

  https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20180315Japan
  https://docs.google.com/document/d/1RT0ijSo8uJ4Awn3CEvuYkjH0TVeXSYgeAFNmVGYC3ak/edit#
  > * do-else-end
  >   https://twitter.com/joker1007/status/974173396006129664
  >   https://twitter.com/joker1007/status/974173641347756032
  >   https://twitter.com/joker1007/status/974176512554369027
  >   Will be SyntaxError in 2.6-preview2
  >   All of begin/do/def (experimental)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-23 00:40:08 +00:00
nobu e852f9d624 test_exception.rb: assertions with Exception.to_tty?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 16:05:04 +00:00
naruse 234a30459c set UTF-8 if given URI string is ASCII
Now URI is normally UTF-8, and US-ASCII URI string is considered as
escaped a UTF-8 string.
https://github.com/rails/rails/issues/32294

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 11:20:03 +00:00
nobu b9881083f1 error.c: full_message options
* error.c (exc_full_message): add highlight: and reverse: keyword
  options.  [Bug #14324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 08:26:23 +00:00
naruse 41b2ef4685 fix each_grapheme_cluster's size [Bug #14363]
From: Hugo Peixoto <hugo.peixoto@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 07:58:38 +00:00
naruse 6e0f5b8407 Revert "each_grapheme_cluster shouldn't return size [Bug #14363]"
This reverts commit r62887.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 07:58:37 +00:00
naruse 613decd088 each_grapheme_cluster shouldn't return size [Bug #14363]
From: Stefan Schüßler <mail@stefanschuessler.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 06:59:54 +00:00
nobu b6e2c52857 Docs and tests on URI.hierarchical?, URI.absolute?
Improve code coverage and clarify meaning of hierarchical based on RFC
text.

[Fix GH-1846]

From: Xavier Riley <xavriley@hotmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 16:03:59 +00:00
nobu 58fbe69a5b parse.y: terminator at continued line
* parse.y (here_document): a continuing line is not the
  terminator.  [ruby-core:86283] [Bug #14621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 12:40:16 +00:00
nobu 491f523ab1 parse.y: unindent continued line
* parse.y (tokadd_string): stop at continued line in dedented here
  documents, to dedent for each lines before removing escaped
  newlines.  [ruby-core:86236] [Bug #14621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 10:32:15 +00:00
nobu bc7e5fcb32 test_iseq.rb: disable load_from_binary
* test/ruby/test_iseq.rb (test_to_binary_with_objects): disable
  load_from_binary right now, r62851 seems having a trouble around
  get_insn_info_succinct_bitvector() yet.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 10:06:23 +00:00
shugo 798316eac2 io.c: Methods of File should not invoke external commands
For security reasons, File.read, File.binread, File.write, File.binwrite,
File.foreach, and File.readlines should not invoke external commands even
if the path starts with the pipe character |.
[ruby-core:84495] [Feature #14245]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 09:09:49 +00:00
nobu ce848356ae compile.c: fix ibf_load_code
* compile.c (ibf_load_iseq_each): manage iseq_size to point loaded
  objects in iseq_encoded.  now marking iseq scans iseq_encoded
  directly.

* test/ruby/test_iseq.rb (test_to_binary_with_objects): skip for
  now, but fix argument order of assert_equal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20 08:36:42 +00:00
nobu d34bc779a7 parse.y: mismatched indentations at middle
* parse.y (k_rescue, k_ensure, k_when, k_else, k_elsif): warn
  mismatched indentations at keywords in middle of blocks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 08:21:26 +00:00
nobu 9720136d9c compile.c: arg var index
* compile.c (iseq_set_arguments): determine argument variable
  indexes by the order, not by just IDs.  arguments begin with `_`
  can be duplicate, so by-ID index may result in a wrong value.
  [ruby-core:86159] [Bug #14611]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19 04:08:19 +00:00
nobu 8bad3e6b9d IBF works only on x86 platforms now
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-18 03:40:49 +00:00
k0kubun f5fc032eee Remove unused variables
This fixes following warning:

```
test/logger/test_logger.rb:329: warning: assigned but unused variable - read_read
```

[Fix GH-1840]

From: yuuji.yaginuma <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:41:35 +00:00
k0kubun 4b3809114b test_jit.rb: debug cc1 availability
ENV didn't have any useful information.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 06:33:28 +00:00
nobu 6cd5db8904 test_weakmap.rb: skip unstable assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 14:12:39 +00:00
nobu 8a8f542c43 re.c: do not escape terminator in Regexp.union
* re.c (rb_reg_str_with_term): change terminator.

* re.c (rb_reg_s_union): terminator in source string does not need
  to be escaped.  terminators are outside of regexp source itself.
  [ruby-core:86149] [Bug #14608]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 13:37:44 +00:00
nobu 1d07bb84f8 test_iseq.rb: skip iseq with coverage
* test/ruby/test_iseq.rb (test_to_binary_with_objects): #to_binary
  does not support iseq compiled with coverage, just skip.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 12:06:55 +00:00
nobu ddf295a26f compile.c: fix load_from_binary
* compile.c (ibf_load_iseq_each): realpath may be nil.  follow up
  r59709.  [fix https://github.com/Shopify/bootsnap/issues/132]

From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 02:27:50 +00:00
naruse 0129fc8f58 Revert r62617 "compile.c: fix load_from_binary"
It breaks Solaris:
http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20180301T012502Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 16:51:34 +00:00
naruse 04883f12c8 Introduce URI::File to handle file URI scheme
* the default value of URI::File's authority is "" (localhost).
  Both nil and "localhost" is normalized to "" by default.
* URI::File ignores setting userinfo and port
[Feature #14035]
fix https://github.com/ruby/ruby/pull/1719
fic https://github.com/ruby/ruby/pull/1832

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 16:51:31 +00:00
nobu 2258a97fe2 string.c: split with block
* string.c (rb_str_split_m): yield each split substrings if the
  block is given, instead of returing the array.  [Feature #4780]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 11:08:04 +00:00
nobu d13a2d498c test_array.rb (test_slice!): moved misplaced test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 09:58:50 +00:00
mrkn c6ab349855 Add `exception:` keyword in Kernel#Complex()
Support `exception:` keyword argument in `Kernel#Complex()`.
If `exception:` is `false`, `Kernel#Complex()` returns `nil` if the given
value cannot be interpreted as a complex value.
The default value of `exception:` is `true`.
This is part of [Feature #12732].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 07:19:48 +00:00
mrkn 0dc74b94c2 Add `exception:` keyword in Kernel#Rational()
Support `exception:` keyword argument in `Kernel#Rational()`.
If `exception:` is `false`, `Kernel#Rational()` returns `nil` if the given
value cannot be interpreted as a rational value.
The default value of `exception:` is `true`.
This is part of [Feature #12732].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 07:19:46 +00:00
mrkn 2993b4423d Add `exception:` keyword in Kernel#Float()
Support `exception:` keyword argument in `Kernel#Float()`.
If `exception:` is `false`, `Kernel#Float()` returns `nil` if the given
value cannot be interpreted as a float value.
The default value of `exception:` is `true`.
This is part of [Feature #12732].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 07:19:45 +00:00
mrkn 2cfc5b03da Add `exception:` keyword in Kernel#Integer()
Support `exception:` keyword argument in Kernel#Integer().
If `exception:` is `false`, `Kernel#Integer()` returns `nil` if the given
value cannot be interpreted as an integer value.
The default value of `exception:` is `true`.
This is part of [Feature #12732].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 07:19:43 +00:00
ko1 38895e5c10 use SIGUSR2 to debug.
* test/ruby/test_io.rb: use SIGUSR2 instead of SIGUSR1 to confirm
  unknown SIGUSR1 exception. On parallel testing, sometime
  (1 per some days) SIGUSR1 exception. This fix will make clear which
  signal is a suspect.

  http://ci.rvm.jp/results/trunk-test@ruby-sky3/643893


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 03:55:33 +00:00
nobu e3c023337c test_weakmap.rb: fixing CI failures
* test/ruby/test_weakmap.rb (test_include?): create and release
  the object to be garbage-collected in deeper frame.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-14 11:55:07 +00:00
nobu c05fa459bb quote symbols
* sprintf.c (ruby__sfvextra): quote symbols as identifiers.

* string.c (rb_id_quote_unprintable): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-14 02:35:51 +00:00
k0kubun 0e60fdc511 test/ripper/test_lexer.rb: add test for r62743
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 13:03:12 +00:00
mame d583ee266b Add FileUtils#cp_lr
* lib/fileutils.rb: Add FileUtils#cp_lr.  This method creates hard links
  of each file from directory to another directory recursively.
  This patch is based on Thomas Sawyers and Zachary Scott.
  [Feature #4189] [ruby-core:33820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 08:18:03 +00:00
nobu dd3851d278 Rename test classes to allow stable test count when running test-all -j
[Fix GH-1763]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 06:29:02 +00:00
nobu 1032f093cc eval_error.c: reset attributes
* eval_error.c (print_errinfo): reset all attributes for each
  lines before newlines.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 03:48:56 +00:00