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

58512 Коммитов

Автор SHA1 Сообщение Дата
Yusuke Endoh 417c64b9a8 ext/json/parser/parser.rl: Use "signed" char to contain negative values
char is not always signed.  In fact, it is unsigned in arm.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20191004T181708Z.log.html.gz
```
compiling parser.c
parser.rl: In function ‘unescape_unicode’:
parser.rl:50:5: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     if (b < 0) return UNI_REPLACEMENT_CHAR;
     ^
```
2019-10-05 07:00:57 +09:00
Yusuke Endoh 5717e55e9a ext/json/parser/prereq.mk: Add a "automatically generated" header
to parser.c.
2019-10-05 07:00:07 +09:00
Yusuke Endoh 076d3d758b ext/json/parser/parser.rl: Update the source code of parser.c
There have been some direct changes in parser.c which is automatically
generated from parser.rl.  This updates parser.rl to sync the changes:

* 91793b8967
* 79ead821dd
* 80b5a0ff2a
2019-10-05 06:34:40 +09:00
Aaron Patterson bd4b65f4b0
IMEMO objects don't have a class, so return early
IMEMO objects don't have a class field to update, so we need to return
early, otherwise it can cause a segv.
2019-10-04 12:02:41 -07:00
Aaron Patterson a20ed0565e
Don't allocate objects in `gc_compact`
I'd like to call `gc_compact` after major GC, but before the GC
finishes.  This means we can't allocate any objects inside `gc_compact`.
So in this commit I'm just pulling the compaction statistics allocation
outside the `gc_compact` function so we can safely call it.
2019-10-04 11:11:59 -07:00
git cbf88064f5 * 2019-10-05 [ci skip] 2019-10-05 03:07:31 +09:00
Nobuyoshi Nakada cbbe198c89
Fix potential memory leaks by `rb_imemo_tmpbuf_auto_free_pointer`
This function has been used wrongly always at first, "allocate a
buffer then wrap it with tmpbuf".  This order can cause a memory
leak, as tmpbuf creation also can raise a NoMemoryError exception.
The right order is "create a tmpbuf then allocate&wrap a buffer".
So the argument of this function is rather harmful than just
useless.

TODO:
* Rename this function to more proper name, as it is not used
  "temporary" (function local) purpose.
* Allocate and wrap at once safely, like `ALLOCV`.
2019-10-05 03:02:09 +09:00
Yusuke Endoh c8a18e25c1 iseq.c (rb_iseq_compile_on_base): Removed
ko1 cannot remember why he introduced the function.  And it is not used.

After it is removed, the argument "base_block" of
rb_iseq_compile_with_option is always zero.
2019-10-04 21:30:32 +09:00
Yusuke Endoh 113bef6976 array.c (rb_mem_clear): remove "register" from arguments
to suppress the following warning:

```
compiling cxxanyargs.cpp
In file included from cxxanyargs.cpp:1:
In file included from ../../.././include/ruby/ruby.h:2150:
../../.././include/ruby/intern.h:56:19: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                  ^~~~~~~~~
../../.././include/ruby/intern.h:56:36: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);
                                   ^~~~~~~~~
```
2019-10-04 16:07:46 +09:00
Alan Wu 5be2af5f90 Remove call-seq for method that doesn't exist (#2521)
```
$ ruby -ve 'IO.popen("ls"){}; $?.to_int'
ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
Traceback (most recent call last):
-e:1:in `<main>': undefined method `to_int' for #<Process::Status: pid 33989 SIGPIPE (signal 13)> (NoMethodError)
Did you mean?  to_i
               taint
```

Process::Status#to_int was removed at 7ba5c4e.
2019-10-04 10:15:24 +09:00
Takashi Kokubun 7db83b04d0
Revert "Simplify bin_path_spec.rb guard"
This reverts commit a56d742e69.

I was checking the CI result of the wrong revision. It actually worked
fine https://ci.appveyor.com/project/ruby/ruby/builds/27866303. Never
mind...
2019-10-03 15:58:20 -07:00
Takashi Kokubun a56d742e69
Simplify bin_path_spec.rb guard
For some reason the guard_not seems not working as expected
https://ci.appveyor.com/project/ruby/ruby/builds/27866153/job/v6wa6q6p7b7n7r37
2019-10-03 15:33:11 -07:00
Takashi Kokubun ac69a051cf
Ignore arm32 failure for now 2019-10-03 15:15:05 -07:00
Takashi Kokubun 182336ccb5
bin_path_spec.rb has failed from the beginning
for mswin. This spec is not valid for mswin platform.
https://ci.appveyor.com/project/ruby/ruby/builds/27748774/job/85khngfpc806m5lj
2019-10-03 14:25:45 -07:00
Takashi Kokubun 804672e7b4
Try disabling build on trunk 2019-10-03 14:17:36 -07:00
Jeremy Evans 9f24e8fdbb Document *_kw functions added to include/ruby/ruby.h [ci skip]
Also documents the non-*_kw functions if they were not already
documented.
2019-10-03 14:13:27 -07:00
Jeremy Evans c7715a4936 Add documentation regarding keyword argument separation [ci skip] 2019-10-03 14:13:27 -07:00
Jeremy Evans 12e27a411c Minor updates to methods and calling_methods documentation [ci skip] 2019-10-03 14:13:27 -07:00
Jun Aruga bdbf8de498 Enable Drone CI for ARM 64/32-bit cases. (#2520)
https://bugs.ruby-lang.org/issues/16234
2019-10-04 06:12:58 +09:00
Yusuke Endoh c3dd3b9553 iseq.c (rb_iseq_compile_with_option): dummy parent_iseq for the parser
The parsing of `RubyVM::InstructionSequence.compile` does not support an
outer scope currently.  So it specified NULL as parent_iseq for the
parser.  However, it resulted in the following false-positive warning.

```
RubyVM::InstructionSequence.compile(<<END)
  o = Object.new
  o #=> <compiled>:2: warning: possibly useless use of a variable in void context
END
```

This change specifies a dummy empty parent_iseq instead of NULL, which
suppresses the false positive.
2019-10-04 02:35:10 +09:00
Yusuke Endoh b732a9f8a0 parse.y: use "struct rb_iseq_struct" instead of rb_iseq_t
typedef was not declared in parse.y.  Sorry.
2019-10-04 02:34:36 +09:00
git bb9604e18c * 2019-10-04 [ci skip] 2019-10-04 02:30:54 +09:00
Yusuke Endoh b43afa0a8f Make parser_params have parent_iseq instead of base_block
The parser needs to determine whether a local varaiable is defined or
not in outer scope.  For the sake, "base_block" field has kept the outer
block.

However, the whole block was actually unneeded; the parser used only
base_block->iseq.

So, this change lets parser_params have the iseq directly, instead of
the whole block.
2019-10-04 02:30:36 +09:00
Yusuke Endoh 711c40ebdc Refactor parser_params by removing "in_main" flag
The relation between parser_param#base_block and #in_main were very
subtle.
A main script (that is passed via a command line) was parsed under
base_block = TOPLEVEL_BINDING and in_main = 1.
A script loaded by Kernel#require was parsed under
base_block = NULL and in_main = 0.
If base_block is non-NULL and in_main == 0, it is parsed by Kernel#eval
or family.

However, we know that TOPLEVEL_BINDING has no local variables when a
main script is parsed.  So, we don't have to parse a main script under
base_block = TOPLEVEL_BINDING.

Instead, this change parses a main script under base_block = 0.
If base_block is non-NULL, it is parsed by Kernel#eval or family.
By this simplication, "in_main" is no longer needed.
2019-10-04 02:30:36 +09:00
Nobuyoshi Nakada 8f7fca784a
make-snapshot: touch updated files after prepared
Align mtime of files updated by `make prepare-package` to make
packages reproducible.
2019-10-03 19:14:49 +09:00
Nobuyoshi Nakada 8142a9b43d
make-snapshot: suppress make error messages unless failed 2019-10-03 19:12:03 +09:00
Nobuyoshi Nakada 47d143be17
make-snapshot: copy cache files instead of linking
To get rid of setting mode and mtime of the original cache files.
2019-10-03 19:09:16 +09:00
Nobuyoshi Nakada b7ae26e2ee
vcs.rb: fix to export git-svn version
* Use the given branch name instead of implicit 'HEAD".
* Format like as git-svn when `from` or `to` is SVN revision
  number.
2019-10-03 19:07:48 +09:00
Hiroshi SHIBATA ad67adb5f9
[ruby/fileutils] Use pend instead of skip
https://github.com/ruby/fileutils/commit/ba2c24e2d7
2019-10-03 18:32:29 +09:00
Hiroshi SHIBATA c14755e9ca
[ruby/fileutils] improve the compatibility of minitest
https://github.com/ruby/fileutils/commit/f16f5a0dd6
2019-10-03 18:32:21 +09:00
卜部昌平 3ffd98c5cd add debug counters for vm_search_method_slowpath()
Implemented fine-grained inspection of cache misshits.  Handy for
counting the reasons why an inline method cache was evicted.
2019-10-03 15:24:09 +09:00
卜部昌平 84fc1de512 use bind_call for test-all --gc-stress
This one allocation of Method object is worth avoiding.  We don't
want to test UnboundMethod#bind right here.  GC need not run.
2019-10-03 15:24:09 +09:00
Romain Tartière 1c999952e7 Resolve unused local variable reported by LGTM
LGTM reports that the value assigned to local variable 'shared' is never
used:
f319a5d064/files/misc/lldb_cruby.py (x6512c0281581a470):1

This problem was introduced in by the refactoring that took place in
7c496b6624.
2019-10-03 13:44:52 +09:00
git a515e3f99e * 2019-10-03 [ci skip] 2019-10-03 12:48:30 +09:00
git 7e060d5018 * expand tabs. [ci skip]
Tabs were expanded because previously the file did not have any tab indentation.
Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook.
2019-10-03 12:48:20 +09:00
卜部昌平 eb92159d72 Revert https://github.com/ruby/ruby/pull/2486
This reverts commits: 10d6a3aca7 8ba48c1b85 fba8627dc1 dd883de5ba
6c6a25feca 167e6b48f1 7cb96d41a5 3207979278 595b3c4fdd 1521f7cf89
c11c5e69ac cf33608203 3632a812c0 f56506be0d 86427a3219 .

The reason for the revert is that we observe ABA problem around
inline method cache.  When a cache misshits, we search for a
method entry.  And if the entry is identical to what was cached
before, we reuse the cache.  But the commits we are reverting here
introduced situations where a method entry is freed, then the
identical memory region is used for another method entry.  An
inline method cache cannot detect that ABA.

Here is a code that reproduce such situation:

```ruby
require 'prime'

class << Integer
  alias org_sqrt sqrt
  def sqrt(n)
    raise
  end

  GC.stress = true
  Prime.each(7*37){} rescue nil # <- Here we populate CC
  class << Object.new; end

  # These adjacent remove-then-alias maneuver
  # frees a method entry, then immediately
  # reuses it for another.
  remove_method :sqrt
  alias sqrt org_sqrt
end

Prime.each(7*37).to_a # <- SEGV
```
2019-10-03 12:45:24 +09:00
Jeremy Evans ef697388be
Treat return in block in class/module as LocalJumpError (#2511)
return directly in class/module is an error, so return in
proc in class/module should also be an error.  I believe the
previous behavior was an unintentional oversight during the
addition of top-level return in 2.4.
2019-10-02 07:56:28 -07:00
Koichi Sasada 9759e3c9f0 fix assertion number.
On parallel test, there are additional tests because of implicit
checkers which are enabled on 84cbce3d88.
2019-10-02 17:19:14 +09:00
Nobuyoshi Nakada 4ed51b3956
Fixed failure message for `clean-cache` 2019-10-02 17:03:55 +09:00
Koichi Sasada 84cbce3d88 Enable checkers on parallel test.
parallel test (`make test-all TESTS=-j8`) runs tests on specified
number of processes. However, some test checkers written in
`runner.rb` are not loaded. This fix enable these checkers on
parallel tests.

See also: https://github.com/ruby/ruby/pull/2508
2019-10-02 16:23:00 +09:00
Alan Wu 99d3043bd8 Iseq#to_binary: dump flag for **nil (#2508)
RUBY_ISEQ_DUMP_DEBUG=to_binary and the attached test case was failing.
Dump the flag to make sure `**nil` can round-trip properly.
2019-10-02 16:05:40 +09:00
git 4946d83a1c * 2019-10-02 [ci skip] 2019-10-02 13:00:56 +09:00
NAKAMURA Usaku a61ae414b6 Fix the order of executing `after-update` task 2019-10-02 13:00:17 +09:00
NAKAMURA Usaku 5af2c8735a Should fail if `system` failed 2019-10-02 12:59:59 +09:00
Hiroshi SHIBATA 15606963de expose assert_raise and assert_join_threads 2019-10-01 22:19:18 +09:00
Kazuhiro NISHIYAMA 55de0282da
Remove draft-release.yml [ci skip]
I thought default branch's workflow runs on any tags,
but it does not run for stable branches without draft-release.yml.
So I abandoned, and use workflow in ruby/actions instead.
2019-10-01 21:26:54 +09:00
Yusuke Endoh 3ce238b5f9 WEBrick: prevent response splitting and header injection
This is a follow up to d9d4a28f1c.
The commit prevented CRLR, but did not address an isolated CR or an
isolated LF.

Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>
2019-10-01 19:19:56 +09:00
Nobuyoshi Nakada 36e057e26e Loop with String#scan without creating substrings
Create the substrings necessary parts only, instead of cutting the
rest of the buffer.  Also removed a useless, probable typo, regexp.
2019-10-01 19:19:56 +09:00
Nobuyoshi Nakada a0a2640b39 Fix for wrong fnmatch patttern
* dir.c (file_s_fnmatch): ensure that pattern does not contain a
  NUL character.  https://hackerone.com/reports/449617
2019-10-01 19:19:56 +09:00
Yusuke Endoh a38fe1fbf0 ext/-test-/enumerator_kw/enumerator_kw.c: remove unused variable 2019-10-01 08:57:50 +09:00