summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2018-07-06Prefixed reset_leap_second_infonobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05Make a prototypenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05ruby tool/update-deps --fixnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05Add missing prototypenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05Add missing filenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05unrevert r63852 but keep SIGCHLD path disabled for win32normal
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...) on that platform will never conflict with mjit use of waitpid. In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h so it can be easy for Linux/BSD users to test (hopefully!) win32-compatible code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-04Revert r63758 and related commitsnaruse
The change is unstable on Windows. Please re-commit it when it correctly supports Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27hijack SIGCHLD handler for internal usenormal
Use a global SIGCHLD handler to guard all callers of rb_waitpid. To work safely with multi-threaded programs, we introduce a VM-wide waitpid_lock to be acquired BEFORE fork/vfork spawns the process. This is to be combined with the new ruby_waitpid_locked function used by mjit.c in a non-Ruby thread. Ruby-level SIGCHLD handlers registered with Signal.trap(:CHLD) continues to work as before and there should be no regressions in any existing use cases. Splitting the wait queues for PID > 0 and groups (PID <= 0) ensures we favor PID > 0 callers. The disabling of SIGCHLD in rb_f_system is longer necessary, as we use deferred signal handling and no longer make ANY blocking waitpid syscalls in other threads which could "beat" the waitpid call made by rb_f_system. We prevent SIGCHLD from firing in normal Ruby Threads and only enable it in the timer-thread, to prevent spurious wakeups from in test/-ext-/gvl/test_last_thread.rb with MJIT enabled. I've tried to guard as much of the code for RUBY_SIGCHLD==0 using C "if" statements rather than CPP "#if" so to reduce the likelyhood of portability problems as the compiler will see more code. We also work to suppress false-positives from Process.wait(-1, Process::WNOHANG) to quiets warnings from spec/ruby/core/process/wait2_spec.rb with MJIT enabled. Lastly, we must implement rb_grantpt for ext/pty. We need a MJIT-compatible way of supporting grantpt(3) which may spawn the `pt_chown' binary and call waitpid(2) on it. [ruby-core:87605] [Ruby trunk Bug#14867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-25comma at the end of enum is a C99ismshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-24UNIXSocket#recv_io: trigger GC when out of FDsnormal
Make this behavior is consistent with our other FD-allocating methods. EMFILE and ENFILE are not documented nor can I trigger them when using UNIXSocket#recv_io. However, ENOMEM is documented, and I've triggered EMSGSIZE on FreeBSD and truncated messages when an EMFILE condition is hit on my system. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-17openssl_missing.h: constifiednobu
* ext/openssl/openssl_missing.h (IMPL_KEY_ACCESSOR{2,3}): constified obj argument getters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-15Remove flip-flop usages from build scriptsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31Define AST module under RubyVM [experimental]yui-knk
* ext/-test-/ast/ast.c: Rename to ast.c and define AST module under RubyVM. * common.mk: compile ast.c. * ext/-test-/ast/extconf.rb: Don't need this file anymore. * inits.c (rb_call_inits): Call Init_ast to setup AST module. * test/-ext-/ast/test_ast.rb: Follow up the namespace change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31ast.c: Do not taint TOPLEVEL_BINDINGyui-knk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-30Workaround for old LibreSSLnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-28Merge etc gemspec from github repository.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-23ext/pty/pty.c: I_FIND before I_PUSH if possiblengoto
* ext/pty/pty.c: Check whether each STREAMS module is already pushed or not by using I_FIND ioctl call, before pushing it by using I_PUSH. Solved test failure on Solaris. On a Solaris 10 machine, ioctl I_PUSH "ldterm" twice was the cause of duplicated "\r". [Bug #14786] [ruby-dev:50552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-15-test-/wait_for_single_fd: fix -Wformat-security warningnormal
Oops git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-14test_wait_for_single_fd: ensure this works with kqueuenormal
Regardless of future features, this needs to work with kqueue descriptors across platforms. Today this will be useful for 3rd-party libraries using kqueue. In the future, Ruby may use kqueue natively and we shall ensure we can wait on it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12openssl: merge changes in v2.1.1rhe
Commits in upstream repository since v2.1.0 can be found at: https://github.com/ruby/openssl/compare/v2.1.0...v2.1.1 ---------------------------------------------------------------- Kazuki Yamaguchi (7): test/utils: disable Thread's report_on_exception in start_server cipher: validate iterations argument for Cipher#pkcs5_keyivgen extconf.rb: fix build with LibreSSL 2.7.0 test/test_pkey_rsa: fix test failure with OpenSSL 1.1.1 test/test_ssl_session: set client protocol version explicitly Ruby/OpenSSL 2.0.8 Ruby/OpenSSL 2.1.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-09Rename imemo_alloc with imemo_tmpbufmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-03Revert "ext/cgi/escape: preserve String subclass in result"normal
This reverts commit 6afea14043b0c0e603f26c89ae0d043f65852668 r63328 I misread the original bug report and got results flipped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-02ext/cgi/escape: preserve String subclass in resultnormal
* ext/cgi/escape/escape.c (optimized_escape_html): use rb_str_new_with_class (optimized_unescape_html): ditto (optimized_escape): ditto (optimized_unescape): ditto * test/cgi/test_cgi_util.rb (test_escape_string_subclass): new test [ruby-core:86847] [Bug #14732] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-01ast.c: use enum in switch for warningsnobu
* ext/-test-/ast/ast.c (node_children): use enum instead of int for not-handled enumeration value in switch warnings. * ext/-test-/ast/ast.c (node_children): fix the rb_bug message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-30io.c: workaround for EPROTOTYPEnobu
* io.c (internal_write_func, internal_writev_func): retry at unexpected EPROTOTYPE on macOS, to get rid of a kernel bug. [ruby-core:86690] [Bug #14713] * ext/socket/init.c (rsock_{sendto,send,write}_blocking): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28Merge Pysch 3.0.3.pre1.hsbt
I added the following additional commits from 3.0.3.pre1: * https://github.com/ruby/psych/pull/356 * https://github.com/ruby/psych/pull/357 * https://github.com/ruby/psych/pull/359 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19fiddle/import.rb: suppress warningnobu
* 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-02Win32API.rb: use uplevel option to warnnobu
Also warns always regardless $VERBOSE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28unixsocket.c: abstract namespacenobu
* ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for Linux abstract namespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28unixsocket.c: check NUL bytesnobu
* 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-26bigdecimal.c: fix missing argumentnobu
* ext/bigdecimal/bigdecimal.c (rb_rational_num, rb_rational_den): fix missing argc argument for old ruby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-25extmk.rb: get rid of shadowing outer local variablenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-20node.c: predicates for special NODEsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13Fix FrozenError on `Ripper.slice`k0kubun
Currently `Ripper.slice` raises a FrozenError ```ruby require 'ripper' p Ripper.slice('foo', 'ident') ``` ``` /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `concat': can't modify frozen String (FrozenError) from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:193:in `block in compile' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `scan' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:190:in `compile' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:169:in `initialize' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `new' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:151:in `token_match' from /path/to/g/lib/ruby/2.6.0/ripper/lexer.rb:144:in `slice' from /tmp/tmp.kb4cnhvum2/test.rb:2:in `<main>' ``` This patch will fix the problem. [Fix GH-1837] From: Masataka Pocke Kuwabara <kuwabara@pocke.me> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13Improve Pathname performancewatson1978
If it will not use special variables (like $1, $&, $`...), it can improve the performance by using Regexp#match? instead of Regexp#=~. Because Regexp#=~ will generate the objects to special variables by pattern matching. This patch will replace Regexp#=~ without special variables to Regexp#match?. (Excludes https://github.com/ruby/ruby/blob/trunk/ext/pathname/lib/pathname.rb#L144-L153) [Fix GH-1836] [ruby-core:86093] [Bug #14599] ## Environment * OS : Ubuntu 17.10 * Compiler : gcc version 7.2.0 * CPU : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz * Memory : 16 GB ## TL;DR   | Before | After | Speed up --------------------------- | ------ | ------ | -------- Pathname#absolute? | 142836 | 198487 | 39.0% Pathname#cleanpath | 60706 | 79415 | 30.8% Pathname#root? | 603806 | 759157 | 25.7% Pathname#absolute? | 142592 | 197859 | 38.8% Pathname#each_filename | 115600 | 152982 | 32.3% Pathname#ascend | 50494 | 63606 | 26.0% Pathname#+ | 100550 | 130372 | 29.7% Pathname#join | 46673 | 60994 | 30.7% Pathname#relative_path_from | 28362 | 37494 | 32.2% ## Before ``` Calculating ------------------------------------- Pathname#absolute? 142.836k (± 0.1%) i/s - 722.304k in 5.056884s Pathname#cleanpath 60.706k (± 0.1%) i/s - 306.764k in 5.053305s Pathname#root? 603.806k (± 0.3%) i/s - 3.062M in 5.071696s Pathname#absolute? 142.592k (± 0.1%) i/s - 720.846k in 5.055301s Pathname#each_filename 115.600k (± 0.1%) i/s - 586.818k in 5.076292s Pathname#ascend 50.494k (± 0.1%) i/s - 255.301k in 5.056049s Pathname#+ 100.550k (± 0.1%) i/s - 509.630k in 5.068433s Pathname#join 46.673k (± 0.1%) i/s - 236.433k in 5.065696s Pathname#relative_path_from 28.362k (± 0.0%) i/s - 143.728k in 5.067640s ``` ## After ``` Calculating ------------------------------------- Pathname#absolute? 198.487k (± 0.1%) i/s - 995.665k in 5.016272s Pathname#cleanpath 79.415k (± 0.1%) i/s - 404.406k in 5.092344s Pathname#root? 759.157k (± 0.0%) i/s - 3.800M in 5.005072s Pathname#absolute? 197.859k (± 0.1%) i/s - 995.720k in 5.032494s Pathname#each_filename 152.982k (± 0.1%) i/s - 775.555k in 5.069607s Pathname#ascend 63.606k (± 0.0%) i/s - 320.862k in 5.044560s Pathname#+ 130.372k (± 0.1%) i/s - 660.856k in 5.068991s Pathname#join 60.994k (± 0.1%) i/s - 305.068k in 5.001626s Pathname#relative_path_from 37.494k (± 0.4%) i/s - 189.124k in 5.044146s ``` ## Benchmark code ```ruby require 'pathname' require 'benchmark/ips' Benchmark.ips do |x| root = Pathname.new('/') path1 = Pathname.new('/path/to/some/file1.rb') path2 = Pathname.new('/path/to/some/file2.rb') x.report("Pathname#absolute?") do path1.absolute? end x.report("Pathname#cleanpath") do Pathname.new('/path/to/some/file.rb').cleanpath end x.report("Pathname#root?") do path1.root? end x.report("Pathname#absolute?") do path1.absolute? end x.report("Pathname#each_filename") do path1.each_filename { |file| } end x.report("Pathname#ascend") do path1.ascend { |path| } end x.report("Pathname#+") do path1 + path2 end x.report("Pathname#join") do path1.join("../file3.rb") end x.report("Pathname#relative_path_from") do path1.relative_path_from(root) end end ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-12ripper: fix escaped spacenobu
* parse.y: use tSP same as ripper instead of tSPACE. [ruby-core:86080] [Bug #14597] * ext/ripper/eventids2.c: tSP is defined in ripper.c now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-10ext/win32ole/win32ole.c: fix typo. [ci skip]suke
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-10* ext/win32ole/win32ole.c: fix url of ActiveState. Thanks to Kazuhiro ↵suke
Nishiyama. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-09Removed useless assertions [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-07date_core.c: check conversionnobu
* ext/date/date_core.c (offset_to_sec, d_lite_plus): check conversion results, to get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02openssl: search winsocknobu
* ext/openssl/extconf.rb: on Windows search winsock library always, regardless pkg-config. direct use of winsock is not region of OpenSSL. [ruby-core:85895] [Bug #14568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02io/console: drop 2.1.0 support [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02io/console: drop 2.0.0 support [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02search winsock libraries explicitlynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-27Refactor ERB version checking for keyword argumentsk0kubun
Improving code like r62590. See r62529 for details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-25date_parse.c, date_strptime.c: ensure symbols static allnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-25date_core.c: ensure symbols static allnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-25date_core.c: defensive codenobu
* ext/date/date_core.c (f_cmp): check comparison failure. * ext/date/date_core.c (d_lite_step): deal with the comparison result more defensively. [ruby-core:85796] [Bug #14549] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22erb.rb: deprecate safe_level of ERB.newk0kubun
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments (trim_mode, eoutvar) are changed to keyword arguments. Old ways to specify arguments are deprecated and warned now. bin/erb: deprecate -S option. We'll remove all of deprecated ones at Ruby 2.7+. enc/make_encmake.rb: stopped using deprecated interface ext/etc/mkconstants.rb: ditto ext/socket/mkconstants.rb: ditto sample/ripper/ruby2html.rb: ditto spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto spec/ruby/library/erb/new_spec.rb: ditto test/erb/test_erb.rb: ditto test/erb/test_erb_command.rb: ditto tool/generic_erb.rb: ditto tool/ruby_vm/helpers/dumper.rb: ditto tool/transcode-tblgen.rb: ditto lib/rdoc/erbio.rb: ditto lib/rdoc/generator/darkfish.rb: ditto [Feature #14256] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-18ext/fiddle/lib/fiddle/pack.rb: pack "void *" properly on 32-bitnormal
Fixes: r62450 (commit 1aaeeb326e754c5c5db83fbf35f780f729a9dfed) ("long long is a C99ism") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e