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

61976 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun 7561db8c00
Introduce Primitive.attr! to annotate 'inline' (#3242)
[Feature #15589]
2020-06-20 17:13:03 -07:00
Nobuyoshi Nakada d95249ade3
C-expression does not include a semicolon 2020-06-21 08:14:49 +09:00
git cc14319b71 * 2020-06-21 [ci skip] 2020-06-21 06:55:30 +09:00
Takashi Kokubun 95b0fed371
Make Integer#zero? a separated method and builtin (#3226)
A prerequisite to fix https://bugs.ruby-lang.org/issues/15589 with JIT.
This commit alone doesn't make a significant difference yet, but I thought
this commit should be committed independently.

This method override was discussed in [Misc #16961].
2020-06-20 14:55:09 -07:00
Hiroshi SHIBATA b68ddcf30c
[ruby/date] Bump version to 3.0.1
https://github.com/ruby/date/commit/47cca1b76b
2020-06-20 18:35:03 +09:00
Nobuyoshi Nakada 97e8b7d098
[ruby/date] Promote simple date to complex date to load fractional date (Fixes #20)
https://github.com/ruby/date/commit/e022e8b3ce
2020-06-20 18:35:03 +09:00
Jeremy Evans ad156f7e2c
[ruby/date] Fix cannot load complex into simple error when loading marshal dump (Fixes #20)
This problem exists because Marshal.load calls Date.allocate, which
uses a SimpleDateData.  There doesn't seem to be any support for
taking an existing Date instance and converting it from SimpleDateData
to ComplexDateData.  Work around this issue by making Date.allocate
use a ComplexDateData.  This causes problems in Date#initialize,
so remove the Date#initialize method (keeping the date_initialize
function, used internally for Date.civil). Alias Date.new to
Date.civil, since they do the same thing.

https://github.com/ruby/date/commit/6bb8d8fa0f
2020-06-20 18:35:03 +09:00
Nobuyoshi Nakada d1af2345c9
Removed space lines 2020-06-20 14:07:45 +09:00
Kazuki Tsujimoto e8b2578d31
Remove unused variables 2020-06-20 11:11:50 +09:00
Yusuke Endoh a3c8ade1b3 test/coverage/test_coverage.rb: Add a test for [Bug #16967] 2020-06-20 09:28:03 +09:00
Yusuke Endoh 50efa18c6c compile.c: Improve branch coverage instrumentation [Bug #16967]
Formerly, branch coverage measurement counters are generated for each
compilation traverse of the AST.  However, ensure clause node is
traversed twice; one is for normal-exit case (the resulted bytecode is
embedded in its outer scope), and the other is for exceptional case (the
resulted bytecode is used in catch table).  Two branch coverage counters
are generated for the two cases, but it is not desired.

This changeset revamps the internal representation of branch coverage
measurement.  Branch coverage counters are generated only at the first
visit of a branch node.  Visiting the same node reuses the
already-generated counter, so double counting is avoided.
2020-06-20 09:28:03 +09:00
Yusuke Endoh bc0aea0804 compile.c: pass NODE* instead of a quadruple of code location 2020-06-20 09:28:03 +09:00
Yusuke Endoh 4b523e79a0 compile.c (branch_coverage_valid_p): Refactored out 2020-06-20 09:28:03 +09:00
Yusuke Endoh 37cd877dbd compile.c: Use functions for building branch coverage instructions
instead of maros.  Just refactoring.
2020-06-20 09:28:03 +09:00
Jeremy Evans 878af5147d Implement Proc#== and #eql?
Previously, these were not implemented, and Object#== and #eql?
were used.  This tries to check the proc internals to make sure
that procs created from separate blocks are treated as not equal,
but procs created from the same block are treated as equal, even
when the lazy proc allocation optimization is used.

Implements [Feature #14267]
2020-06-19 12:58:25 -07:00
git b3aff6a11c * 2020-06-20 [ci skip] 2020-06-20 00:20:43 +09:00
Kazuhiro NISHIYAMA 640e6c9be6
Use section sign instead of Hiragana Letter A
It can convert to Windows-1252and Windows-31J.

```
"\u00a7".encode("Windows-1252") #=> "\xA7"
"\u00a7".encode("Windows-31J")  #=> "\x{8198}"
```

https://github.com/ruby/ruby/runs/788357527?check_suite_focus=true#step:14:959
```
  1) Failure:
WEBrick::TestFileHandler#test_cjk_in_path [D:/a/ruby/ruby/src/test/webrick/utils.rb:72]:
exceptions on 2 threads:
webrick log start:
  [2020-06-19 14:49:38] ERROR Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and Windows-1252
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `+'
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:341:in `set_filename'
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:310:in `exec_handler'
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:245:in `do_GET'
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/abstract.rb:105:in `service'
  	D:/a/ruby/ruby/src/lib/webrick/httpservlet/filehandler.rb:241:in `service'
  	D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:140:in `service'
  	D:/a/ruby/ruby/src/lib/webrick/httpserver.rb:96:in `run'
  	D:/a/ruby/ruby/src/lib/webrick/server.rb:307:in `block in start_thread'
```
2020-06-20 00:17:07 +09:00
Kazuhiro NISHIYAMA 32e2440a66
Fix `ERROR ArgumentError: invalid byte sequence in UTF-8`
http://ci.rvm.jp/results/trunk-test@ruby-sky1/3012894
```
/tmp/ruby/v3/src/trunk-test/tool/lib/minitest/unit.rb:199:in `assert': webrick log start: (MiniTest::Assertion)
  [2020-06-19 23:01:59] ERROR ArgumentError: invalid byte sequence in UTF-8
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/filehandler.rb:336:in `scan'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/filehandler.rb:336:in `set_filename'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/filehandler.rb:310:in `exec_handler'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/filehandler.rb:245:in `do_GET'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/abstract.rb:105:in `service'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpservlet/filehandler.rb:241:in `service'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpserver.rb:140:in `service'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/httpserver.rb:96:in `run'
  	/tmp/ruby/v3/src/trunk-test/lib/webrick/server.rb:307:in `block in start_thread'
```
2020-06-19 23:06:38 +09:00
Kazuhiro NISHIYAMA 97c1782db6
Use filesystem encoding as FileHandler's encoding
instead of `@root.encoding`.
And fallback to ASCII-8BIT when filesystem encoding is US-ASCII.

When `@root.encoding` is not compatible filesystem encoding,
`Encoding::CompatibilityError` raised at `webrick/httpservlet/filehandler.rb:341`.
So `DocumentRoot` must be compatible with filesystem encoding.
2020-06-19 22:56:29 +09:00
Kazuhiro NISHIYAMA 78d4eace02
Do not change local_path encoding in WEBrick::HTTPServlet::DefaultFileHandler
This reverts 750203c514 and 93e6fa1d31
2020-06-19 22:08:19 +09:00
Kazuhiro NISHIYAMA 6fe1919486
Fix failure on mswin CI
https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200619T054159Z.fail.html.gz
```
  1) Failure:
WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200619-14304-utgij/ruby/test/webrick/utils.rb:72]:
exceptions on 2 threads:
webrick log start:
  [2020-06-19 16:28:42] ERROR `/あ.txt' not found.

webrick log end
Filesystem encoding is Windows-31J.
<"200"> expected but was
<"404">.
---
<[]> expected but was
<["[2020-06-19 16:28:42] ERROR `/\xE3\x81\x82.txt' not found.\n"]>.
```

`prevent_directory_traversal` treats `path_info` as filesystem encoding.
So path_info should be filesystem encoding in request URL.

On some environments, fallback to ASCII-8BIT when EncodingError.
2020-06-19 20:13:22 +09:00
Kazuhiro NISHIYAMA daa9dcd57e
Hide error location from error message 2020-06-19 20:13:22 +09:00
Nobuyoshi Nakada 63aadc237f [Feature #16254] Use `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada 49f0fd21e4 [Feature #16254] Allow `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada d863f4bccd [Feature #16254] Use `__builtin.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada c8703a17ce [Feature #16254] Allow `__builtin.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada f3e081c6b6
Build configured extension libraries only
Consider the libraries, which remain exts.mk but not listed in
ext/configure-ext.mk, removed.
2020-06-19 15:35:14 +09:00
Nobuyoshi Nakada aa21a775a6
Configure only directories having extconf.rb 2020-06-19 15:13:59 +09:00
Nobuyoshi Nakada 1e7c0ccb0d
Now bundled gems are extracted under .bundle/gems 2020-06-19 14:02:46 +09:00
Nobuyoshi Nakada 0d38a51ec4
Clean exts.mk under each extension library 2020-06-19 12:07:19 +09:00
Yusuke Endoh 946fdeaddc test/ruby/test_refinement.rb: suppress warning yb $VEROBSE = nil
http://rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200619T003004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20200619T003004Z/ruby/test/ruby/test_refinement.rb:2428: warning: method redefined; discarding old foo
/home/chkbuild/chkbuild/tmp/build/20200619T003004Z/ruby/test/ruby/test_refinement.rb:2418: warning: previous definition of foo was here
```
2020-06-19 10:45:13 +09:00
Hiroshi SHIBATA d76296d8bb Revert accidentally style-format 2020-06-19 08:26:47 +09:00
Hiroshi SHIBATA e92a9399cc Added sdbm entry to NEWS 2020-06-19 08:26:47 +09:00
Hiroshi SHIBATA 70b8bdbc90 Removed sdbm entries from doc 2020-06-19 08:26:47 +09:00
Hiroshi SHIBATA 16854c95c2 Removed sdbm entries from toolchanins 2020-06-19 08:26:47 +09:00
Hiroshi SHIBATA 343ad9eff5 Removed sdbm and it tests 2020-06-19 08:26:47 +09:00
Jean Boussier adbdf11f94 [open3] only close streams if a block is passed
Ref: 5429deb075

The previous change totally borke `popen2e` in this usage:

```ruby
require 'open3'
stdin, stdout, process = Open3.popen2e("cat")
puts stdout.read
```
2020-06-18 10:00:20 -07:00
Kazuhiro NISHIYAMA 42b4234ba4
Add links [ci skip] 2020-06-19 00:59:30 +09:00
Yusuke Endoh 26c1cf6a60 test/webrick/test_httpresponse.rb: Use a longer indicator for crack
"hack" was too short.  The tests checks the error html, which includes
hostname.  GitHub Actions hostname seems randomly generated, and it may
include the indicator string.

https://github.com/ruby/ruby/runs/784896235
```
  1) Failure:
WEBrick::TestHTTPResponse#test_prevent_response_splitting_cookie_headers_cr [/home/runner/work/ruby/ruby/src/test/webrick/test_httpresponse.rb:71]:
Expected /hack/ to not match "HTTP/1.1 500 Internal Server Error\r\nContent-Type: text/html; charset=ISO-8859-1\r\n\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<HTML>\n  <HEAD><TITLE>Internal Server Error</TITLE></HEAD>\n  <BODY>\n    <H1>Internal Server Error</H1>\n    WEBrick::HTTPResponse::InvalidHeader\n    <HR>\n    <ADDRESS>\n     WEBrick/1.6.0 (Ruby/2.8.0/2020-06-18) at\n     fv-az89.dddawhu1s14uzpjkiz5fhackre.cx.internal.cloudapp.net:80\n    </ADDRESS>\n  </BODY>\n</HTML>\n".
```

This change uses longer indicator "cracked_indicator_for_test" instead.
2020-06-19 00:57:18 +09:00
Jeremy Evans c0591b8477 Update NEWS.md [ci skip] 2020-06-18 08:47:02 -07:00
Jeremy Evans b6d6b89615 Allow refining a frozen class
Doing so modifies the class's method table, but not in a way that should
be detectable from Ruby, so it may be safe to avoid checking if the
class is frozen.

Fixes [Bug #11669]
2020-06-18 08:22:40 -07:00
Jeremy Evans 95dc9c07f3 Raise RuntimeError for class variable overtaken in nonverbose mode
900e83b501 changed from a warning
to an error in this case, but the warning was only issued in
verbose mode, and therefore the error was only raised in verbose
mode.  That was not intentional, verbose mode should only change
whether warnings are emitted, not other behavior.  This issues
the RuntimeError in all cases.

This change broke a couple tests, as the tests actually issued
the warning and therefore now raise an error.  This wasn't caught
earlier as test_variable suppressed the warning in this case,
effectively setting $VERBOSE = false around the code that warned.
basictest isn't run in verbose mode and therefore didn't expose
the issue previously. Fix these tests.

Fixes [Bug #14541]
2020-06-18 08:21:29 -07:00
Jeremy Evans aae8223c70 Dup splat array in certain cases where there is a block argument
This makes:

```ruby
  args = [1, 2, -> {}]; foo(*args, &args.pop)
```

call `foo` with 1, 2, and the lambda, in addition to passing the
lambda as a block.  This is different from the previous behavior,
which passed the lambda as a block but not as a regular argument,
which goes against the expected left-to-right evaluation order.

This is how Ruby already compiled arguments if using leading
arguments, trailing arguments, or keywords in the same call.

This works by disabling the optimization that skipped duplicating
the array during the splat (splatarray instruction argument
switches from false to true).  In the above example, the splat
call duplicates the array.  I've tested and cases where a
local variable or symbol are used do not duplicate the array,
so I don't expect this to decrease the performance of most Ruby
programs.  However, programs such as:

```ruby
  foo(*args, &bar)
```

could see a decrease in performance, if `bar` is a method call
and not a local variable.

This is not a perfect solution, there are ways to get around
this:

```ruby
  args = Struct.new(:a).new([:x, :y])
  def args.to_a; a; end
  def args.to_proc; a.pop; ->{}; end
  foo(*args, &args)
  # calls foo with 1 argument (:x)
  # not 2 arguments (:x and :y)
```

A perfect solution would require completely disabling the
optimization.

Fixes [Bug #16504]
Fixes [Bug #16500]
2020-06-18 08:19:33 -07:00
git 6439c939db * 2020-06-19 [ci skip] 2020-06-19 00:18:51 +09:00
Jeremy Evans 41582d5866 Make Module#prepend affect the iclasses of the module
3556a834a2 added support for
Module#include to affect the iclasses of the module.  It didn't add
support for Module#prepend because there were bugs in the object model
and GC at the time that prevented it.  Those problems have been
addressed in ad729a1d11 and
98286e9850, and now adding support for
it is straightforward and does not break any tests or specs.

Fixes [Bug #9573]
2020-06-18 08:18:31 -07:00
Yusuke Endoh 750203c514 lib/webrick/httpservlet/filehandler.rb: always handle a path as UTF-8
https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200618T113134Z.fail.html.gz
```
  1) Failure:
WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200618-84004-1t0dh8f/ruby/test/webrick/utils.rb:72]:
exceptions on 2 threads:
webrick log start:
  [2020-06-18 22:18:07] ERROR `/??.txt' not found.

webrick log end
Filesystem encoding is Windows-31J.
<"200"> expected but was
<"404">.
```
2020-06-18 23:43:48 +09:00
Nobuyoshi Nakada 50c13eb718
NEWS about Hash#except ENV#except [Feature #15822] 2020-06-18 23:09:11 +09:00
Timo Schilling 82ca8c7303
Add Hash#except ENV#except [Feature #15822] 2020-06-18 22:47:32 +09:00
Burdette Lamar a5bc0b8f8c
[ci skip] Enhanced RDoc for Array (#3224)
Methods:

    #to_a
    #to_h
    #to_ary
    #reverse!
    #reverse
2020-06-18 08:30:04 -05:00
David Rodríguez c5ee078c5f [rubygems/rubygems] Disable parallel installation by default on Windows
Since we enabled parallel installation by default, we've fixed all the
issues related to it that have come up, except for a Windows issue that
we haven't yet figured out. This issue is hit by our specs on a daily
basis and there's no reason to believe that it won't be hit by end users
in a similar way.

So, both to stop the testing flakyness and to prevent regressions in the
default behavior on Windows, I'd rather leave the default as it was
before on Windows for now.

https://github.com/rubygems/rubygems/commit/5d8ab57131
2020-06-18 19:14:15 +09:00