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

27904 Коммитов

Автор SHA1 Сообщение Дата
kosaki 99c05fb38e * random.c (Init_RandomSeed): move all Random::DEFAULT
construction bits to Init_RandomSeed2. Random::DEFAULT
  and Ruby internal hashes are no longer shared their seed.
* random.c (Init_RandomSeed2): ditto. And, kill evil
  rb_obj_reveal() stuff.
* random.c (init_hashseed): add MT argument.
* random.c: (init_siphash): ditto.
* test/ruby/test_rand.rb (TestRand#test_default_seed): new
  test for Random::DEFAULT::seed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:31:31 +00:00
kosaki 052535be3e * random.c (init_hashseed, init_siphash): extract initialize
functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:31:11 +00:00
kosaki 0c4e7767ed * configure.in: sort AC_CHECK_HEADERS() by alphabetical order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:30:50 +00:00
kosaki 12e059b18c * random.c (init_randomseed): remove "initial" argument. It never
be used from outside of this function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:29:37 +00:00
kosaki 7104a473ea * lib/securerandom.rb (SecureRandom::gen_random): use /dev/urandom
for initialize OpenSSL's rand.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:29:22 +00:00
kosaki 07083767e9 * ext/openssl/ossl_rand.c (ossl_rand_bytes): RAND_bytes could
be return -1 as an error. Therefore, added error handling.
* ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:29:02 +00:00
kosaki 86caaefc1f * include/ruby/util.h: remove a warning suppression C4723
(potential divide by zero) for VisualC++. It's meaningless.
  Before r26197, there is ruby_div0() in this place and it
  actually made divide by zero. But now it's just garbage.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:27:52 +00:00
kosaki f7bd7d6f1f * random.c: random_raw_seed don't use GRND_NONBLOCK. GRND_NONBLOCK
mean the result might not have an enough cryptic strength and
  easy predictable. That's no good for SecureRandom.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:27:11 +00:00
kosaki dea685c783 * missing/explicit_bzero.c: new file. define explicit_bzero.
* common.mk: add a rule for explicit.o.
* configure.in: detect explicit_bzero and memset_s.
* include/ruby/missing.h: add explicit_bzero.
* random.c (init_randomseed): use explicit_bzero() instead of
  memset(). memset could be eliminated by compiler optimization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 20:26:13 +00:00
kazu 4eeec4869f fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 13:25:34 +00:00
naruse 6db72c0166 * ext/readline/extconf.rb: call dir_config("libedit")
if --enable-libedit is spcified. [Bug #11751]
  patched by John Hein

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-30 09:48:24 +00:00
normal 9f9861699b variable.c: remove spurious #define for globals
Removing the indirection helps me with readability, at
least.  It doesn't seem like there are many other places
in the Ruby code where macros are used like this.

[ruby-core:71735] [Feature #11749]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-29 23:53:43 +00:00
nobu b71f6be026 Corrected grammar errors [ci skip]
* NEWS: [DOC] Various grammar corrections and clarifications to
  increase readability.  [Fix GH-1115]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-29 00:13:05 +00:00
nobu 448d1d147d parse.y: last content of heredoc
* parse.y (parser_here_document): store dispatched result of
  on_tstring_content at the last fragment of a here document.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-28 10:33:58 +00:00
naruse d249be6233 * lib/net/http.rb (connect): detect closed connection and reconnect
If the server closes a keep-alive http connection, the client socket
  reaches EOF. To avoid an EOFError, detect the closed connection and
  reconnect.
  Added test to ensure HTTP#post succeeds even if the
  keep-alive-connection has been closed by the server.
  by Kristian Hanekamp <kris.hanekamp@gmail.com>
  https://github.com/ruby/ruby/pull/1089 fix GH-1089

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-27 14:07:35 +00:00
nobu 778f32a153 compile.c: tailcall opt for indexers
* compile.c (iseq_peephole_optimize): enable tail call
  optimization for specialized indexers.
* compile.c (iseq_compile_each): blockiseq should be NULL, but not
  Qnil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 12:36:43 +00:00
naruse 9ed1d63f41 * regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692
  + https://github.com/k-takata/Onigmo/pull/52

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 08:31:27 +00:00
hsbt 676c80d203 * test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
[Misc #11732][ruby-dev:49379]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 00:51:03 +00:00
hsbt a4ac506551 * test/coverage/test_coverage.rb: Added test-case for Coverage.peek_result
without Coverage.start. [Misc #11726][ruby-core:71622]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-26 00:48:56 +00:00
normal 14920f93c9 test/openssl/test_ssl.rb (test_copy_stream): new test
I was worried r52750 would break IO.copy_stream with things like
OpenSSL sockets which wrap IOs, but require data to be run through
through encryption/decryption filters.  Apparently my worry
was unfounded, but perhaps this test will ensure this case continues
to work.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25 22:23:34 +00:00
nobu 7d92e5cf73 io.c: try to_io first
* io.c (copy_stream_body): try to_io conversion before read,
  readpartial, and write methods.  [ruby-dev:49008] [Bug #11199]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25 12:23:42 +00:00
shugo 94da8b1737 * io.c (argf_getpartial): should not resize str if the second
argument is not given.
  [ruby-core:71668] [Bug #11738]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-25 01:57:48 +00:00
ngoto 06c04b3874 * configure.in: On Solaris, it is safe to define _LARGEFILE_SOURCE
when _FILE_OFFSET_BITS=64 is defined (= when 32-bit compile).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 15:00:57 +00:00
kazu 17f2a12f1f fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 13:12:30 +00:00
hsbt ba516bc317 * lib/rubygems/installer.rb: Fix two double-word typos.
[ci skip][fix GH-1108] Patch by @jwworth

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 01:00:15 +00:00
nobu 13a935b0ba Drop support for BeOS
* beos: Drop support for BeOS now that Haiku is stable.
  [Fix GH-1112]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 00:17:11 +00:00
nobu f7847ecb72 internal.h: export rb_gc_for_fd
* internal.h (rb_gc_for_fd): move to export, as referred by
  ext/socket.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 00:16:37 +00:00
nobu e99cc601e0 Add missing punctuation to File docs [ci skip]
* file.c: [DOC] add a missing period to File docs, to terminate
  the sentence and separate from the next sentence.  [Fix GH-1111]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-24 00:04:36 +00:00
nobu abd52f7d69 Fix Struct#dig issue number [ci skip]
* NEWS: Fix the issue number of `Struct#dig`, which should be
  [Feature #11688].  [Fix GH-1110]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 23:30:09 +00:00
normal d51743afc8 ext/socket/init.c (rsock_accept): handle ENOMEM
accept(2) documents ENOMEM as a possible error, handle it
consistent with all of our other FD-allocating wrappers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 22:57:29 +00:00
normal 61e5fe0674 use rb_gc_for_fd for more callers
* dir.c (dir_initialize): use rb_gc_for_fd for ENOMEM
* ext/socket/init.c (rsock_socket): ditto
* ext/socket/socket.c (rsock_socketpair): ditto
* internal.h (rb_gc_for_fd): prototype
* io.c (rb_gc_for_fd): remove static
  [ruby-core:71623] [Feature #11727]

Manpages for opendir(2), socket(2), and socketpair(3posix)
describe ENOMEM as a possible error for each of these;
handle it consistently with our existing wrappers for
open(2)/pipe(2) etc...

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 22:50:53 +00:00
normal a936bd5c63 io.c (rb_gc_for_fd): wrapper for retrying FD creation
This simplifies callers and makes error handling more consistent
between our pipe, open, fdopen, and dup wrappers.

This adds missing ENOMEM handling as documented in the open(2),
pipe(2freebsd), and fdopen(3posix) manpages on my system.

We also avoid repeatedly accessing `errno` which is implemented
in TLS on GNU/Linux systems and more expensive to read than a
local variable.

We may export this in internal.h for ext/socket/* and dir.c, too.

* io.c (rb_gc_for_fd): new helper function
  (ruby_dup): use rb_gc_for_fd
  (rb_sysopen): ditto
  (rb_fdopen): ditto
  (rb_pipe): ditto
  [ruby-core:71623] [Feature #11727]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 21:57:24 +00:00
normal 15476c695d fiddle: release GVL for ffi_call
Some external functions I wish to call may take a long time
and unnecessarily block other threads.  This may lead to performance
regressions for fast functions as releasing/acquiring the GVL is not
cheap, but can improve performance for long-running functions
in multi-threaded applications.

This also means we must reacquire the GVL when calling Ruby-defined
callbacks for Fiddle::Closure, meaning we must detect whether the
current thread has the GVL by exporting ruby_thread_has_gvl_p
in internal.h

* ext/fiddle/function.c (struct nogvl_ffi_call_args):
  new struct for GVL release
  (nogvl_ffi_call): new function
  (function_call): adjust for GVL release
  [ruby-core:71642] [Feature #11607]
* ext/fiddle/closure.c (struct callback_args):
  new struct for GVL acquire
  (with_gvl_callback): adjusted original callback function
  (callback): wrapper for conditional GVL acquire
* ext/fiddle/depend: add dependencies
* ext/fiddle/extconf.rb: include top_srcdir for internal.h
* internal.h (ruby_thread_has_gvl_p): expose for fiddle
* vm_core.h (ruby_thread_has_gvl_p): moved to internal.h
* test/fiddle/test_function.rb (test_nogvl_poll): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 21:20:56 +00:00
ngoto 6965964df6 * configure.in: On Solaris, with gcc, "-std=iso9899:1999"
in $ansi_options is often also needed in CPPFLAGS,
  because some feature definitions vary depending on such
  standards options.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 10:59:57 +00:00
nobu e29c109d2a Haiku now best effort support
* configure.in: remove obsolete workarounds for Haiku.
* dln.c, file.c, io.c: remove obsolete Haiku workarounds.
* thread_pthread.c: add stack bounds detection for Haiku.
* signal.c: get stack pointer from signal context on Haiku.
  [ruby-core:67923] [Bug #10811] [Fix GH-1109]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 03:54:42 +00:00
hsbt e3120abd58 * gems/bundled_gems: bump version to minitest-5.8.3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-23 02:44:17 +00:00
hsbt 9626fb488d * ChangeLog: fix wrong reference for r52714
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 23:55:06 +00:00
odaira 88376e639e * gc.c (rb_raw_obj_info): fix compile errors when USE_RGENGC
is 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 13:41:08 +00:00
ngoto d71ead259e * lib/cmath.rb: methods which has suffix '!' are now deprecated.
Re-apply r52469 made by Kazuki Tanaka, with fixing bug about
  mathn.rb compatibility. [ruby-core:68528] [Feature #10974]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 13:09:41 +00:00
hsbt 81a6bd50c2 * ext/openssl/ossl.c: fix brew command for installation of openssl.
[ci skip][fix GH-1007] Patch by @arthurnn

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 10:36:56 +00:00
ngoto 9546cb5272 * configure.in: On Solaris, add -D_XOPEN_SOURCE=n only when both
AC_TRY_CPP and AC_TRY_COMPILE pass, because some options
  (e.g. -std=iso9899:1999) are not set when running C preprocessor
  or building ext.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 09:01:04 +00:00
nobu 7dc4929214 compile.c: move logop DCE
* compile.c (iseq_peephole_optimize): remove unreachable code
  chunk after jump/leave.
* parse.y: move dead code elimination of logical operation to
  compile.c.  not to warn logical operation of literal constants.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 07:53:37 +00:00
nobu 792c822ec4 compile.c: optimize useless branches
* compile.c (iseq_peephole_optimize): eliminate always/never
  branches after a literal object and when the value is used after
  the branch.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-22 07:37:13 +00:00
ngoto 0a205155cf * configure.in: Add -D_XOPEN_SOURCE=500 (or 600 or 700) on Solaris
if available, mainly for enabling some features in sockets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 16:37:12 +00:00
ngoto 0917a3dea2 * test/socket/test_socket.rb (test/socket/test_socket.rb): skip the test when Socket::SO_TIMESTAMP is not defined.
Fix error on Solaris 10. [Bug #11728] [ruby-dev:49377]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 16:19:06 +00:00
kazu ab8a8b6846 fix typos [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 12:17:50 +00:00
nobu 82bd486e99 ruby.c: --debug=frozen-string-literal option
* ruby.c (need_argument): move frozen-string-literal-debug option
  from --enable to --debug.  [Feature #11725]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 09:57:31 +00:00
nobu c033efddea ruby.c: fix pointer overrun
* ruby.c (proc_options): fix pointer overrun. do not advance argv
  until it is valid.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 09:41:56 +00:00
naruse bbc63197bd * ext/digest/sha1/extconf.rb: OpenSSL's struct name for SHA1 is
SHA_CTX. http://openssl.org/docs/man0.9.8/crypto/SHA1.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 05:01:55 +00:00
naruse 9a7c25abab * ext/digest/*/*.[ch]: include ruby.h before digest.h to avoid
includeing ext/digest/extconf.h. [Bug #3231]
  https://msdn.microsoft.com/library/36k2cdd4.aspx

* ext/digest/*/extconf.rb: remove ext/digest from include search path
  to avoid confusion of cl.exe.

* ext/digest/*/*.[ch]: explicitly specify def.h's path.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21 04:35:57 +00:00