7399 Commits
Author SHA1 Message Date
Kazuki Yamaguchi 9308e32aa6 Merge openssl-2.1.4
The changes can be found at:

  https://github.com/ruby/openssl/compare/v2.1.3...v2.1.4
2022-11-24 20:06:00 +09:00
Hiroshi SHIBATAandYuta Saito 31bc55dc90 Backport https://github.com/ruby/ruby/pull/6193
Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
2022-09-16 15:11:08 +09:00
NAKAMURA Usaku 83de713387 merge revision(s) c51b92c18d: [Backport #18358]
[ruby/zlib] [Bug #18358] Fix crash in zlib when in progress

    When Zlib::Inflate#inflate or Zlib::Deflate#deflate is called
    recursively inside the block, a crash can occur because of an
    use-after-free bug.

    https://github.com/ruby/zlib/commit/50fb8a0338
    ---
     ext/zlib/zlib.c        | 117 ++++++++++++++++++++++++++++++++-----------------
     test/zlib/test_zlib.rb |  10 ++++-
     2 files changed, 85 insertions(+), 42 deletions(-)
2022-03-05 22:01:07 +09:00
NAKAMURA Usaku f740ffb81f merge revision(s) b3d62a77d9 [Backport #17803]
[ruby/zlib] Synchronize access to zstream to prevent segfault in
     multithreaded use

    I'm not sure whether this handles all multithreaded use cases,
    but this handles the example that crashes almost immediately
    and does 10,000,000 total deflates using 100 separate threads.

    To prevent the tests from taking forever, the committed test
    for this uses only 10,000 deflates across 10 separate threads,
    which still causes a segfault in the previous implementation
    almost immediately.

    Fixes [Bug #17803]

    https://github.com/ruby/zlib/commit/4b1023b3f2
    ---
     ext/zlib/zlib.c        | 33 ++++++++++++++++++++++++++-
     test/zlib/test_zlib.rb | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
     2 files changed, 93 insertions(+), 1 deletion(-)
2022-03-05 21:38:48 +09:00
NAKAMURA Usaku 1034b6e7ba merge revision(s) 0c5f8c6276: [Backport #10961]
[ruby/zlib] Resume zstream if available [Bug #10961]

	---
	 ext/zlib/zlib.c | 6 ++++++
	 1 file changed, 6 insertions(+)
2021-12-31 19:48:36 +09:00
NAKAMURA Usaku f69aeb8314 merge some parts of CGI 0.1.1
Fix integer overflow

	Make use of the check in rb_alloc_tmp_buffer2.

	When parsing cookies, only decode the values

	Bump version
2021-11-24 20:21:17 +09:00
NAKAMURA Usaku 6601fb5672 merge revision(s) 25e56fe374478a2266ac25f22a07bb3c6a423c83,8758b07b1e4fd636dffb4b442388a3033c63d4b5,791e8eec66d3aebcee36c1369b0bf52bc3815e94: [Backport #18016]
[ruby/fiddle] Fix Win32Types for Windows 64-bit (#63)

	https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

	https://github.com/ruby/fiddle/commit/28ee5b1608
	---
	 ext/fiddle/lib/fiddle/types.rb | 8 ++++----
	 1 file changed, 4 insertions(+), 4 deletions(-)

	[ruby/fiddle] Fix more Win32Types definitions

	https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

	https://github.com/ruby/fiddle/commit/805c1a595a
	---
	 ext/fiddle/lib/fiddle/types.rb | 23 ++++++++++++-----------
	 1 file changed, 12 insertions(+), 11 deletions(-)

	[ruby/fiddle] win32types: sort

	https://github.com/ruby/fiddle/commit/35dec6c5a5
	---
	 ext/fiddle/lib/fiddle/types.rb | 30 +++++++++++++++---------------
	 1 file changed, 15 insertions(+), 15 deletions(-)
2021-11-24 19:25:38 +09:00
Hiroshi SHIBATA ade896702e Merge date-3.0.3 2021-11-24 17:55:25 +09:00
Kazuki Yamaguchi e0b323632f openssl: import v2.1.3
Bring the local copy of ruby/openssl in sync with the upstream gem
release v2.1.3. The commits happened in the upstream repository can be
found at:

	https://github.com/ruby/openssl/compare/v2.1.2...v2.1.3

Note that many of these have already been applied to ruby.git and don't
appear in the file changes of this commit.
2021-11-24 16:45:46 +09:00
Jeremy Evans d9ff8b3e86 Ignore timeout option to Addrinfo.getaddrinfo
This was already ignored on platforms that do not implement
getaddrinfo_a. Using getaddrinfo_a causes issues with many
calls to Addrinfo.getaddrinfo and also when using
Addrinfo.getaddrinfo with fork.

I would have updated the documentation for this, but the
option was already not documented.
2021-07-31 21:24:44 +09:00
nagachika 0cfd491732 merge revision(s) 9241211538: [Backport #17589]
Forward keyword arguments for Pathname#each_line [Bug #17589]

	---
	 ext/pathname/pathname.c        |  4 ++--
	 test/pathname/test_pathname.rb | 26 ++++++++++++++++++++++++++
	 2 files changed, 28 insertions(+), 2 deletions(-)
2021-02-20 18:06:43 +09:00
nagachika 5cbba4d600 merge revision(s) 1ca9facab6: [Backport #17358]
Add monitor to document files
2020-12-31 15:40:30 +09:00
nagachika 229c041f05 merge revision(s) d732bc51bdbfe7d66038731d42e01a511d13b5f8,633a1f15d8228236094ddee12e4e169d655ec49e,95f387f61a4a4ea92635da760b7de5b1e09bb84e,528a3a17977aa1843a26630c96635c3cb161e729,261569d4aac440f25de588cca365163ecf1124a2,e4a9e926f0fe0acf2fbe61da6e075a95d34be066,318be1cb2f9c6f04403c063a5618c6267012ee51,e1855100e46040e73630b378974c17764e0cccee,9cfa811b0f209d714f89fe0de6778c71f77556c7,b68dab866724aacc1cbc6b7d5e1f555dec092346: [Backport #17202]
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
	```

	[ruby/fiddle] Use ffi_closure_free if available

	[ruby/fiddle] ffi_closure_free is available in the bundled libffi

	[ruby/fiddle] use ffi_closure_alloc only with 3.2 or later

	[ruby/fiddle] always use ffi_closure_alloc on Windows

	Fixed a typo

	Show libffi version only if set

	ext/fiddle/extconf.rb: check if ffi_closure_alloc is available

	to define HAVE_FFI_CLOSURE_ALLOC.
	The macro is used in closure.c, so have_func check is needed.

	If pkg-config is not installed, extconf.rb fails to detect the version
	of libffi, and does not add "-DUSE_FFI_CLOSURE_ALLOC=1" even when system
	libffi version is >= 3.2.

	If USE_FFI_CLOSURE_ALLOC is not defined, closure.c attempts to check if
	HAVE_FFI_CLOSURE_ALLOC is defined or not, but have_func was removed with
	528a3a1797, so the macro is always not
	defined.

	This resulted in this deprecation warning:

	https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200512T123003Z.log.html.gz
	```
	compiling closure.c
	closure.c: In function 'initialize':
	closure.c:265:5: warning: 'ffi_prep_closure' is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
	  265 |     result = ffi_prep_closure(pcl, cif, callback, (void *)self);
	      |     ^~~~~~
	In file included from ./fiddle.h:42,
	                 from closure.c:1:
	/usr/include/x86_64-linux-gnu/ffi.h:334:1: note: declared here
	  334 | ffi_prep_closure (ffi_closure*,
	      | ^~~~~~~~~~~~~~~~
	```

	Do not try ffi_closure_alloc if libffi is <= 3.1

	Maybe due to e1855100e4, CentOS, RHEL, and
	Fedora CIs have started failing with SEGV.  Try to avoid
	ffi_closure_alloc on those environments.

	https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos8/ruby-master/log/20200512T183004Z.fail.html.gz
	https://rubyci.org/logs/rubyci.s3.amazonaws.com/fedora32/ruby-master/log/20200512T183004Z.fail.html.gz
	https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20200512T183003Z.fail.html.gz

	ext/fiddle/extconf.rb: Fix the condition of libffi <= 3.1

	ver is [3, 1, 0] which is not less then or equal to [3, 1]
2020-10-01 07:53:55 +09:00
nagachika f469298339 merge revision(s) f96216df8dfd2d1e206150572912289f4dda7386,0091fac1d8de07e86fef8315ba77609bed9dd7f5,04c704c5c967ea9bded6bf645439fe59c7d9f7d6,23655e6de5ee989feb8c65c7061fe9a71579dc54,7cb8904a12c850ee30dcd67817fa2f9dc3fee813,41168f69fbeb32cfc88210911d62e419b8116589,87f6154bb4c67ca77ee353bb1fe25a922036c0e5: [Backport #17202]
Remove "All Rights Reserved." from Copyright statement.

	Patch assembly so that it aligns properly

	Removed trailing spaces [ci skip]

	Fix build error on Apple silicon macOS

	This patch will fix following build error on macOS 11.0 + Xcode 12 beta.

	```
	$ ./configure
	$ make V=1
		BASERUBY = /Users/watson/.rbenv/shims/ruby --disable=gems
		CC = clang -fdeclspec
		LD = ld
		LDSHARED = clang -fdeclspec -dynamiclib
		CFLAGS = -O3 -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=division-by-zero -Werror=implicit-function-declaration -Werror=implicit-int -Werror=misleading-indentation -Werror=pointer-arith -Werror=shorten-64-to-32 -Werror=write-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror=extra-tokens -std=gnu99  -pipe
		XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/arm64-darwin20 -I./include -I. -I./enc/unicode/12.1.0
		CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
		DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -fstack-protector-strong -Wl,-pie -framework Security -framework Foundation
		SOLIBS = -lpthread -ldl -lobjc
		LANG = ja_JP.UTF-8
		LC_ALL =
		LC_CTYPE =
		MFLAGS =
	Apple clang version 12.0.0 (clang-1200.0.22.19)
	Target: arm64-apple-darwin20.0.0
	Thread model: posix
	InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
	clang -fdeclspec -O3 -ggdb3 -Wall -Wextra -Werror=deprecated-declarations -Werror=division-by-zero -Werror=implicit-function-declaration -Werror=implicit-int -Werror=misleading-indentation -Werror=pointer-arith -Werror=shorten-64-to-32 -Werror=write-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Werror=extra-tokens -std=gnu99  -pipe  -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -DRUBY_DEVEL=1 -fvisibility=hidden -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/arm64-darwin20 -I./include -I. -I./enc/unicode/12.1.0 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -o cont.o -c cont.c
	In file included from cont.c:19:
	./coroutine/ucontext/Context.h:32:5: error: 'getcontext' is deprecated: first deprecated in macOS 10.6 [-Werror,-Wdeprecated-declarations]
	    getcontext(&context->state);
	    ^
	/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ucontext.h:37:6: note: 'getcontext' has been
	      explicitly marked deprecated here
	int  getcontext(ucontext_t *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
	     ^
	In file included from cont.c:19:
	./coroutine/ucontext/Context.h:51:5: error: 'makecontext' is deprecated: first deprecated in macOS 10.6 [-Werror,-Wdeprecated-declarations]
	    makecontext(&context->state, (void(*)(void))coroutine_trampoline, 2, (void*)start, (void*)context);
	    ^
	/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ucontext.h:38:6: note: 'makecontext' has been
	      explicitly marked deprecated here
	void makecontext(ucontext_t *, void (*)(), int, ...) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_2_0) __WATCHOS_PROHI...
	     ^
	In file included from cont.c:19:
	./coroutine/ucontext/Context.h:59:5: error: 'swapcontext' is deprecated: first deprecated in macOS 10.6 [-Werror,-Wdeprecated-declarations]
	    swapcontext(&current->state, &target->state);
	    ^
	/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ucontext.h:40:6: note: 'swapcontext' has been
	      explicitly marked deprecated here
	int  swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_2_0, __IPHONE_...
	     ^
	3 errors generated.
	make: *** [cont.o] Error 1
	```

	Extract correct processor name for ARM64 Macs

	Prefix export symbol prefix to coroutine_transfer

	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-09-30 19:24:17 +09:00
aycabta 21c1b676c4 Merge latest readline-ext 2020-09-16 21:09:17 +09:00
nagachika 43cc6997c5 merge revision(s) a0bc3f2a1c2c98f225612101cb4e1ea1a6813546,75a0447c15a7ab017bd4240c2a9cc69b134b80b9,f1699314147bad2cf5550cc582693424fdbc2510: [Backport #16846]
Suppress C4267 "possible loss of data" warnings

	Suppress C4267 "possible loss of data" warnings

	Just cast down explicitly.

	win32ole: separate global variable declarations and definitions

	https://gcc.gnu.org/gcc-10/changes.html#c

	> * GCC now defaults to `-fno-common`.  As a result, global
	>   variable accesses are more efficient on various targets.  In
	>   C, global variables with multiple tentative definitions now
	>   result in linker errors.  With `-fcommon` such definitions are
	>   silently merged during linking.
2020-07-26 16:19:40 +09:00
nagachika b4c893a62c OpenSSL 1.1.1 introduces a new '.include' directive. Update our config
parser to support that.

As mentioned in the referenced GitHub issue, we should use the OpenSSL
API instead of implementing the parsing logic ourselves, but it will
need backwards-incompatible changes which we can't backport to stable
versions. So continue to use the Ruby implementation for now.

References:
  https://github.com/ruby/openssl/issues/208
  https://github.com/ruby/openssl/pull/216

The original patch was written by Kazuki Yamaguchi <k@rhe.jp> and
the patch for ruby_2_7 branch was prepared by Vít Ondruch.
2020-07-11 16:10:41 +09:00
NARUSE, YuiandSamuel Williams f832d957b8 ext/socket/init.c: do not return uninitialized buffer
BasicSocket#read_nonblock and some methods changes the size of a buffer
string, but when no data is available, the buffer is returned as
uninitialized.

Co-Authored-By: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2020-03-31 19:26:10 +09:00
Alan Wu b5fa156b79 Clear all trace events during teardown
Since 0c2d81dada, not all trace events are cleared during VM teardown.
This causes a crash when there is a tracepoint for
`RUBY_INTERNAL_EVENT_GC_EXIT` active during teardown.

The commit looks like a refactoring commit so I think this change was
unintentional.

[Bug #16682]

(cherry picked from commit b385f7670f)
2020-03-30 19:15:11 +09:00
+7 0057fe4063 Ruby 2.7 backport about IRB (#2990)
* [ruby/reline] Sort completion list

#### Legacy mode:

  ```console
  $ irb --legacy
  irb(main):001:0> l[TAB][TAB]
  lambda           load             local_variables  loop
  ```

#### Before this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  local_variables
  loop
  lambda
  load
  ```

#### After this patch:

  ```console
  $ irb
  irb(main):001:0> l[TAB][TAB]
  lambda
  load
  local_variables
  loop
  ```

https://github.com/ruby/reline/commit/6074069c7d

* Drop an invalid char as UTF-8

* Add test_completion_with_indent_and_completer_quote_characters

This is for 8a705245e5.

* [ruby/irb] Add tests for RubyLex

The set_auto_indent method calculates the correct number of spaces for
indenting a line. We think there might be a few bugs in this method so
we are testing the current functionality to make sure nothing breaks
when we address those bugs.

Example test failure:

```
  1) Failure:
TestIRB::TestRubyLex#test_auto_indent [/Users/Ben/Projects/irb/test/irb/test_ruby_lex.rb:75]:
Calculated the wrong number of spaces for:
 def each_top_level_statement
  initialize_input
  catch(:TERM_INPUT) do
    loop do
      begin
        prompt
        unless l = lex
          throw :TERM_INPUT if @line == ''
        else
.
<10> expected but was
<12>.
```

https://github.com/ruby/irb/commit/752d5597ab

* [ruby/reline] Degenerate the terminal size to [$LINES, $COLUMNS] if it is unknown

This is a workaround for https://github.com/ruby/irb/issues/50

https://github.com/ruby/reline/commit/5725677d1a

* [ruby/irb] Fix newline depth with multiple braces

This commit fixes the check_newline_depth_difference method to multiple
open braces on one line into account. Before this change we were
subtracting from the depth in check_newline_depth_difference on
every open brace. This is the right thing to do if the opening and
closing brace are on the same line. For example in a method definition we
have an opening and closing parentheses we want to add 1 to our depth,
and then remove it.

```
def foo()
end
```

However this isn't the correct behavior when the brace spans multiple
lines. If a brace spans multiple lines we don't want to subtract from
check_newline_depth_difference and we want to treat the braces the same
way as we do `end` and allow check_corresponding_token_depth to pop the
correct depth.

Example of bad behavior:

```
def foo()
  [
  ]
puts 'bar'
end
```

Example of desired behavior:

```
def foo()
  [
  ]
  puts 'bar'
end
```

https://github.com/ruby/irb/commit/7dc8af01e0

* text/readline/test_readline.rb - fix skip on Reline (#2743)

TestRelineAsReadline#test_input_metachar passes on MinGW

* Add "require 'openstruct'" what is forgotten

* [ruby/irb] Fix lib name of OpenStruct

https://github.com/ruby/irb/commit/1f3a84ab6b

* Add load path and require for ruby/ruby

* Rescue EOFError

If C-d is pressed before IRB is ready, IRB crashes because EOFError occurs.

* Complete indented and quoted string correctly

  def foo
    ''.upca[TAB]

This will be completed to be:

  def foo
  ''.upcase

The indent was gone. This commit fixes the bug.

* [ruby/irb] Fix crashing when multiple open braces per line

https://github.com/ruby/irb/issues/55

If we had put multiple open braces on a line the with no closing brace
spaces_of_nest array keeps getting '0' added to it. This means that when
we pop off of this array we are saying that we should be in position zero
for the next line. This is an issue because we don't always want to be
in position 0 after a closing brace.

Example:
```
[[[
]
]
]
```
In the above example the 'spaces_of_nest' array looks like this after
the first line is entered: [0,0,0]. We really want to be indented 4
spaces for the 1st closing brace 2 for the 2nd and 0 for the 3rd. i.e.
we want it to be: [0,2,4].

We also saw this issue with a heredoc inside of an array.

```
[<<FOO]
hello
FOO
```

https://github.com/ruby/irb/commit/80c69c8272

* Support history-size in .inputrc correctly

* Introduce an abstracted structure about the encoding of Reline

The command prompt on Windows always uses Unicode to take input and print
output but most Reline implementation depends on Encoding.default_external.
This commit introduces an abstracted structure about the encoding of Reline.

* Remove an unused setting variable

* Use Reline.encoding_system_needs if exists

* Add tests for vi_insert and vi_add

* Implement vi_insert_at_bol and vi_add_at_eol

* [ruby/reline] Implement vi_to_next_char

https://github.com/ruby/reline/commit/066ecb0a21

* [ruby/reline] Implement vi_prev_char and vi_to_prev_char

https://github.com/ruby/reline/commit/0ad3ee63fa

* [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

* Stop using minitest dependent methods

* Skip a test that uses assert_ruby_status if it doesn't exist

* Use omit instead of skip

* Check DONT_RUN_RELINE_TEST envvar

* [ruby/irb] Add newline_before_multiline_output

https://github.com/ruby/irb/commit/9eb1801a66

* [ruby/irb] Fix compatibility with rails before 5.2

Rails before 5.2 added Array#append as an alias to Array#<< ,
so that it expects only one argument.
However ruby-2.5 added Array#append as an alias to Array#push
which takes any number of arguments.

If irb completion is used in `rails c` (for example "IO.<tab>")
it fails with:
  irb/completion.rb:206:in `<<': wrong number of arguments (given 3, expected 1) (ArgumentError)

Using Array#push instead of Array#append fixes compatibility.

https://github.com/ruby/irb/commit/5b7bbf9c34

* Reline: Use a more robust detection of MinTTY

The previous detection per get_screen_size fails when stdout is passed
to a pipe. That is the case when running ruby tests in parallel ("-j" switch).
In this case Reline believes that it's running on MinTTY and the tests
are running with ANSI IOGate instead of the Windows adapter on MINGW.
So parallel test results were different to that of a single process.
This commit fixes these differencies.

The code is taken from git sources and translated to ruby.
NtQueryObject() is replaced by GetFileInformationByHandleEx(), because
NtQueryObject() is undocumented and is more difficult to use:
  https://github.com/git-for-windows/git/blob/c5a03b1e29c69f3f06c8fabd92493edb73469176/compat/winansi.c#L558

* Reline: Fix changed test results due to change to UTF-8 on Windows

In commit f8ea2860b0 the Reline encoding
for native windows console was changed to hardcoded UTF-8.
This caused failures in reline and readline tests, but they were hidden,
because parallel ruby tests incorrectly used Reline::ANSI as IOGate.
Tests failures were raised in single process mode, but not with -j switch.

This patch corrects encodings on native Windows console.

* [ruby/irb] [ruby/irb] Rewrite an expression to detect multiline

https://github.com/ruby/irb/commit/ed5cf375a6

https://github.com/ruby/irb/commit/5b7bbf9c34

* [ruby/reline] Implement vi_change_meta

https://github.com/ruby/reline/commit/8538e0e10f

* Always refer to Reline::IOGate.encoding

* Always use UTF-8 for Reline::GeneralIO on Windows

* Use test_mode on Reline::History::Test for encoding

* [ruby/reline] Support GNOME style Home/End key sequences [Bug #16510]

https://github.com/ruby/reline/commit/788f0df845

* [ruby/irb] Add a new easter egg: dancing ruby

https://github.com/ruby/irb/commit/e37dc7e58e

* [ruby/irb] Exclude useless files from RDoc

https://github.com/ruby/irb/commit/8f1ab2400c

* [ruby/irb] Exclude useless files from RDoc

* Fix inaccuracy in encoding tests

These tests assume
  Encoding.find('locale') == Encoding.find('external')
and fail if they are distinct.

* [ruby/reline] Fix Reline::Windows#scroll_down

I mistook Right and Bottom.

https://github.com/ruby/reline/commit/8be401c5f5

* [ruby/reline] Bypass cursor down when a char is rendered at eol on Windows

A newline is automatically inserted if a character is rendered at eol on
Windows command prompt.

https://github.com/ruby/reline/commit/4bfea07e4a

* [ruby/reline] Organize special keys escape sequences

https://github.com/ruby/reline/commit/41deb1a3d9

* [ruby/readline-ext] Remove unnecessary -I$(top_srcdir) when it's an individual gem

https://github.com/ruby/readline-ext/commit/efaca4a5f4

* [ruby/readline-ext] Check TestRelineAsReadline existance

https://github.com/ruby/readline-ext/commit/c0a6303168

* [ruby/readline-ext] The ruby/assert.h is adopted by Ruby 2.7 or later

https://github.com/ruby/readline-ext/commit/106c31fc1b

* 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.

* [ruby/readline-ext] Use require check instead of DONT_RUN_RELINE_TEST env

https://github.com/ruby/readline-ext/commit/1df99d1481

* [ruby/readline-ext] Add spec.extensions

https://github.com/ruby/readline-ext/commit/8c33abb13c

* [ruby/readline-ext] Use rake/extensiokntask to build

https://github.com/ruby/readline-ext/commit/b0b5f709bd

* Fix readline build dependency

* [ruby/irb] Add test_complete_symbol

https://github.com/ruby/irb/commit/dbbf086c1f

* [ruby/irb] Check doc namespace correctly

IRB::InputCompletor::PerfectMatchedProc crashes when doc not found because a
variable name was incorrect.

https://github.com/ruby/irb/commit/889fd4928f

* [ruby/irb] Fix auto indent with closed brace

A closed brace in auto-indent shouldn't affect the next brace in the same line,
but it behaves like below:

  p() {
    }

It's a bug.

https://github.com/ruby/irb/commit/fbe59e344f

* [ruby/irb] Use 0.step instead of (..0).each for Ruby 2.5

https://github.com/ruby/irb/commit/5d628ca40e

* Revert "[ruby/irb] Add test_complete_symbol"

This reverts commit 3af3431c2c.

* [ruby/irb] fix reserved words and completion for them

https://github.com/ruby/irb/commit/6184b227ad

* Add test_complete_symbol

The previous version of the test method used a symbol, ":abcdefg" to complete
but longer symbols that can be completed are defined by other test methods of
other libs.

* test/irb/test_completion.rb: suppress a warning: unused literal ignored

* [ruby/reline] Use IO#write instead of IO#print

IO#print always adds a string of $\ automatically.

https://github.com/ruby/reline/commit/a93119c847

* [ruby/irb] Version 1.2.2

https://github.com/ruby/irb/commit/a71753f15a

* [ruby/reline] Version 0.1.3

https://github.com/ruby/reline/commit/ea2b182466

* [ruby/irb] Include easter-egg.rb in gemspec

`irb` doesn't run because this file isn't included in the gem.
https://github.com/ruby/irb/commit/73cda56d25

* [ruby/irb] Version 1.2.3

https://github.com/ruby/irb/commit/dd56e06df5

* support multi-run test for test_readline.rb

* [ruby/irb] `yield` outside method definition is a syntax error

https://github.com/ruby/irb/commit/dbc7b059c7

* test/readline - allow ENV control of test class creation

In ruby/ruby, the tests run on both readline & reline by creating four test classes:
```
TestReadline
TestReadlineHistory

TestRelineAsReadline
TestRelineAsReadlineHistory
```

Reline inports the test files and uses them in its CI.  Adding the ENV control allows it to only run the `TestRelineAsReadline` classes.

* Omit test_using_quoting_detection_proc_with_multibyte_input temporarily for random order test

* support random order test.

test_readline:
  HISTORY should be empty.

test_using_quoting_detection_proc:
test_using_quoting_detection_proc_with_multibyte_input:
  Readline.completer_quote_characters= and
  Readline.completer_word_break_characters= doesn't accept nil,
  so skip if previous values are nil.

* Set Readline.completion_append_character = nil always

GNU Readline add a white space when Readline.completion_append_character is
not initialized.

* Fix a typo [ci skip]

* skip test if Reline.completion_proc is nil.

Some other tests can set Reline.completion_proc, so if it is nil,
simply skip this test.

* Reset Reline.point

TestRelineAsReadline#test_insert_text expects Readline.point == 0
at the beginning of the test, but a test violate this assumption.

* Convert incompatible encoding symbol names

* Ignore incompatible convert of symbols

* Add workaround for test-bundler failure

https://github.com/ruby/actions/runs/500526558?check_suite_focus=true#step:16:127
```
Failures:

  1) Bundler.setup when Bundler is bundled doesn't blow up
     Failure/Error: expect(err).to be_empty

       expected `"fatal: not a git repository (or any of the parent directories): .git\nfatal: not a git repository (o...the parent directories): .git\nfatal: not a git repository (or any of the parent directories): .git".empty?` to return true, got false

       Commands:
       $ /home/runner/work/actions/actions/snapshot-master/ruby \
         -I/home/runner/work/actions/actions/snapshot-master/lib:/home/runner/work/actions/actions/snapshot-master/spec/bundler \
         -rsupport/hax -rsupport/artifice/fail \
         /home/runner/work/actions/actions/snapshot-master/libexec/bundle install --retry 0
       Resolving dependencies...
       Using bundler 2.1.4
       Bundle complete! 1 Gemfile dependency, 1 gem now installed.
       Use `bundle info [gemname]` to see where a bundled gem is installed.
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       # $? => 0

       $ /home/runner/work/actions/actions/snapshot-master/ruby \
         -I/home/runner/work/actions/actions/snapshot-master/lib:/home/runner/work/actions/actions/snapshot-master/spec/bundler \
         -rsupport/hax -rsupport/artifice/fail \
         /home/runner/work/actions/actions/snapshot-master/libexec/bundle exec ruby -e \
         require\ \'bundler\'\;\ Bundler.setup
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       fatal: not a git repository (or any of the parent directories): .git
       # $? => 0
     # ./spec/bundler/runtime/setup_spec.rb:1056:in `block (3 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:111:in `block (3 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:111:in `block (2 levels) in <top (required)>'
     # ./spec/bundler/spec_helper.rb:78:in `block (2 levels) in <top (required)>'
make: *** [yes-test-bundler] Error 1
```

* [ruby/irb] Unnamed groups are not captured when named groups are used

https://github.com/ruby/irb/commit/0a641a69b0

* [ruby/reline] Work with wrong $/ value correctly

https://github.com/ruby/reline/commit/962ebf5a1b

* [ruby/irb] Detect multiple lines output simplify

The old implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    /\A.*\Z/ !~ ('abc' * 20_000_000)
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5868 MB
    62.226 MB

    real    0m1.307s
    user    0m0.452s
    sys     0m0.797s

The new implementation performance test code:

    require 'objspace'
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)
    ('abc' * 20_000_000).include?("\n")
    puts "%.5g MB" % (ObjectSpace.memsize_of_all * 0.001 * 0.001)

and run `time test.rb`:

    2.5861 MB
    62.226 MB

    real    0m0.132s
    user    0m0.088s
    sys     0m0.042s

https://github.com/ruby/irb/commit/40d6610baf

* [ruby/reline] Suppress error in case INPUTRC env is empty

https://github.com/ruby/reline/commit/bce7e7562b

* [ruby/reline] Add yamatanooroti rendering test

https://github.com/ruby/reline/commit/f092519525

* [ruby/reline] Rename test suite name of yamatanooroti test

https://github.com/ruby/reline/commit/b0f32f5de4

* [ruby/reline] Add a comment why rescue yamatanooroti loading error on the test

https://github.com/ruby/reline/commit/2a8061daec

* [ruby/irb] Suppress crashing when EncodingError has occurred without lineno

https://github.com/ruby/irb/commit/13572d8cdc

* [ruby/reline] Suppress error when check ambiguous char width in LANG=C

https://github.com/ruby/reline/commit/623dffdd75

* [ruby/io-console] Enable only interrupt bits on `intr: true`

https://github.com/ruby/io-console/commit/baaf929041

* [ruby/io-console] bump up to 0.5.4

* [ruby/io-console] Update the minimum requirement of Ruby version

https://github.com/ruby/io-console/commit/73e7b6318a

* [ruby/io-console] Filter Ruby engine name rather than just /ruby/

This breaks tests using this path on JRuby because the `jruby`
executable turns into `jjruby` after the sub.

https://github.com/ruby/io-console/commit/e5951aa34c

* [ruby/io-console] bump up to 0.5.5

* [ruby/io-console] Prefer keyword arguments

https://github.com/ruby/io-console/commit/5facbfc4c8

* [ruby/io-console] [DOC] Improved about `intr:`

https://github.com/ruby/io-console/commit/82b630cd79

* [ruby/io-console] Just ignore the extension on other than CRuby

https://github.com/ruby/io-console/commit/41b6f09574

* [ruby/io-console] bump up to 0.5.6

Co-authored-by: KOBAYASHI Shuji <shuujii@gmail.com>
Co-authored-by: Ben <kanobt61@gmail.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Co-authored-by: Kenta Murata <mrkn@mrkn.jp>
Co-authored-by: Lars Kanis <lars@greiz-reinsdorf.de>
Co-authored-by: Lars Kanis <kanis@comcard.de>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Nobuhiro IMAI <nov@yo.rim.or.jp>
Co-authored-by: Nick Lewis <nick@puppet.com>
Co-authored-by: S-H-GAMELINKS <gamelinks007@gmail.com>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Co-authored-by: Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
Co-authored-by: Charles Oliver Nutter <headius@headius.com>
2020-03-30 19:09:50 +09:00
Jean Boussier 47b08728cf [ruby/stringio] StringIO#initialize default to the source string encoding
[Bug #16497]

https://github.com/ruby/stringio/commit/4958a5ccab
(cherry picked from commit e257c08f2e)
2020-03-15 20:53:14 +09:00
Hiroshi SHIBATA fcaa00e58f Use osuosl instead of GitHub releases
Because the package provided by GitHub releases is different from sourceware.

(cherry picked from commit 47a1872cd8)
2020-03-13 22:23:12 +09:00
Hiroshi SHIBATA 6a2d779027 Switch to download libffi source package to github releases from sourceware.org
[Bug #16681]
(cherry picked from commit 8602216746)
2020-03-13 22:23:02 +09:00
Nobuyoshi Nakada 60d98fad86 [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
(cherry picked from commit 4e56ec4ef7)
2020-03-13 22:10:07 +09:00
Nobuyoshi Nakada 78cbe7106b Return the makefile content
Block for `create_makefile` is expected to return the content of
the makefile.
2020-02-13 14:07:14 +09:00
NARUSE, Yui b8e62ccaec Move .IGNORE in extconf.rb 2020-02-13 14:07:07 +09:00
NARUSE, Yui a89821243d Support nmake 2020-02-13 14:06:59 +09:00
NARUSE, Yui a930174d79 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-02-13 14:06:53 +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 NakadaandNARUSE, Yui 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