1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

38589 commits

Author SHA1 Message Date
usa
bbda1a0274 merge revision(s) 62968:
webrick: prevent response splitting and header injection

	Original patch by tenderlove (with minor style adjustments).

	* lib/webrick/httpresponse.rb (send_header): call check_header
	  (check_header): raise on embedded CRLF in header value
	* test/webrick/test_httpresponse.rb
	  (test_prevent_response_splitting_headers): new test
	* (test_prevent_response_splitting_cookie_headers): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:50:27 +00:00
usa
a45622669b merge revision(s) 62960-62965:
webrick: use IO.copy_stream for multipart response

	Use the new Proc response body feature to generate a multipart
	range response dynamically.  We use a flat array to minimize
	object overhead as much as possible; as many ranges may fit
	into an HTTP request header.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): new method
	  (make_partial_content): use multipart_body
	------------------------------------------------------------------------
	r62960 | normal | 2018-03-28 17:06:23 +0900 (水, 28 3 2018) | 13 lines

	webrick/httprequest: limit request headers size

	We use the same 112 KB limit started (AFAIK) by Mongrel, Thin,
	and Puma to prevent malicious users from using up all the memory
	with a single request.  This also limits the damage done by
	excessive ranges in multipart Range: requests.

	Due to the way we rely on IO#gets and the desire to keep
	the code simple, the actual maximum header may be 4093 bytes
	larger than 112 KB, but we're splitting hairs at that point.

	* lib/webrick/httprequest.rb: define MAX_HEADER_LENGTH
	  (read_header): raise when headers exceed max length
	------------------------------------------------------------------------
	r62961 | normal | 2018-03-28 17:06:28 +0900 (水, 28 3 2018) | 9 lines

	webrick/httpservlet/cgihandler: reduce memory use

	WEBrick::HTTPRequest#body can be passed a block to process the
	body in chunks.  Use this feature to avoid building a giant
	string in memory.

	* lib/webrick/httpservlet/cgihandler.rb (do_GET):
	  avoid reading entire request body into memory
	  (do_POST is aliased to do_GET, so it handles bodies)
	------------------------------------------------------------------------
	r62962 | normal | 2018-03-28 17:06:34 +0900 (水, 28 3 2018) | 7 lines

	webrick/httprequest: raise correct exception

	"BadRequest" alone does not resolve correctly, it is in the
	HTTPStatus namespace.

	* lib/webrick/httprequest.rb (read_chunked): use correct exception
	* test/webrick/test_httpserver.rb (test_eof_in_chunk): new test
	------------------------------------------------------------------------
	r62963 | normal | 2018-03-28 17:06:39 +0900 (水, 28 3 2018) | 9 lines

	webrick/httprequest: use InputBufferSize for chunked requests

	While WEBrick::HTTPRequest#body provides a Proc interface
	for streaming large request bodies, clients must not force
	the server to use an excessively large chunk size.

	* lib/webrick/httprequest.rb (read_chunk_size): limit each
	  read and block.call to :InputBufferSize in config.
	* test/webrick/test_httpserver.rb (test_big_chunks): new test
	------------------------------------------------------------------------
	r62964 | normal | 2018-03-28 17:06:44 +0900 (水, 28 3 2018) | 9 lines

	webrick: add test for Digest auth-int

	No changes to the actual code, this is a new test for
	a feature for which no tests existed.  I don't understand
	the Digest authentication code well at all, but this is
	necessary for the subsequent change.

	* test/webrick/test_httpauth.rb (test_digest_auth_int): new test
	  (credentials_for_request): support bodies with POST
	------------------------------------------------------------------------
	r62965 | normal | 2018-03-28 17:06:49 +0900 (水, 28 3 2018) | 18 lines

	webrick/httpauth/digestauth: stream req.body

	WARNING! WARNING! WARNING!  LIKELY BROKEN CHANGE

	Pass a proc to WEBrick::HTTPRequest#body to avoid reading a
	potentially large request body into memory during
	authentication.

	WARNING! this will break apps completely which want to do
	something with the body besides calculating the MD5 digest
	of it.

	Also, keep in mind that probably nobody uses "auth-int".
	Servers such as Apache, lighttpd, nginx don't seem to
	support it; nor does curl when using POST/PUT bodies;
	and we didn't have tests for it until now...

	* lib/webrick/httpauth/digestauth.rb (_authenticate): stream req.body

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:47:30 +00:00
usa
19cb3fa9e0 merge revision(s) 60584,62954-62959,63008:
webrick: support Proc objects as body responses

	* lib/webrick/httpresponse.rb (send_body): call send_body_proc
	  (send_body_proc): new method
	  (class ChunkedWrapper): new class

	* test/webrick/test_httpresponse.rb (test_send_body_proc): new test
	  (test_send_body_proc_chunked): ditto
	  [Feature ]

	webrick: favor .write over << method

	This will make the next change to use IO.copy_stream
	easier-to-read.  When we can drop Ruby 2.4 support in a few
	years, this will allow us to use writev(2) with multiple
	arguments for headers and chunked responses.

	* lib/webrick/cgi.rb (write): new wrapper method
	  lib/webrick/httpresponse.rb: (send_header): use socket.write
	  (send_body_io): ditto
	  (send_body_string): ditto
	  (send_body_proc): ditto
	  (_write_data): ditto
	  (ChunkedWrapper#write): ditto
	  (_send_file): ditto
	------------------------------------------------------------------------
	r62954 | normal | 2018-03-28 17:05:52 +0900 (水, 28 3 2018) | 14 lines

	webrick/httpresponse: IO.copy_stream for regular files

	Remove the redundant _send_file method since its functionality
	is unnecessary with IO.copy_stream.  IO.copy_stream also allows
	the use of sendfile under some OSes to speed up copies to
	non-TLS sockets.

	Testing with "curl >/dev/null" and "ruby -run -e httpd" to
	read a 1G file over Linux loopback reveals a reduction from
	around ~0.770 to ~0.490 seconds on the client side.

	* lib/webrick/httpresponse.rb (send_body_io): use IO.copy_stream
	  (_send_file): remove
	  [Feature ]
	------------------------------------------------------------------------
	r62955 | normal | 2018-03-28 17:05:57 +0900 (水, 28 3 2018) | 10 lines

	webrick: use IO.copy_stream for single range response

	This is also compatible with range responses generated
	by Rack::File (tested with rack 2.0.3).

	* lib/webrick/httpresponse.rb (send_body_io): use Content-Range
	* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
	  use File object for the single range case
	* test/webrick/test_filehandler.rb (get_res_body): use send_body
	  to test result
	------------------------------------------------------------------------
	r62956 | normal | 2018-03-28 17:06:02 +0900 (水, 28 3 2018) | 7 lines

	test/webrick/test_filehandler.rb: stricter multipart range test

	We need to ensure we generate compatibile output in
	the face of future changes

	* test/webrick/test_filehandler.rb (test_make_partial_content):
	  check response body
	------------------------------------------------------------------------
	r62957 | normal | 2018-03-28 17:06:08 +0900 (水, 28 3 2018) | 8 lines

	webrick: quiet warning for multi-part ranges

	Content-Length is ignored by WEBrick::HTTPResponse even if we
	calculate it, so instead we chunk responses to HTTP/1.1 clients
	and terminate HTTP/1.0 connections.

	* lib/webrick/httpservlet/filehandler.rb (make_partial_content):
	  quiet warning
	------------------------------------------------------------------------
	r62958 | normal | 2018-03-28 17:06:13 +0900 (水, 28 3 2018) | 7 lines

	webrick/httpresponse: make ChunkedWrapper copy_stream-compatible

	The .write method needs to return the number of bytes written
	to avoid confusing IO.copy_stream.

	* lib/webrick/httpresponse.rb (ChunkedWrapper#write): return bytes written
	  (ChunkedWrapper#<<): return self
	------------------------------------------------------------------------
	r62959 | normal | 2018-03-28 17:06:18 +0900 (水, 28 3 2018) | 9 lines

	webrick: use IO.copy_stream for multipart response

	Use the new Proc response body feature to generate a multipart
	range response dynamically.  We use a flat array to minimize
	object overhead as much as possible; as many ranges may fit
	into an HTTP request header.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): new method
	  (make_partial_content): use multipart_body

	get rid of test error/failure on Windows introduced at r62955

	* lib/webrick/httpresponse.rb (send_body_io): use seek if NotImplementedError
	  is raised in IO.copy_stream with offset.

	* lib/webrick/httpservlet/filehandler.rb (multipart_body): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:44:20 +00:00
usa
4cd92d7b13 merge revision(s) 62992:
pack.c: fix underflow

	* pack.c (pack_unpack_internal): get rid of underflow.
	  https://hackerone.com/reports/298246

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:38:39 +00:00
usa
47165eed26 merge revision(s) 62991,63000:
unixsocket.c: check NUL bytes

	* ext/socket/unixsocket.c (rsock_init_unixsock): check NUL bytes.
	  https://hackerone.com/reports/302997

	unixsocket.c: abstract namespace

	* ext/socket/unixsocket.c (unixsock_path_value): fix r62991 for
	  Linux abstract namespace.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:36:23 +00:00
usa
e9ddf2ba41 merge revision(s) 62990:
Ignore file separator from tmpfile/tmpdir name.

	From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:34:14 +00:00
usa
143eb22f18 merge revision(s) 62989:
dir.c: check NUL bytes

	* dir.c (GlobPathValue): should be used in rb_push_glob only.
	  other methods should use FilePathValue.
	  https://hackerone.com/reports/302338

	* dir.c (rb_push_glob): expand GlobPathValue

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@63015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 14:27:51 +00:00
usa
20ad678dfd merge revision(s) 62422,62436: [Backport ]
Merge RubyGems 2.7.6 from upstream.

	It fixed some security vulnerabilities.

	http://blog.rubygems.org/2018/02/15/2.7.6-released.html

	fix regexp literal warning.

	* test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
	  [Bug ]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@62443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 16:35:55 +00:00
usa
664b94fd2b merge revision(s) 58471,58493,62436: [Backport ]
load.c: backtrace of circular require

	* load.c (load_lock): print backtrace of circular require via
	  `Warning.warn` [ruby-core:80850] [Bug ]

	  Send the backtrace of the circular require warning as a single String to Warning.warn

	* load.c: send as a single string.
	* error.c: expose the string formatted by rb_warning as rb_warning_string().
	* test/ruby/test_exception.rb: update tests.
	  [ruby-core:80850] [Bug ]

	fix regexp literal warning.

	* test/rubygems/test_gem_server.rb: eliminate duplicated character class warning.
	  [Bug ]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@62441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 16:27:56 +00:00
usa
02b8978ff1 * test/net/ftp/test_ftp.rb (process_port_or_eprt): merge a part of
r56973 to pass the test introduced at previous commit.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@61255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 15:08:49 +00:00
usa
0207c68ea3 merge revision(s) 61242: [Backport ]
Fix a command injection vulnerability in Net::FTP.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@61246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:53:48 +00:00
usa
fc824f2a81 merge revision(s) 60149: [Backport ]
Merge rubygems-2.6.14 changes.

	  It fixed http://blog.rubygems.org/2017/10/09/unsafe-object-deserialization-vulnerability.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@61244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 13:50:12 +00:00
usa
d629ce0baa * ext/json: bump to version 1.8.1.1. [Backport ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 11:44:37 +00:00
usa
5450329ad1 asn1: fix out-of-bounds read in decoding constructed objects
* OpenSSL::ASN1.{decode,decode_all,traverse}: have a bug of
  out-of-bounds read. int_ossl_asn1_decode0_cons() does not give the
  correct available length to ossl_asn1_decode() when decoding the
  inner components of a constructed object. This can cause
  out-of-bounds read if a crafted input given.

Reference: https://hackerone.com/reports/170316
1648afef33


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 11:41:59 +00:00
usa
8a81d04d25 merge revision(s) 59897:
lib/webrick/log.rb: sanitize any type of logs

	It had failed to sanitize some type of exception messages.  Reported and
	patched by Yusuke Endoh (mame) at https://hackerone.com/reports/223363

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 11:37:47 +00:00
usa
4fdfb28e7d merge revision(s) 58453,58454: [Backport ]
Fix space flag when Inf/NaN and width==3

	* sprintf.c (rb_str_format): while `"% 2f"` and `"% 4f"` result in
	  `" Inf"` and `" Inf"` respectively, `"% 3f"` results in
	  `"Inf"` (no space).
	Refactor "%f" % Inf/NaN

	* sprintf.c (rb_str_format): as for non-finite float, calculate
	  the exact needed size with the space flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-14 11:35:52 +00:00
svn
0b572d70bc * 2017-09-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 01:10:25 +00:00
usa
97c6e3934c * lib/rubygems: fix several vulnerabilities in RubyGems; bump to version
2.4.5.3. [Backport ]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-10 01:10:24 +00:00
usa
366c5481e6 * ext/psych/yaml: update libyaml to 0.1.7.
* ext/psych/psych.gemspec: bump version to 2.0.8.1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@59793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-09 12:24:22 +00:00
usa
3220ce6b2b * version.h: bump to 2.2.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-28 16:46:20 +00:00
usa
b2638c9f19 merge revision(s) 58084: [Backport ]
configure.in: syscall is deprecated on macOS

	* configure.in: syscall is no longer supported on macOS since
	  10.12.  [ruby-core:80300] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-28 06:40:22 +00:00
usa
b411090c86 merge revision(s) 53566:
* configure.in: improve ICC (Intel C Compiler) support.

	* configure.in (CXX): The name of icc's c++ compiler is `icpc`.

	* configure.in (warnings): Add `-diag-disable=2259` to suppress
	  noisy warnings: "non-pointer conversion from "..." to "..." may
	  lose significant bits".

	* configure.in (optflags): Add `-fp-model precise` like -fno-fast-math.

	* lib/mkmf.rb: icc supports -Werror=division-by-zero
	  and -Werror=deprecated-declarations, but doesn't support
	  -Wdivision-by-zero and -Wdeprecated-declarations.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 16:42:03 +00:00
usa
ce3ea463ba * thread.c (rb_thread_fd_close): unintentionally removed at r58094.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 08:25:14 +00:00
usa
1fb37c4c1a * test/ruby/test_thread.rb (test_thread_interrupt_for_killed_thread):
may fix the test failure on some platforms introduced at r58108.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 07:25:05 +00:00
usa
b2cdb79c7a merge revision(s) 49806:
envutil.rb: timeout_error argument to invoke_ruby

	* test/lib/envutil.rb (invoke_ruby): add `timeout_error` optional
	  keyword argument, the exception class to be raised if the target
	  process timed out.  if it is nil, no exception will be raised at
	  timeout but the terminated output, error, and status will be
	  returned.  defaulted to Timeout::Error.

	* test/lib/envutil.rb (assert_separately): check outputs and
	  status (including diagnostic reports) of timed-out process.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 07:22:44 +00:00
usa
7b9fffe6a4 * thread.c (rb_thread_sleep_deadly_allow_spurious_wakeup): need to
mark as exported.  this may fix the load error introduced at r58115.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-26 04:11:55 +00:00
usa
9c3d2ca6ae * ChangeLog: log for r58102.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 20:31:44 +00:00
usa
544c352ec6 * ChangeLog: logs for r58085 - r58129.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 20:30:29 +00:00
usa
64cd400a3c merge revision(s) 58037: [Backport ]
docs for creating arrays

	* array.c: [DOC] add example for Array.new with block and index.
	  Reported by Don Cruickshank.  [ruby-core:68442] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:55:45 +00:00
usa
03ab27a83e merge revision(s) 58020: [Backport ]
date_core.c: fix error in DateTime docs

	* ext/date/date_core.c: [DOC] fix format string for DateTime#rfc3339.
	  Reported by Andreas Rayo Kniep.  [ruby-core:68418] [Bug ]

	* ext/date/date_core.c: [DOC] ditto for DateTime#iso8601 and
	  DateTime#xmlschema; other small improvements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:55:01 +00:00
usa
b41259dc3a merge revision(s) 58008: [Backport ]
io.c: improve docs

	* io.c: [DOC] improve and harmonize docs for IO#read and ARGF#read;
	  fix invalid example code for IO#read to make it syntax highlighted.

	* io.c: [DOC] various improvements for docs of IO, ARGF, and Kernel:
	  fix indent to ensure correct code block detection; sync "outbuf"
	  paragraph for {IO,ARGF}#read, {IO,ARGF}#readpartial, and IO#sysread;
	  fix formatting of call-seq's; improve Kernel#open example to use nil?;
	  fix RDoc markup and typos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:54:16 +00:00
usa
d5b08a46d0 merge revision(s) 57362: [Backport ]
vm_method.c: resolve refined method to undef

	* vm_method.c (rb_undef): resolve the method entry which refines a
	  prepended method entry.  [ruby-core:78944] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:42:37 +00:00
usa
950758b028 merge revision(s) 57737: [Backport ]
date_core.c: expand docs for Date shifting

	* ext/date/date_core.c: [DOC] expand docs for Date shifting

	  * add examples for Date#>> and Date#<< that clarify some edge cases
	  * add examples for Date#next_year and Date#prev_year
	  * add cross references to Date#>> and Date#<<

	  [ruby-core:79584] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:36:29 +00:00
usa
d823f587d1 merge revision(s) 57887: [Backport ]
lib/ostruct.rb: [DOC] revise docs for OpenStruct

	* update paragraph on implementation:
	  define_singleton_method is used, not define_method
	* add call-seq with return values for each_pair
	* adopt description of dig from Array and Hash
	* fix description of the hash method
	* :nodoc: initialize_copy, respond_to_missing?
	* other small improvements, e.g. use the term `attribute' in the docs
	  (instead of `member'), which is clearer for users of the class
	* improve code examples: e.g. use more consistent style (always use
	  double quotes, drop `p' and `puts', ...), update inspect output,
	  use example data that is not prone to change (like population)
	* add more code examples
	* fix some small errors and grammar

	[ruby-core:79265] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:35:09 +00:00
usa
25912b8828 merge revision(s) 57352: [Backport ]
doc: improve documentation for Binding [ci skip]

	* remove explicit return from code examples
	* grammar fixes
	* other small fixes

	Patch by: Marcus Stollsteimer <sto.mar@web.de>

	[ruby-core:79082] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:31:18 +00:00
usa
352b041dd3 merge revision(s) 57775: [Backport ]
nodoc OptParse

	* lib/optparse.rb: [DOC] nodoc OptParse, introduced with r46126,
	  to avoid leaking of its documentation (OptionParser's docs) into
	  the class documentation of Object.  [ruby-core:79909] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:28:27 +00:00
usa
02deb79d99 merge revision(s) 57686: [Backport ]
rational.c: fix rdoc

	* rational.c: [DOC] fix wrong indentations and comment out some lines
	  in code examples to make them valid Ruby code and syntax highlighted
	  on the rendered page.

	[ci skip] [ruby-core:79607] [Bug ]
	Author:    Marcus Stollsteimer <sto.mar@web.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:26:56 +00:00
usa
acc6a302e4 merge revision(s) 57640: [Backport ]
fileutils.rb: do not make root

	* lib/fileutils.rb (FileUtils#mkdir_p): no need to make root
	  directory which should be exist and cannot be made with mkdir
	  recent Cygwin can make a directory contains a colon.
	  [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:24:28 +00:00
usa
1bd1e84388 merge revision(s) 57265,57266: [Backport ]
win32/resolv.rb: ad hoc workaround

	* ext/win32/lib/win32/resolv.rb (Win32::Resolv::SZ): an ad hoc
	  workaround for broken registry.  SearchList and other registry
	  values must be REG_SZ, or Windows ignores anything in those
	  values otherwise.  [ruby-dev:49924] [Bug ]
	  https://github.com/rubygems/rubygems/issues/1700
	win32/registry.rb: registry type names

	* ext/win32/lib/win32/registry.rb (Win32::Registry#read): show
	  registry type names instead of numeric values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:22:34 +00:00
usa
cc938265eb merge revision(s) 57536: [Backport ]
doc: Add example for Symbol#to_s

	* string.c: add example for Symbol#to_s.

	The docs for Symbol#to_s only include an example for
	Symbol#id2name, but not for #to_s which is an alias;
	the docs should include examples for both methods.

	From: Marcus Stollsteimer <sto.mar@web.de>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:19:17 +00:00
usa
f84d286415 merge revision(s) 57688,57689: [Backport ]
rational.c: infinity in power

	* rational.c (nurat_expt): return Infinity due to overflow.
	  [ruby-core:79686] [Bug ]:
	rational.c: infinity in power

	* rational.c (nurat_expt): return 0 due to overflow.
	  [ruby-core:79686] [Bug ]:

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:16:16 +00:00
usa
d410184643 merge revision(s) 57024: [Backport ]
vm.c: check type of hash to merge

	* vm.c (core_hash_merge): check the type of the target hash to
	  merge.  [ruby-core:78536] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:13:17 +00:00
usa
d014f463cf merge revision(s) 57477,57478,57479,57492: [Backport ]
use TRUE/FALSE.

	define rb_thread_sleep_deadly_allow_spurious_wakeup().

	* thread.c, thread_sync.c: define new function
	  rb_thread_sleep_deadly_allow_spurious_wakeup() and use it instead of
	  using sleep_forever() directly.

	allow Queue operation in trap.

	* thread_sync.c: allow spurious wakeup to check Queue status just after trap.
	  [Bug ]

	* test/thread/test_queue.rb: add a test for it.

	test_queue.rb: fix portability

	* test/thread/test_queue.rb (test_queue_with_trap): fix
	  portability.  use SIGINT instead of SIGUSR2 which is supported
	  on not all platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 18:07:08 +00:00
usa
ed20b2561c merge revision(s) 51871,51872,51874,51875,51876,51877,51878,57517: [Backport ]
* doc/syntax/literals.rdoc (Strings): mention about ?a literal.

	literals.rdoc: fix typos

	* doc/syntax/literals.rdoc (Strings): fix typos.
	* doc/syntax/literals.rdoc (Strings): [DOC] Document the full list
	  of supported escape sequences in string literals.

	* doc/syntax/literals.rdoc (Strings): [DOC] Revise the character
	  literal part.

	literals.rdoc: add DEL [ci skip]

	* doc/syntax/literals.rdoc (Strings): [DOC] add DEL.
	[DOC] `\0` is interpreted as NUL only if not followed by an octal digit.
	[DOC] Remove `\0` since it's aprt of octal notation

	A typo is fixed while at it.
	doc: Fix error for escape sequences in string literals

	Backslash goes first in escape sequences, so it must be
	"any other character following a backslash is interpreted as ...",
	while the doc says "...followed by...".

	Author: Marcus Stollsteimer <sto.mar@web.de>
	[ruby-core:79418] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:45:00 +00:00
usa
fd69ec05c0 merge revision(s) 57522: [Backport ]
doc: restore class documentation for Struct

	* struct.c: restore class documentation for Struct
	  that disappeared with r46663.

	Due to r46663, the class documentation for Struct disappeared.
	(The revision inserted the definition of `InitVM_Struct` between
	the rdoc and the definition of `Init_Struct`.)

	The docs are rendered for 2.1: <https://docs.ruby-lang.org/en/2.1.0/Struct.html>,
	but not for later versions, see: <https://docs.ruby-lang.org/en/2.2.0/Struct.html>
	(Same for `ri` pages).

	[ruby-core:79416] [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:37:23 +00:00
usa
0a1e564683 merge revision(s) 57434: [Backport ]
Enumerable#{min,min_by,max,max_by} [ci skip]

	* enum.c: [DOC] Enumerable#{min,min_by,max,max_by} return a sorted
	  array when +n+ argument is used.

	* enum.c: Small typo : minimum -> maximum

	[Bug ]
	Author:    Eric Duminil <eric.duminil@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:36:34 +00:00
usa
bf2d4e93b1 merge revision(s) 54785: [Backport ]
* ruby.c (process_options): convert -e script to the encoding
	  given by a command line option on Windows.  assume it is the
	  expected encoding.  [ruby-dev:49461] [Bug ]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58111 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:35:52 +00:00
usa
ae432a96b1 merge revision(s) 57539: [Backport ]
rational.c: fix rdoc [ci skip]

	* rational.c (rb_rational_plus): [DOC] fix an example.
	  A patch by Trygve Flathen <at.ruby-lang AT flathen.net> in
	  [ruby-core:71755].  [Bug ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:34:13 +00:00
usa
8c34c05d24 merge revision(s) 56310: [Backport ]
* win32/win32.c (poll_child_status): rb_w32_wait_events_blocking() sets
	  errno internally, then should not set it here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:32:17 +00:00
usa
f60e5af02d merge revision(s) 57595: [Backport ]
check thread deadness correctly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-25 17:27:37 +00:00