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

7584 Коммитов

Автор SHA1 Сообщение Дата
Yusuke Endoh d732bc51bd Revert "Revert "Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"""
This reverts commit 87f6154bb4.

It turned out that the change fails to build on macOS

https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1014/ruby-master/log/20200304T074503Z.fail.html.gz
```
+ make 'TESTS=--hide-skip -v fiddle' RUBYOPT=-w test-all
dyld: lazy symbol binding failed: Symbol not found: _ffi_closure_alloc
  Referenced from: /Users/hsbt/Documents/cb/tmp/build/20200304T074503Z/ruby/.ext/x86_64-darwin18/fiddle.bundle
  Expected in: flat namespace

dyld: Symbol not found: _ffi_closure_alloc
  Referenced from: /Users/hsbt/Documents/cb/tmp/build/20200304T074503Z/ruby/.ext/x86_64-darwin18/fiddle.bundle
  Expected in: flat namespace

make: *** [yes-test-all] Abort trap: 6
```
2020-03-04 17:28:21 +09:00
Yusuke Endoh 87f6154bb4 Revert "Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)""
This reverts commit efd641ffab.

This changeset seems to be needed to suppress a warning on Ubuntu 20.04
https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20200304T033004Z.log.html.gz
```
closure.c:264:5: warning: 'ffi_prep_closure' is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
  264 |     result = ffi_prep_closure(pcl, cif, callback, (void *)self);
      |     ^~~~~~
```

I guess there was a reason why the commit was reverted (maybe some CIs
failed?), so try it again.
2020-03-04 15:46:26 +09:00
Kazuhiro NISHIYAMA 761528e8aa
Add `#write` and `#binwrite` to IO section [ci skip] 2020-03-02 16:05:44 +09:00
Takashi Kokubun 7da11ed738
Suppress security alerts
https://github.com/advisories/GHSA-jppv-gw3r-w3q8
2020-02-28 21:05:08 -08:00
Koichi Sasada b3983c68dd should not expose hidden object.
Hidden object (T_CLASS) can be exposed (BUG).
Also rename rb_mInternalObjectWrapper to rb_cInternalObjectWrapper
because it is a class.
2020-02-29 04:22:17 +09:00
Hiroshi SHIBATA 229ba1215f
Merge racc from upstream repository.
* Support Ruby 2.4's frozen string literals.
  * Remove VCS revisions headers.
2020-02-27 13:33:51 +09:00
卜部昌平 0febd07c69 ext/-test-/cxxanyargs: use try_link instead
We would like to skip this extension library when libstdc++ is missing.
To avoid such situation let's use try_link instead of try_compile.
2020-02-25 13:39:46 +09:00
Masataka Pocke Kuwabara fa1ec60424 Fix wrong documentation for return value of Pathname#fnmatch 2020-02-25 16:53:35 +13:00
Koichi Sasada b9007b6c54 Introduce disposable call-cache.
This patch contains several ideas:

(1) Disposable inline method cache (IMC) for race-free inline method cache
    * Making call-cache (CC) as a RVALUE (GC target object) and allocate new
      CC on cache miss.
    * This technique allows race-free access from parallel processing
      elements like RCU.
(2) Introduce per-Class method cache (pCMC)
    * Instead of fixed-size global method cache (GMC), pCMC allows flexible
      cache size.
    * Caching CCs reduces CC allocation and allow sharing CC's fast-path
      between same call-info (CI) call-sites.
(3) Invalidate an inline method cache by invalidating corresponding method
    entries (MEs)
    * Instead of using class serials, we set "invalidated" flag for method
      entry itself to represent cache invalidation.
    * Compare with using class serials, the impact of method modification
      (add/overwrite/delete) is small.
    * Updating class serials invalidate all method caches of the class and
      sub-classes.
    * Proposed approach only invalidate the method cache of only one ME.

See [Feature #16614] for more details.
2020-02-22 09:58:59 +09:00
Koichi Sasada f2286925f0 VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).

iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).

To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).

struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.

rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
2020-02-22 09:58:59 +09:00
卜部昌平 4e6bae47c8 ext/-test-/cxxanyargs: prevent have_devel check
The `cxx.try_compile` command in this file kicks `cxx.have_devel?`
internally, which recursively calls `cxx.try_link` with a different
source code.  We don't want that happen (the source code compiled in
this file must be the first one).  We need to fake the system.
2020-02-20 11:46:54 +09:00
Nobuyoshi Nakada 2115a3937d
[ruby/io-console] bump up to 0.5.6 2020-02-18 11:34:38 +09:00
Nobuyoshi Nakada 5ef383552d
[ruby/io-console] Just ignore the extension on other than CRuby
https://github.com/ruby/io-console/commit/41b6f09574
2020-02-18 11:33:06 +09:00
Kazuki Yamaguchi 99b191d83f [ruby/openssl] ts: simplify OpenSSL::Timestamp::Request#algorithm
Stop the special treatment of invalid hashAlgorithm of the message
imprint. Those invalid values can only appear after the object is
instantiated, before the user sets an actual message digest algorithm.

OpenSSL::Timestamp::TokenInfo#algorithm already does the same.

Also, remove the test case "test_create_request" since it does not make
much sense. Those fields are to be set by the user after creation of
the object and checking the initial value is pointless.

Fixes: https://github.com/ruby/openssl/issues/335

https://github.com/ruby/openssl/commit/890a6476fa
2020-02-17 20:50:47 +09:00
Nobuyoshi Nakada dec802d8b5 [ruby/io-console] [DOC] Improved about `intr:`
https://github.com/ruby/io-console/commit/82b630cd79
2020-02-17 12:05:09 +09:00
Yusuke Endoh 0b55f8a14f ext/openssl/extconf.rb: avoid -Werror=deprecated-declarations
It fails to build on Solaris:

https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20200216T090008Z.log.html.gz
```
ossl_cipher.c: 関数 ‘ossl_cipher_init’ 内:
ossl_cipher.c:228:2: エラー: ‘EVP_md5’ is deprecated [-Werror=deprecated-declarations]
  228 |  EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv,
      |  ^~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:73,
                 from /usr/include/openssl/x509v3.h:63,
                 from ossl.h:23,
                 from ossl_cipher.c:10:
/usr/include/openssl/evp.h:732:26: 備考: ここで宣言されています
  732 | DEPRECATED const EVP_MD *EVP_md5(void);
      |                          ^~~~~~~
```
2020-02-16 19:14:23 +09:00
Hiroshi SHIBATA b99775b163
Import openssl-2.2.0 (#2693)
Import the master branch of ruby/openssl for preparing to release openssl-2.2.0
2020-02-16 15:21:29 +09:00
Hiroshi SHIBATA 05485868cb Workaround for bison provided by scoop on mswin environment 2020-02-15 21:20:25 +09:00
Kazuhiro NISHIYAMA 79ad50d219
Fix call-seq of Pathname#{,l}ch{mod,own} [ci skip] 2020-02-15 12:14:12 +09:00
Nobuyoshi Nakada 78282d4655
[ruby/io-console] Prefer keyword arguments
https://github.com/ruby/io-console/commit/5facbfc4c8
2020-02-14 20:30:34 +09:00
Alan Wu 9c5a2fed85 Fix readline build dependency 2020-02-09 11:27:32 -05:00
aycabta f3471174bb [ruby/readline-ext] Use rake/extensiokntask to build
https://github.com/ruby/readline-ext/commit/b0b5f709bd
2020-02-09 20:22:12 +09:00
aycabta 108a288079 [ruby/readline-ext] Add spec.extensions
https://github.com/ruby/readline-ext/commit/8c33abb13c
2020-02-09 20:22:12 +09:00
aycabta a629f147cd [ruby/readline-ext] The ruby/assert.h is adopted by Ruby 2.7 or later
https://github.com/ruby/readline-ext/commit/106c31fc1b
2020-02-09 20:22:12 +09:00
aycabta 05711adfb4 [ruby/readline-ext] Remove unnecessary -I$(top_srcdir) when it's an individual gem
https://github.com/ruby/readline-ext/commit/efaca4a5f4
2020-02-09 20:22:12 +09:00
aycabta 9dcb324fbe Revert "[ruby/readline-ext] Include ruby/assert.h in ruby/ruby.h so that assertions can be there"
This reverts commit 425b2064d3.

This cherry-pick was a mistake.
2020-02-09 20:22:12 +09:00
卜部昌平 115fec062c more on NULL versus functions.
Function pointers are not void*.  See also
ce4ea956d2
8427fca49b
2020-02-07 14:24:19 +09:00
Kazuhiro NISHIYAMA 3c7a09ece8
Add call-seq to Pathname#open from File.open
before:
```
  open(p1 = v1, p2 = v2, p3 = v3)
```
2020-02-04 20:56:13 +09:00
Mikhail Novosyolov 7c165bd7d9 Fix linkage of popen_deadlock test
DEBUG: BUILDSTDERR: /usr/bin/ld: infinite_loop_dlsym.o: in function `native_loop_dlsym':
DEBUG: BUILDSTDERR: /builddir/build/BUILD/ruby-2.7.0/ext/-test-/popen_deadlock/infinite_loop_dlsym.c:16: undefined reference to `dlsym'
DEBUG: BUILDSTDERR: collect2: error: ld returned 1 exit status

Ruby was built with LibreSSL.
2020-02-04 08:04:13 +09:00
卜部昌平 7cff2f4585 fix delete unnecessary return
Was my mistake to put return here.
2020-02-01 14:02:59 +09:00
卜部昌平 cdd75d4e7f support C++ std::nullptr_t
C++ keyword `nullptr` represents a null pointer (note also that NULL is
an integer in C++ due to its design flaw).  Its type is `std::nullptr_t`,
defined in <cstddef> standard header.  Why not support it when the
backend implementation can take a null pointer as an argument.
2020-01-31 13:01:52 +09:00
Nobuyoshi Nakada 4942adf68c
Return the makefile content
Block for `create_makefile` is expected to return the content of
the makefile.
2020-01-31 12:52:22 +09:00
NARUSE, Yui ca2888fb3d Move .IGNORE in extconf.rb 2020-01-31 08:00:56 +09:00
NARUSE, Yui 9aed421d70 Support nmake 2020-01-31 06:47:55 +09:00
NARUSE, Yui 53adb53c9a Ignore expected errors on compiling C++ source [Bug #16331]
BSD make can run parallel more aggressively than GNU make. It communicate
with other make process through -J option in MAKEFLAGS environment variable
to notify a build failure happend in an other pararell make process.
https://www.freebsd.org/cgi/man.cgi?make

It usually works well but ext/-test-/cxxanyargs/Makefile has two targets
which are expected to fail (failure.o and failurem1.o).

Additional note:
To test and debug this issue, following command will speed up it.
`make -f exts.mk -j8 clean all`
2020-01-31 03:05:51 +09:00
卜部昌平 83d6487ae5 fix rb_define_global_function to take const VALUE*
It was unable for rb_define_global_function to take VALUE(*)(int argc,
const VLAUE *argv, VALUE self) -style function.  Test added.
2020-01-28 17:29:57 +09:00
卜部昌平 bbe3420cce add test for rb_define_global_function
was missing.
2020-01-28 17:09:42 +09:00
卜部昌平 16592d6b69 add test for rb_define_method_id
was missing.
2020-01-28 17:09:42 +09:00
卜部昌平 3c3eb418f9 improved support for rb_f_notimplement
rb_f_notimplement should be accepted for all possible arities.

Test provided for that.
2020-01-28 17:09:42 +09:00
Nobuyoshi Nakada 27ac1c615d
Revert pathname, rb_warn_deprecated* are not public API 2020-01-23 21:49:58 +09:00
Nobuyoshi Nakada aefb13eb63
Added rb_warn_deprecated_to_remove
Warn the deprecation and future removal, with obeying the warning
flag.
2020-01-23 21:42:15 +09:00
Nobuyoshi Nakada 425b2064d3 [ruby/readline-ext] Include ruby/assert.h in ruby/ruby.h so that assertions can be there
https://github.com/ruby/readline-ext/commit/4d44c12832
2020-01-23 13:31:19 +09:00
Jeremy Evans e18b817b1f Make taint warnings non-verbose instead of verbose 2020-01-22 11:19:13 -08:00
Kazuhiro NISHIYAMA c90fc55a1f Drop executable bit of *.{yml,h,mk.tmpl} 2020-01-22 16:04:38 +09:00
Jeremy Evans 9f99760daf
Get rid of use of special variables
Use `"\n"` and `IO#fileno` instead of `$/` and `$.` respectively.
[Feature #14240]
2020-01-20 16:58:58 +09:00
Nobuyoshi Nakada 199d829a51
[ruby/io-console] bump up to 0.5.5 2020-01-18 00:17:05 +09:00
Nobuyoshi Nakada 4e56ec4ef7 [ruby/io-console] Set `OPOST` when `intr` is true
To enable implementation-defined output processing, for the
compatibility with readline.  [Bug #16509]

https://bugs.ruby-lang.org/issues/16509

https://github.com/ruby/io-console/commit/8c8b0b6757
2020-01-18 00:15:02 +09:00
Hiroshi SHIBATA 4e1a7678cd [ruby/io-console] Update the minimum requirement of Ruby version
https://github.com/ruby/io-console/commit/73e7b6318a
2020-01-18 00:14:58 +09:00
Nobuyoshi Nakada f9788ca7fe
Update dependencies
internal/rational.h needs internal/warnings.h with Apple clang,
for `UNALIGNED_MEMBER_ACCESS`.
2020-01-17 16:41:46 +09:00
Kazuhiro NISHIYAMA 4e6bcac23e
Update dependencies in makefiles again
patch from https://travis-ci.org/ruby/ruby/jobs/638231960
2020-01-17 11:19:01 +09:00
Kenta Murata 47465ab1cc
rb_rational_raw: make a denominator always positive 2020-01-17 10:57:21 +09:00
Kazuhiro NISHIYAMA 73618d84e8
Update dependencies in makefiles
patch from https://travis-ci.org/ruby/ruby/jobs/638226493
2020-01-17 10:25:00 +09:00
zverok 7f1e3a7b7c [flori/json] Add :nodoc: for GeneratorMethods
https://github.com/flori/json/commit/2f3f44c180
2020-01-06 15:13:50 +09:00
zverok 41ef6df8c9 [flori/json] Fix examples syntax
https://github.com/flori/json/commit/3845491d92
2020-01-06 15:13:35 +09:00
zverok 2e5ef30cb9 [flori/json] Enchance generic JSON and #generate docs
https://github.com/flori/json/commit/4ede0a7d19
2020-01-06 15:13:15 +09:00
Jeremy Evans 1658e6b5db
[flori/json] Remove invalid JSON.generate description from JSON module rdoc
This text used to be true in older versions of json, but has not
been true for a number of years (since json version 2 I think).

https://github.com/flori/json/commit/373b633f38
2020-01-06 15:09:55 +09:00
Jeremy Evans beae6cbf0f Fully separate positional arguments and keyword arguments
This removes the warnings added in 2.7, and changes the behavior
so that a final positional hash is not treated as keywords or
vice-versa.

To handle the arg_setup_block splat case correctly with keyword
arguments, we need to check if we are taking a keyword hash.
That case didn't have a test, but it affects real-world code,
so add a test for it.

This removes rb_empty_keyword_given_p() and related code, as
that is not needed in Ruby 3.  The empty keyword case is the
same as the no keyword case in Ruby 3.

This changes rb_scan_args to implement keyword argument
separation for C functions when the : character is used.
For backwards compatibility, it returns a duped hash.
This is a bad idea for performance, but not duping the hash
breaks at least Enumerator::ArithmeticSequence#inspect.

Instead of having RB_PASS_CALLED_KEYWORDS be a number,
simplify the code by just making it be rb_keyword_given_p().
2020-01-02 18:40:45 -08:00
Nobuyoshi Nakada 179e402d8a
Updated dependencies on internal/warnings.h
Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`*
macros.
2019-12-31 11:14:19 +09:00
Nobuyoshi Nakada 3e2418e2a6
[ruby/io-console] bump up to 0.5.4 2019-12-30 17:38:28 +09:00
Hiroshi SHIBATA 2ef8d5beee
ext/openssl/ossl_ssl.c: nodoc for private methods
[Misc #11712][ruby-core:71565]
2019-12-29 21:09:15 +08:00
Nobuyoshi Nakada 31e2f03512 [ruby/io-console] Enable only interrupt bits on `intr: true`
https://github.com/ruby/io-console/commit/baaf929041
2019-12-29 16:26:22 +09:00
卜部昌平 0c2d731ef2 update dependencies 2019-12-26 20:45:12 +09:00
卜部昌平 5e22f873ed decouple internal.h headers
Saves comitters' daily life by avoid #include-ing everything from
internal.h to make each file do so instead.  This would significantly
speed up incremental builds.

We take the following inclusion order in this changeset:

1.  "ruby/config.h", where _GNU_SOURCE is defined (must be the very
    first thing among everything).
2.  RUBY_EXTCONF_H if any.
3.  Standard C headers, sorted alphabetically.
4.  Other system headers, maybe guarded by #ifdef
5.  Everything else, sorted alphabetically.

Exceptions are those win32-related headers, which tend not be self-
containing (headers have inclusion order dependencies).
2019-12-26 20:45:12 +09:00
Kenta Murata 27453b04c8
Update the version of bigdecimal to 2.0.0 (#2784) 2019-12-25 15:21:50 +09:00
aycabta 999a2819a7 [ruby/readline-ext] Version 0.1.0
https://github.com/ruby/readline-ext/commit/f5abaf5be1
2019-12-25 10:53:44 +09:00
Nobuyoshi Nakada 58527a7926
[ruby/io-console] bump up to 0.5.3 2019-12-22 13:52:59 +09:00
Nobuyoshi Nakada 77e3078ede [ruby/io-console] Set raw mode strictly same as cfmakeraw
* Default VMIN and VTIME to minimum input.
* Disable parity check bits explicitly.
* Disable all bits for flow control on input.

Co-Authored-By: NARUSE, Yui <naruse@airemix.jp>

https://github.com/ruby/io-console/commit/5ce201a686
2019-12-18 10:33:05 +09:00
Masataka Pocke Kuwabara 8f52604b47 Remove unnecessary double bangs from Pathname#root? 2019-12-17 14:14:54 +09:00
Nobuyoshi Nakada e36319249b
[ruby/io-console] bump up to 0.5.2 2019-12-17 13:57:58 +09:00
Yusuke Endoh b39d5da974
[ruby/io-console] Use TCSANOW to prevent from discarding the input buffer
TCSAFLUSH discards the buffer read before the mode change, which makes
IRB ignore the buffer input immediately after invoked.  TCSANOW
preserves the buffer.

https://github.com/ruby/io-console/commit/b362920182
2019-12-17 13:55:05 +09:00
Nobuyoshi Nakada 81eb2d16ef
[ruby/io-console] Disable implementation-defined special control characters
In raw mode with interrupt enabled.

https://github.com/ruby/io-console/commit/e9e8e3ff17
2019-12-17 13:55:04 +09:00
Nobuyoshi Nakada a9d17af242
[ruby/io-console] Removed dead code
https://github.com/ruby/io-console/commit/a49462ed97
2019-12-17 13:55:04 +09:00
Hiroshi SHIBATA 53e8589c69
Import json-2.3.0 from flori/json 2019-12-12 09:14:09 +09:00
Nobuyoshi Nakada 8e49ef5a69
[ruby/io-console] update depend for f9c0fe77c0 2019-12-10 23:13:40 +09:00
Nobuyoshi Nakada 58e5ab78d0
[ruby/io-console] bump up to 0.5.1 2019-12-10 16:06:12 +09:00
Nobuyoshi Nakada 2419b3dba6
[ruby/io-console] Suppress an unused-variable warning
https://github.com/ruby/io-console/commit/ae5c72e481
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada f9c0fe77c0
[ruby/io-console] Use rb_thread_call_without_gvl instead of the deprecated function
https://github.com/ruby/io-console/commit/21338ab287
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada 09723b98f7
[ruby/io-console] Warn vtime option without intr flag
https://github.com/ruby/io-console/commit/499ff3de48
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada 0c2787b9b2
[ruby/io-console] bump up to 0.5.0 2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada c3abbc1b2f
ext/openssl/extconf.rb: check with -Werror=deprecated-declarations
This reverts commit 0d7d8b2989,
but restore `$warnflags` without the flag, to get rid of using
deprecated functions.
2019-12-05 18:23:01 +09:00
Nobuyoshi Nakada 75b644350a
ext/psych/extconf.rb: braced VPATH is for nmake only 2019-12-05 17:57:56 +09:00
Yusuke Endoh 0d7d8b2989 ext/openssl/extconf.rb: do not use -Werror=deprecated-declarations
It fails to build on Solaris:

```
ossl_cipher.c: 関数 ‘ossl_cipher_init’ 内:
ossl_cipher.c:228:2: エラー: ‘EVP_md5’ is deprecated [-Werror=deprecated-declarations]
  228 |  EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv,
      |  ^~~~~~~~~~~~~~
In file included from /usr/include/openssl/x509.h:73,
                 from /usr/include/openssl/x509v3.h:63,
                 from ossl.h:23,
                 from ossl_cipher.c:10:
/usr/include/openssl/evp.h:732:26: 備考: ここで宣言されています
  732 | DEPRECATED const EVP_MD *EVP_md5(void);
      |                          ^~~~~~~
```

I agree that `-Werror=` is a good habit, but adding it by default is too
aggressive.
2019-12-05 14:45:45 +09:00
Koichi Sasada c6e3db0c66 new_cond before mon_initialize
MonitorMixin#new_cond can be called before mon_initialize, so we
need to initialize `@monitor` before it.

https://bugs.ruby-lang.org/issues/16255#note-4
2019-12-04 13:36:41 +09:00
Nobuyoshi Nakada 5a404efd29 [ruby/io-console] Fixed `intr: false` mode on Windows
https://github.com/ruby/io-console/commit/4c172c01aa
2019-12-04 10:10:45 +09:00
Hiroshi SHIBATA b94d06096b [ruby/zlib] Bump version to 1.1.0
https://github.com/ruby/zlib/commit/5af77c1ee8
2019-11-30 18:21:52 +09:00
Hiroshi SHIBATA 7ebcee6b76 [ruby/gdbm] Bump version to 2.1.0
https://github.com/ruby/gdbm/commit/ffb2b063a3
2019-11-30 18:14:38 +09:00
Hiroshi SHIBATA 56567c7648 [ruby/etc] Bump version to 1.1.0
https://github.com/ruby/etc/commit/78987ce56a
2019-11-30 18:11:01 +09:00
Hiroshi SHIBATA 06b9b78e21 [ruby/dbm] Bump version to 1.1.0
https://github.com/ruby/dbm/commit/163078359d
2019-11-30 18:01:54 +09:00
Hiroshi SHIBATA cf14592872 [ruby/readline-ext] Prepare to gem release
https://github.com/ruby/readline-ext/commit/e5b969215a
2019-11-30 16:29:16 +09:00
Hiroshi SHIBATA af4b3f16ce [ruby/stringio] Bump version to 0.1.0
https://github.com/ruby/stringio/commit/4c1e267e1a
2019-11-30 15:39:56 +09:00
Hiroshi SHIBATA 990025cf60
[ruby/stringio] RbConfig::LIMITS only provide after Ruby 2.5
https://github.com/ruby/stringio/commit/1fed3aacd3
2019-11-30 15:38:21 +09:00
Hiroshi SHIBATA e764dff364 [ruby/date] Bump version to 3.0.0
https://github.com/ruby/date/commit/202b2dad93
2019-11-30 14:48:44 +09:00
Koichi Sasada 36da0b3da1 check interrupts at each frame pop timing.
Asynchronous events such as signal trap, finalization timing,
thread switching and so on are managed by "interrupt_flag".
Ruby's threads check this flag periodically and if a thread
does not check this flag, above events doesn't happen.

This checking is CHECK_INTS() (related) macro and it is placed
at some places (laeve instruction and so on). However, at the end
of C methods, C blocks (IMEMO_IFUNC) etc there are no checking
and it can introduce uninterruptible thread.

To modify this situation, we decide to place CHECK_INTS() at
vm_pop_frame(). It increases interrupt checking points.
[Bug #16366]

This patch can introduce unexpected events...
2019-11-29 17:47:02 +09:00
Nobuyoshi Nakada a593186a02
Nmake needs `VPATH` 2019-11-29 11:09:08 +09:00
Nobuyoshi Nakada 98006cea4f
Add dependency on bundled yaml.h when using 2019-11-29 10:16:33 +09:00
y-yagi 18953416de Fix documentation of `MonitorMixin#new_cond` [ci skip] (#2707)
Since https://github.com/ruby/ruby/pull/2576,
`new_cond` uses the Monitor object, not the receiver.
2019-11-27 20:24:01 -08:00
Nobuyoshi Nakada 265b5382b2
Allow `$10` and more in the Ripper DSL 2019-11-26 21:57:00 +09:00
Vít Ondruch 994435d0ef Revert "Update dependencies"
This reverts commit e1b2341488.

This allows to build Psych against system libyaml again on Fedora.

[Bug #16359]
2019-11-22 22:42:33 +09:00
Nobuyoshi Nakada a93d0a4e62
Check -1 arity for C++ 2019-11-22 18:42:49 +09:00
Nobuyoshi Nakada f90b22e3dc
Revert the line for nextafter.c for FreeBSD make 2019-11-20 15:37:05 +09:00
Nobuyoshi Nakada c53aec73dd
Configure static extensions only if in charge
Get rid of races in parallel configuration when using the
ext/Setup file.
2019-11-19 15:11:41 +09:00
Nobuyoshi Nakada e1b2341488
Update dependencies 2019-11-18 23:16:22 +09:00
Jeremy Evans d03da13b17 [ruby/strscan] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
2019-11-18 01:00:25 +02:00
Jeremy Evans afbd8f384a [ruby/openssl] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
2019-11-18 01:00:25 +02:00
Jeremy Evans 17e8a6eff4 [ruby/io-console] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
2019-11-18 01:00:25 +02:00
Jeremy Evans 398cd3cc7d [ruby/etc] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

Still untaint the tmpdir object on Ruby <2.7, as returning
a tainted string there could cause problems.
2019-11-18 01:00:25 +02:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
Yuichiro Kaneko ae33f93836 Update comment of Ripper.lex
This is follow up of 1f7cb4bee9.
2019-11-13 09:50:58 +09:00
Nobuyoshi Nakada fb6a489af2
Revert "Method reference operator"
This reverts commit 67c5747369.
[Feature #16275]
2019-11-12 17:24:48 +09:00
Jeremy Evans b38b26c62d
[ruby/bigdecimal] Remove taint checking
This removes the taint checking.  Taint support is deprecated in
Ruby 2.7 and has no effect.  I don't think removing the taint
checks in earlier ruby versions will cause any problems.

https://github.com/ruby/bigdecimal/commit/1918d466f3
2019-11-12 11:16:07 +09:00
Aaron Patterson db33ab470c
[ruby/psych] Add a note about safe_load
https://github.com/ruby/psych/commit/0910ae5575
2019-11-12 10:43:54 +09:00
Jeremy Evans 30fdee65d9
[ruby/psych] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

I'm not sure if the untaint calls in deduplicate are still needed
after the removal of tainting in the parser.  If they are not
needed, they should be removed.

https://github.com/ruby/psych/commit/73c1a2b4e0
2019-11-12 10:35:47 +09:00
Jean Boussier 5ef41c91f0 [ruby/psych] Set required_ruby_version to 2.4.0
https://github.com/ruby/psych/commit/4f1746a3c6
2019-11-12 10:30:45 +09:00
Koichi Sasada fd6445b7e8 Monitor#exit: check monitor ownership.
Monitor#exit should be called by only onwer Thread. However, there
is not check for it.
2019-11-12 10:07:45 +09:00
Nobuyoshi Nakada 65f7e3156f
Removed duplicate file
"./tests/test_helper.rb" and "tests/test_helper.rb" in `s.files`
are same.
2019-11-11 15:57:21 +09:00
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00
Hiroshi SHIBATA 3d731c3694
Promote readline to default gems named readline-ext 2019-11-09 07:32:34 +09:00
Nobuyoshi Nakada d62abc47c8
Suppress unused variable warning 2019-11-07 23:33:45 +09:00
Nobuyoshi Nakada 929a4aa722
Adjust a fucntion signature 2019-11-05 02:05:46 +09:00
Justin McNally 10c2a08548 Clean up implementation of SOCKSSocket, its confusing and undocumented 2019-11-01 18:40:24 +09:00
Justin McNally 68e0bfcd4a Prefer libsocksd over libsocks 2019-11-01 18:39:59 +09:00
Justin McNally b800410387 Support libsocksd socks library for SOCKSSocket 2019-11-01 18:39:59 +09:00
Nobuyoshi Nakada 6abf4c4802 [ruby/date] Added update-zonetab target
https://github.com/ruby/date/commit/9bc6e30a82
2019-11-01 17:30:17 +09:00
Jeremy Evans 469545307f [ruby/date] Add more timezone abbreviations
This gets the time zone abbreviations from
https://www.timeanddate.com/time/zones/, and adds unambiguous time
zones not already present in zonetab.list.  See bin/update-abbr
for the program used.

This regenerates zonetab.h using prereq.mk (requires gperf).

Only one test line is added, just to make sure a new time zone
abbreviation is picked up.

Fixes Ruby Bug 16286

https://github.com/ruby/date/commit/702e8b3033
2019-11-01 17:30:14 +09:00
Nobuyoshi Nakada 63f70eb651 [ruby/zlib] Removed no longer used variables
https://github.com/ruby/zlib/commit/3e98e4cac3
2019-10-31 22:24:00 +09:00
Alan Wu 0aaa15f636 [ruby/zlib] Fix setting mtime to zero in GzipWriter
Before this change, it was not possible to write out zero for the
timestamp part of a Gzip file's header, as calling GzipWriter#mtime with
zero was ignored.

Judging from the docs for `GzipWriter#mtime=`, it should be possible to
indicate that no timestamp is available by calling the method with zero.

https://github.com/ruby/zlib/commit/310be39cac
2019-10-31 22:23:58 +09:00
Jeremy Evans ebc884461b
[ruby/stringio] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

https://github.com/ruby/stringio/commit/60ee9ccd95
2019-10-31 16:24:02 +09:00
Jeremy Evans 3895e548bd [ruby/date] Revert "Simplify #inspect"
This reverts commit af01edd7d8575f544f647dbe8cde5b6ae535d459.

Revert requested by Yui Naruse.

https://github.com/ruby/date/commit/875d563557
2019-10-31 15:51:30 +09:00
glaszig fce940aac7 [ruby/date] introduce Date::Error, raise Date::Error for every
"invalid <anything>" type of exception

https://github.com/ruby/date/commit/3e55c09ba4
2019-10-31 15:51:25 +09:00
Hiroshi SHIBATA 39281d5774
[ruby/gdbm] Use Gemfile instead of Gem::Specification#add_development_dependency.
https://github.com/ruby/gdbm/commit/bd2e7f6647
2019-10-31 15:34:01 +09:00
Jeremy Evans b93ab7d693
[ruby/gdbm] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

https://github.com/ruby/gdbm/commit/f9aaa1a08d
2019-10-31 15:34:01 +09:00
Jeremy Evans 290903dba0
[ruby/zlib] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

https://github.com/ruby/zlib/commit/21711ed0ce
2019-10-31 15:34:01 +09:00
Hiroshi SHIBATA 6c3ed0d71c
Update the latest versions from upstream repository of racc 2019-10-30 21:36:59 +09:00
zverok 2746fd5d50 Update StringIO docs:
* More explanations/examples in class docs;
* Fix links to other methods (remove <code> tag);
* Fix wording of method docs (remove *stringio*
  receiver name, as it is not rendered by modern
  RDoc);
* Add  option mention to linereading
  methods (added in 2.4);
* Several other small fixes.
2019-10-26 10:24:20 -07:00
Jeremy Evans 0c579b0a97 [ruby/dbm] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.

https://github.com/ruby/dbm/commit/1f0ff0bce1
2019-10-26 07:03:33 +09:00
Jeremy Evans 5fe8943fda Fix typo causing Date.new(year, month) to fail
Add a test for this case.
2019-10-24 12:34:51 -07:00
Hiroshi SHIBATA efd641ffab Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"
This reverts commit ce6caade7c.
2019-10-24 20:58:32 +09:00
Jeremy Evans b809784817 [ruby/fiddle] Remove taint support (#21)
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
https://github.com/ruby/fiddle/commit/18d6fb6915
2019-10-24 19:34:49 +09:00
Vít Ondruch ce6caade7c [ruby/fiddle] Use ffi_closure_free by default. (#20)
* Use ffi_closure_free unconditionally.

The current conditionals reflect historic heritage of FFI. Usage of
ffi_closure_free should be better default nowadays, because libffi 3.0.5
fixing issues of ffi_closure_free should be widely available.

* RUBY_LIBFFI_MODVERSION is not used anymore.

Because `ffi_closure_free()` is not used unconditionally, there is no
other use for RUBY_LIBFFI_MODVERSION define, so drop its usage.

* Use more meaningful variable name.

`ver` variable used to be used to pupulate RUBY_LIBFFI_MODVERSION
define. Since the define was removed, the `libffi_dir` variable name
should better describe the remaining usage of the variable.

https://github.com/ruby/fiddle/commit/c49cc79eb8
2019-10-24 19:34:43 +09:00
Aaron Patterson 7733db665a [ruby/fiddle] Fiddle::Function must maintain a reference to the closure
If the first parameter to Fiddle::Function is a closure object (rather
than an interger), `rb_Integer` will cast it to an integer but not
maintain a reference to the closure.  Then if the closure gets GC'd, we
have a segv.  This commit keeps a reference to the original parameter to
initialize so that the object will not be GC'd.

Fixes: https://bugs.ruby-lang.org/issues/13286

https://github.com/ruby/fiddle/commit/0fc697bbc5
2019-10-24 19:34:15 +09:00
Hiroshi SHIBATA 487d96c6b1
[ruby/date] Use Gemfile instead of Gem::Specification#add_development_dependency.
https://github.com/ruby/date/commit/13c94362c2
2019-10-24 18:39:04 +09:00
zverok 9d3a4ab05b
[ruby/date] Update docs
https://github.com/ruby/date/commit/8c02586a98
2019-10-24 18:39:04 +09:00
zverok 913807bd6c
[ruby/date] Simplify #inspect
https://github.com/ruby/date/commit/af01edd7d8
2019-10-24 18:39:04 +09:00
Jeremy Evans 2e37c1960a
[ruby/date] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous versions.

https://github.com/ruby/date/commit/519470dc3b
2019-10-24 18:39:04 +09:00
Jeremy Evans fc0e8d00bc
[ruby/date] Support -Float::INFINITY...date ranges
Fixes Ruby Bug 12961

https://github.com/ruby/date/commit/7f533c2552
2019-10-24 18:39:04 +09:00
Jeremy Evans 4e40ca301c
[ruby/date] Check for numeric arguments in constructors
Previously, the type of these arguments were not checked, leading to
NoMethodErrors in some cases, and TypeErrors in other cases, but not
showing what field was having the problems.  This change makes it so
the field with the problem is included in the error message.

For the valid_*? methods, this changes them to return false if one
of the arguments that should be numeric is not.

Fixes Ruby Bug 11935
Fixes Ruby Misc 15298

https://github.com/ruby/date/commit/a2f4b665f8
2019-10-24 18:39:04 +09:00
Jeremy Evans 9eb798a3f1
[ruby/date] Make julian dates roundtrip through to_time.to_date
Previously, julian dates would not round trip through to_time.to_date,
because Time is always considered gregorian.  This converts the Date
instance from julian to gregorian before converting to Time, ensuring
that an equal date object will be returned if converting that Time
back to Date.

This does result in julian Date objects showing different day values
if converting to Time.

Fixes Ruby Bug 8428.

https://github.com/ruby/date/commit/d8df64555e
2019-10-24 18:39:04 +09:00
git 215e4b8721 * 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-21 11:50:44 +09:00
Nobuyoshi Nakada 44da5a1c87
Look up event ID offsets by token as index 2019-10-21 11:45:54 +09:00
Nobuyoshi Nakada ca7de0334d
Also BDOT2 and BDOT3 are operators 2019-10-20 20:45:56 +09:00
Koichi Sasada a236eaa762 Native MonitorMixin::ConditionVariable#wait
MonitorMixin::ConditionVariable#wait can be interrupted just after
Monitor#exit_for_cond. So implementation in C.
2019-10-20 15:45:30 +09:00
Koichi Sasada a0a3c70181 delegate synchronize method
Delegate MonitorMixin#synchronize body to Monitor#synchronize.
It makes guarantee interrupt safe (because Monitor#synchronize is
written in C). I thought Ruby implementation is also safe, but I
got stuck failure <http://ci.rvm.jp/results/trunk_test@P895/2327639>
so that I introduce this fix to guarantee interrupt safe.
2019-10-20 14:21:04 +09:00
Koichi Sasada caac5f777a
make monitor.so for performance. (#2576)
Recent monitor.rb has performance problem because of interrupt
handlers. 'Monitor#synchronize' is frequently used primitive
so the performance of this method is important.

This patch rewrite 'monitor.rb' with 'monitor.so' (C-extension)
and make it faster. See [Feature #16255] for details.

Monitor class objects are normal object which include MonitorMixin.
This patch introduce a Monitor class which is implemented on C
and MonitorMixin uses Monitor object as re-entrant (recursive)
Mutex. This technique improve performance because we don't need
to care atomicity and we don't need accesses to instance variables
any more on Monitor class.
2019-10-20 04:52:20 +09:00
Nobuyoshi Nakada 1d435bd51a
Extend Ripper DSL to set to pseudo variables other than `$$` 2019-10-19 17:19:27 +09:00
Aaron Patterson 1d564acedc
Remove unused constant.
This constant isn't used, so lets remove it.
2019-10-17 13:35:26 -07:00
Aaron Patterson 9026e12f93
Look up constant instead of caching in a global
The global can go bad if the compactor runs, so we need to look up the
constant instead of caching it in a global.
2019-10-17 13:30:09 -07:00
Sho Hashimoto 308bbb4e10
[flori/json] Add ascii_only option to JSON::Ext::Generator::State.new.
https://github.com/flori/json/commit/0e99a9aac5
2019-10-14 19:54:49 +09:00
Watson 98a9445db9
[flori/json] Add shortcut converting to String
In where to convert Hash key to String for json, this patch will add shortcut for String/Symbol in Hash key.

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    65.000  i/100ms
Calculating -------------------------------------
                json    659.576  (± 1.5%) i/s -      3.315k in   5.027127s
```

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    78.000  i/100ms
Calculating -------------------------------------
                json    789.781  (± 2.7%) i/s -      3.978k in   5.041043s
```

```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/38c0f6dbe4
2019-10-14 19:54:49 +09:00
Watson a2f9c38a71
[flori/json] Convert Hash object using rb_hash_foreach()
To convert Hash convert, this part was using following pseudo code

```
obj.keys.each do |key|
  value = obj[key]
  ...
end
```

and `rb_funcall()` was called for `obj.keys`.
It might be slightly heavy to call the Ruby method.
This patch will iterate to convert Hash object about key/value using `rb_hash_foreach()` Ruby API instead of `rb_funcall()`.

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    55.000  i/100ms
Calculating -------------------------------------
                json    558.501  (± 1.1%) i/s -      2.805k in   5.022986s
```

```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    65.000  i/100ms
Calculating -------------------------------------
                json    659.576  (± 1.5%) i/s -      3.315k in   5.027127s
```

```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/a73323dc5e
2019-10-14 19:54:49 +09:00
Nobuyoshi Nakada 2003755a2c
[flori/json] Fixed unexpected illegal/malformed utf-8 error
flori/json@c34d01ff6a does not
consider US-ASCII compatible but non-UTF-8 encodings, and causes
an error in RDoc tests.

https://github.com/flori/json/commit/4f471bf590
2019-10-14 19:54:48 +09:00
Watson d7fa7e2c86
[flori/json] Convert string encoding to UTF-8 only when needed
## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   129.000  i/100ms
Calculating -------------------------------------
                json      1.300k (± 2.3%) i/s -      6.579k in   5.064656s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   189.000  i/100ms
Calculating -------------------------------------
                json      1.964k (± 3.3%) i/s -      9.828k in   5.011237s
```

## Code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/c34d01ff6a
2019-10-14 19:54:48 +09:00
Watson 40724d7d10
[flori/json] Convert String encoding using `rb_str_encode()`
`rb_funcall` might be slightly heavy to call the Ruby method.
This patch will convert String encoding using `rb_str_encode()` instead of `rb_funcall()`.

## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    78.000  i/100ms
Calculating -------------------------------------
                json    789.781  (± 2.7%) i/s -      3.978k in   5.041043s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json   129.000  i/100ms
Calculating -------------------------------------
                json      1.300k (± 2.3%) i/s -      6.579k in   5.064656s
```

## Code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id" => i,
    :age => 42,
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/9ae6d2969c
2019-10-14 19:54:48 +09:00
Watson 641136c4af
[flori/json] Does not check whether illegal utf-8 if string has ascii only.
## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    25.000  i/100ms
Calculating -------------------------------------
                json    250.478  (± 4.8%) i/s -      1.250k in   5.002238s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    32.000  i/100ms
Calculating -------------------------------------
                json    360.652  (± 3.6%) i/s -      1.824k in   5.064511s
```

## Test code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    :string => "x" * 100,
    :utf8 => "あ" * 100
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/91a24ecac3
2019-10-14 19:54:48 +09:00
Sho Hashimoto d9e50fcbeb
[flori/json] Pass args all #to_json in json/add/*.
https://github.com/flori/json/commit/36a7ef6790
2019-10-14 19:54:48 +09:00
Florian Frank 7376d70cb0
[flori/json] Only attempt to resize strings not other objects
https://github.com/flori/json/commit/167ada8da7
2019-10-14 19:54:48 +09:00
Nobuyoshi Nakada 3e763883ea
Fixed overflow at onig_region_set
To get rid of a bug of `onig_region_set` which takes `int`s
instead of `OnigPosition`s, set elements of `beg` and `end`
members directly, for the time being.
2019-10-14 15:10:56 +09:00
Sutou Kouhei 95c420c4a6
Import StringScanner 1.0.3 (#2553) 2019-10-14 12:40:50 +09:00
Nobuyoshi Nakada f405564711
Suppress deprecation warnings of MD5 from Xcode 11.1 2019-10-12 18:47:06 +09:00
Nobuyoshi Nakada 710bc00379
Moved RB_METHOD_DEFINITION_DECL to intern.h
This macro is used here before defined in ruby.h.
2019-10-12 17:47:28 +09:00
Nobuyoshi Nakada 6333020fc9
atime may not updated unless strictatime is set on macOS Catalina
Cited from mount(8):

```
strictatime
        Always update the file access time when reading from a
        file. Without this option the filesystem may default to a
        less strict update mode, where some access time updates
        are skipped for performance reasons. This option could be
        ignored if it is not supported by the filesystem.
```
2019-10-12 14:58:55 +09:00
Yusuke Endoh f845e1bc99 ext/syslog/extconf.rb: add -llog for Android
Otherwise, requiring syslog results in:

    cannot locate symbol "__android_log_print" referenced by "syslog.so"
2019-10-10 23:21:24 +09:00
Nobuyoshi Nakada 9c0cd5c569
Prefer rb_gc_register_mark_object
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): prefer
  `rb_gc_register_mark_object`, which is better for constant
  objects, over `rb_gc_register_address` for global/static
  variables which can be re-assigned at runtime.  [Bug #16196]
2019-10-10 19:59:21 +09:00
Nobuyoshi Nakada 203b7fa1ae
Guard static variable first
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): register the static
  variable to grab an internal object, before creating the object.
  otherwise the just-created object could get collected during the
  global variable list allocation.  [Bug #16196]
2019-10-10 16:25:28 +09:00
Kenta Murata dd0c75fdc2
Import changes from ruby/bigdecimal (#2531)
Sync to ruby/bigdecimal@92356ba71c
2019-10-08 09:06:28 +09:00
Yusuke Endoh 06a04a1aa3 ext/openssl/ossl_ssl.c: Use const declaration if LibreSSL >= 2.8.0
to suppress a warning in OpenBSD.

```
ossl_ssl.c:938:31: warning: incompatible pointer types passing 'SSL_SESSION *(SSL *, unsigned char *, int, int *)' (aka 'struct ssl_session_st *(struct ssl_st *, unsigned char *, int, int *)') to parameter of type 'SSL_SESSION *(*)(struct ssl_st *, const unsigned char *, int, int *)' (aka 'struct ssl_session_st *(*)(struct ssl_st *, const unsigned char *, int, int *)') [-Wincompatible-pointer-types]
        SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb);
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/openssl/ssl.h:738:20: note: passing argument to parameter 'get_session_cb' here
    SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
                   ^
1 warning generated.
```
2019-10-05 19:08:23 +09:00
Yusuke Endoh 96452373fd ext/json/parser/prereq.mk: use `if $. == 1` instead of a hacky code 2019-10-05 18:28:19 +09:00
Yusuke Endoh 70e3fda2eb ext/json/parser/prereq.mk: keep line numbers of ext/json/parser/parser.c
Follow up of 5717e55e9a.
Adding a header with newline broke linenos.
2019-10-05 17:54:36 +09:00
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
卜部昌平 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
Yusuke Endoh a38fe1fbf0 ext/-test-/enumerator_kw/enumerator_kw.c: remove unused variable 2019-10-01 08:57:50 +09:00
Jeremy Evans 3073404e74 Add rb_enumeratorize_with_size_kw and related macros
Currently, there is not a way to create a sized enumerator in C
with a different set of arguments than provided by Ruby, and
correctly handle keyword arguments.  This function allows that.

The need for this is fairly uncommon, but it occurs at least in
Enumerator.produce, which takes arugments from Ruby but calls
rb_enumeratorize_with_size with a different set of arguments.
2019-09-30 07:06:42 -07:00
Jeremy Evans 649a64ae29 Add three more C-API functions for handling keywords
This adds rb_funcall_passing_block_kw, rb_funcallv_public_kw,
and rb_yield_splat_kw.  This functions are necessary to easily
handle cases where rb_funcall_passing_block, rb_funcallv_public,
and rb_yield_splat are currently used and a keyword argument
separation warning is raised.
2019-09-29 18:31:08 -07:00
卜部昌平 dd883de5ba refactor constify most of rb_method_entry_t
Now that we have eliminated most destructive operations over the
rb_method_entry_t / rb_callable_method_entry_t, let's make them
mostly immutabe and mark them const.

One exception is rb_export_method(), which destructively modifies
visibilities of method entries.  I have left that operation as is
because I suspect that destructiveness is the nature of that
function.
2019-09-30 10:26:38 +09:00
Nobuyoshi Nakada f6f03dcad6 [ruby/stringio] Bump up the version
https://github.com/ruby/stringio/commit/f0e5027279
2019-09-29 18:55:34 +09:00
Nobuyoshi Nakada 7fe253f47f [ruby/stringio] Use rb_funcallv_kw when delegating arguments
https://github.com/ruby/stringio/commit/5892663e32
2019-09-29 18:55:32 +09:00
Nobuyoshi Nakada 68ab4a5e35 [ruby/stringio] Replaced rb_funcall2 with rb_funcallv
https://github.com/ruby/stringio/commit/a37ab7c419
2019-09-29 18:55:30 +09:00
Nobuyoshi Nakada ef795f9abd [ruby/stringio] Dropped older ruby versions
https://github.com/ruby/stringio/commit/e8065153b8
2019-09-29 18:55:28 +09:00
Nobuyoshi Nakada 7f30783af7 [ruby/stringio] Get rid of String#undump for ruby 2.4 or earlier
https://github.com/ruby/stringio/commit/4dfd997e0a
2019-09-29 18:55:26 +09:00
Nobuyoshi Nakada 94db8cda9b [ruby/zlib] Fix for older ruby 2.6 or earlier
https://github.com/ruby/zlib/commit/00ead8cb2c
2019-09-29 18:53:11 +09:00
Nobuyoshi Nakada f10c9cb1f2 [ruby/zlib] Search zlib.c as a gem
https://github.com/ruby/zlib/commit/8f43b264cd
2019-09-29 18:47:59 +09:00
Jeremy Evans 660c7e050f Fix more keyword separation issues
This fixes instance_exec and similar methods. It also fixes
Enumerator::Yielder#yield, rb_yield_block, and a couple of cases
with Proc#{<<,>>}.

This support requires the addition of rb_yield_values_kw, similar to
rb_yield_values2, for passing the keyword flag.

Unlike earlier attempts at this, this does not modify the rb_block_call_func
type or add a separate function type.  The functions of type
rb_block_call_func are called by Ruby with a separate VM frame, and we can
get the keyword flag information from the VM frame flags, so it doesn't need
to be passed as a function argument.

These changes require the following VM functions accept a keyword flag:

* vm_yield_with_cref
* vm_yield
* vm_yield_with_block
2019-09-26 19:24:58 -07:00
George Claghorn 31339ef4f2 Honor Syslog::Logger#level overrides 2019-09-26 15:01:44 -07:00
Jeremy Evans 47d44510a3 Fix more keyword argument separation issues in Pathname 2019-09-26 08:01:53 -07:00
Jeremy Evans 3959469f24 Fix keyword argument separation issues in OpenSSL::SSL::SSLSocket#sys{read,write}_nonblock
It's unlikely anyone would actually hit these.  The methods are
private, you only hit this code path if calling these methods
before performing the SSL connection, and there is already a
verbose warning issued.
2019-09-26 08:01:53 -07:00
Nobuyoshi Nakada 5357ceb1ca
[ruby/io-console] Defer creating VT query string
https://github.com/ruby/io-console/commit/3d69c577a4
2019-09-26 09:59:27 +09:00
Nobuyoshi Nakada 9b10698705
[ruby/io-console] Added IO#console_mode
https://github.com/ruby/io-console/commit/77ed8d5a06
2019-09-26 09:59:27 +09:00
Jeremy Evans 80b5a0ff2a
Make rb_scan_args handle keywords more similar to Ruby methods (#2460)
Cfuncs that use rb_scan_args with the : entry suffer similar keyword
argument separation issues that Ruby methods suffer if the cfuncs
accept optional or variable arguments.

This makes the following changes to : handling.

* Treats as **kw, prompting keyword argument separation warnings
  if called with a positional hash.

* Do not look for an option hash if empty keywords are provided.
  For backwards compatibility, treat an empty keyword splat as a empty
  mandatory positional hash argument, but emit a a warning, as this
  behavior will be removed in Ruby 3.  The argument number check
  needs to be moved lower so it can correctly handle an empty
  positional argument being added.

* If the last argument is nil and it is necessary to treat it as an option
  hash in order to make sure all arguments are processed, continue to
  treat the last argument as the option hash. Emit a warning in this case,
  as this behavior will be removed in Ruby 3.

* If splitting the keyword hash into two hashes, issue a warning, as we
  will not be splitting hashes in Ruby 3.

* If the keyword argument is required to fill a mandatory positional
  argument, continue to do so, but emit a warning as this behavior will
  be going away in Ruby 3.

* If keyword arguments are provided and the last argument is not a hash,
  that indicates something wrong. This can happen if a cfunc is calling
  rb_scan_args multiple times, and providing arguments that were not
  passed to it from Ruby.  Callers need to switch to the new
  rb_scan_args_kw function, which allows passing of whether keywords
  were provided.

This commit fixes all warnings caused by the changes above.

It switches some function calls to *_kw versions with appropriate
kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS
is used.  If creating new arguments, RB_PASS_KEYWORDS is used if
the last argument is a hash to be treated as keywords.

In open_key_args in io.c, use rb_scan_args_kw.
In this case, the arguments provided come from another C
function, not Ruby.  The last argument may or may not be a hash,
so we can't set keyword argument mode.  However, if it is a
hash, we don't want to warn when treating it as keywords.

In Ruby files, make sure to appropriately use keyword splats
or literal keywords when calling Cfuncs that now issue keyword
argument separation warnings through rb_scan_args.  Also, make
sure not to pass nil in place of an option hash.

Work around Kernel#warn warnings due to problems in the Rubygems
override of the method.  There is an open pull request to fix
these issues in Rubygems, but part of the Rubygems tests for
their override fail on ruby-head due to rb_scan_args not
recognizing empty keyword splats, which this commit fixes.

Implementation wise, adding rb_scan_args_kw is kind of a pain,
because rb_scan_args takes a variable number of arguments.
In order to not duplicate all the code, the function internals need
to be split into two functions taking a va_list, and to avoid passing
in a ton of arguments, a single struct argument is used to handle
the variables previously local to the function.
2019-09-25 11:18:49 -07:00