merge revision(s) 45520: [Backport #9706]

	* ext/date/date_core.c (d_lite_cmp): should compare with #<.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45529: [Backport #8182]

	* lib/xmlrpc/client.rb (do_rpc): don't check body length.
	  If HTTP content-encoding is used, the length may be different.
	  [Bug #8182] [ruby-core:53811]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45534: [Backport #9709]

	* string.c (str_buf_cat): should round up the capacity by 4KiB,
	  but not number of rooms.  [ruby-core:61886] [Bug #9709]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45562: [Backport #9727]

	* array.c (ary_reject): may be turned into a shared array during
	  the given block.  [ruby-dev:48101] [Bug #9727]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45564,45565,45584,45585: [Backport #9721]

	* proc.c (rb_method_call_with_block, umethod_bind): call with
	  IClass including the module for a module instance method.
	  [ruby-core:61936] [Bug #9721]

	* vm_insnhelper.c (vm_search_super_method): allow bound
	  UnboundMethod case.

	* proc.c (umethod_bind): use the ancestor iclass instead of new
	  iclass to get rid of infinite recursion, if the defined module
	  is already included.  [ruby-core:62014] [Bug #9721]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45604: [Backport #9748]

	* lib/fileutils.rb (FileUtils#copy_entry): update rdoc about
	  preserve option and permissions, following r31123.
	  [ruby-core:62065] [Bug #9748]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45646: [Backport #9765]

	* ext/stringio/stringio.c (strio_putc): fix for non-ascii
	  encoding, like as IO#putc.  [ruby-dev:48114] [Bug #9765]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45701: [Backport #9771]

	* ext/openssl/ossl_asn1.c (ossl_asn1_initialize): SYMID on a value
	  other than Symbol is an undefined behavior.  fix up r31699.
	  [ruby-core:62142] [Bug #9771]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45716: [Backport #9665]

	* configure.in (rb_cv_func___builtin_unreachable): try with an
	  external variable not only by a warning, which might not be
	  shown due to the optimization.  [ruby-core:61647] [Bug #9665]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45291,45299,45314,45325: [Backport #9599]

	* ext/dl/cptr.c (dlptr_free), ext/dl/handle.c (dlhandle_free),
	  ext/fiddle/handle.c (fiddle_handle_free),
	  ext/fiddle/pointer.c (fiddle_ptr_free): fix memory leak.
	  based on the patch Heesob Park at [ruby-dev:48021] [Bug #9599].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45637: [Backport #9726]

	* parse.y (primary): flush cmdarg flags inside left-paren in a
	  command argument, to allow parenthesed do-block as an argument
	  without arguments parentheses.  [ruby-core:61950] [Bug #9726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 39239,45045,45530: [Backport #9697]

	* ext/socket: always operate length of socket addess companion with
	  socket address. 

	* ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
	  socket address length.
	  (rsock_ipaddr): ditto.

	* ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
	  (ip_peeraddr): ditto.
	  (ip_s_getaddress): pass length to rsock_make_ipaddr.

	* ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr.
	  (sock_s_getnameinfo): pass actual address length to rb_getnameinfo.
	  (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr.
	  

	* ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
	  (rsock_s_recvfrom_nonblock): ditto.

	* ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
	  rsock_make_ipaddr.

	* ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket
	  address length.  pass the length to rb_getnameinfo.
	  (rsock_ipaddr): ditto.
	  (rsock_make_ipaddr): add an argument for socket address length. 
	  pass the length to make_ipaddr0.
	  (make_inetaddr): pass length to make_ipaddr0.
	  a local variable renamed.
	  (host_str): a local variable renamed.
	  (port_str): ditto.

	* ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.

	* ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.
	  Reported by Saravana kumar.  [ruby-core:61820] [Bug #9697]
	  Fixed by Heesob Park.  [ruby-core:61868]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45287:45290: [Backport #9600]

	* process.c (obj2uid, obj2gid): now getpwnam_r() and getgrnam_r()
	  may need larger buffers than sysconf values, so retry with
	  expanding the buffer when ERANGE is returned.
	  [ruby-core:61325] [Bug #9600]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 44474,44538,44539,44890,44896,45954: [Backport #8358]

	* configure.in: use SSE2 instructions for drop unexpected
	  precisions.  [ruby-core:54738] [Bug #8358]

	* configure.in: use SSE2 instructions to drop unexpected precisions on
	  other than mingw.  [ruby-core:59472] [Bug #8358]

	* configure.in: -mstackrealign is necessary for -msse2 working.
	  [ruby-core:54716] [Bug #8349]

	* configure.in: -mstackrealign is necessary for -msse2 working.
	  [ruby-core:54716] [Bug #8349]

	* configure.in: add qouting brackets and append wildcard for the
	  rest after target_cpu, to properly detect platform for SSE2
	  instructions.  [ruby-core:60576] [Bug #8358]

	* configure.in: Fix compilation error.
	  https://bugs.ruby-lang.org/issues/8358#note-16

	* configure.in: enable SSE2 on mingw. target='i386-pc-mingw32'.
	  [ruby-core:62095] [Bug #8358]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 46060: [Backport #9627]

	* net/protocol.rb (using_each_crlf_line): fix SMTP dot-stuffing
	  for messages not ending with a new-line.
	  [ruby-core:61441] [Bug #9627] [fix GH-616]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45287:

	process.c: tmp buffer instead of alloca

	* process.c (OBJ2UID1, OBJ2GID1): separate from OBJ2UID and
  OBJ2GID respectively, need given buffers.

	* process.c (OBJ2UID, OBJ2GID): no longer need PREPARE_GETPWNAM
  and PREPARE_GETGRNAM.

	* process.c (obj2uid, obj2gid): use tmp buffer instead of alloca
  to get rid of potential stack overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45899: [Backport #9751]

	* thread.c (thread_start_func_2): stop if forked in a sub-thread,
	  the thread has become the main thread.
	  [ruby-core:62070] [Bug #9751]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 45874: [Backport #9813]

	* class.c (rb_mod_init_copy): always clear instance variable,
	  constant and method tables first, regardless the source tables.
	  [ruby-dev:48182] [Bug #9813]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 46194: [Backport #9835]

	* signal.c (signal_exec): ignore immediate cmd for SIG_IGN

	* signal.c (trap_handler): set cmd to true for SIG_IGN

	* signal.c (trap): handle nil and true values for oldcmd
	  [Bug #9835]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 43748,45947,45951: [Backport #9739]

	* eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
	  test/ruby/test_exception.rb on Windows.
	  wrap by __try and __exception statements on mswin to raise SIGSEGV
	  when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
	  handle the exception.
	  however, (1) mingw-gcc doesn't support __try and __exception
	  statements, and (2) we cannot retry SystemStackError after this
	  change yet (maybe crashed) because SEH and longjmp() are too
	  uncongenial.

	* signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
	  Windows, too.

	* thread_win32.c (ruby_stack_overflowed_p): ditto.

	* thread_win32.c (rb_w32_stack_overflow_handler): use Structured
	  Exception Handling by Addvectoredexceptionhandler() for machine
	  stack overflow on mingw.
	  This would be equivalent to the handling using __try and __exept
	  on mswin introduced by r43748.
	  Exception Handling by AddVectoredExceptionHandler() for machine
	  This would be equivalent to the handling using __try and __except


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e