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

68318 Коммитов

Автор SHA1 Сообщение Дата
aycabta d31279fe6f [ruby/reline] Add a test for rerendering arg prompt after pasting
https://github.com/ruby/reline/commit/5414a42b0e
2021-10-03 14:53:19 +09:00
aycabta 95522ef8b9 [ruby/reline] Rerender whole buffer when argument editing finished
If the argument prompt disappears when pasting is finished, rerender the
whole buffer.

https://github.com/ruby/reline/commit/996bbf8797
2021-10-03 14:53:13 +09:00
aycabta bf0a8a7462 [ruby/reline] Call LineEditor#resize on Windows
https://github.com/ruby/reline/commit/65b27dd2ff
2021-10-03 14:27:33 +09:00
TOMITA Masahiro ef350b3a56 [ruby/reline] Simplify SIGWINCH handler to avoid aborting when resizing.
https://github.com/ruby/reline/commit/481add0537
2021-10-03 14:26:53 +09:00
aycabta 2a3d0fbe17 [ruby/reline] Add newlines for readability
https://github.com/ruby/reline/commit/2a60aacebb
2021-10-03 14:09:03 +09:00
aycabta 4401bbe8a7 [ruby/reline] Use String#unpack1
https://github.com/ruby/reline/commit/179c52bca8
2021-10-03 14:08:55 +09:00
aycabta a2d2f00e4a [ruby/reline] Adjust border of scrollbar rendering calculation
https://github.com/ruby/reline/commit/737b23beae
2021-10-03 14:08:49 +09:00
aycabta 1d2edda9f8 [ruby/reline] The @block_elem_width shouldn't be used for height calculation
https://github.com/ruby/reline/commit/da35902d78
2021-10-03 14:08:45 +09:00
aycabta 7c6ef27d6c [ruby/reline] Stop using Ctrl+j to test on Windows
Because Ctrl+j and Enter are the same on Windows.

https://github.com/ruby/reline/commit/fa885ed449
2021-10-03 14:08:38 +09:00
Nobuyoshi Nakada ff480f2953
Cast to void pointer to suppress -Wformat-pedantic in RUBY_DEBUG_LOG 2021-10-03 13:59:48 +09:00
Rei Odaira ceeae31901 Avoid using the altzone variable in AIX
In AIX, altzone exists in the standard library but is not declared
in time.h.  By 524513be39, have_var
and try_var in mkmf recognizes a variable that exists in a library
even when it is not declared.  As a result, in AIX, HAVE_ALTZONE
is defined, but compile fails due to the lack of the declaration.
2021-10-02 21:23:34 -05:00
mitsu-ksgr 2962c421e1
[DOC] fix small mistake in doc/marshal.rdoc [ci skip] 2021-10-03 11:09:08 +09:00
xtkoba c5ff954410 Get rid of unused function warning for `_WIN32` 2021-10-03 11:06:24 +09:00
git 842673240b * 2021-10-03 [ci skip] 2021-10-03 08:05:00 +09:00
Jeremy Evans 4f65e6ce2a Temporarily skip test_no_curdir test to avoid CI failures on Solaris 2021-10-02 15:55:13 -07:00
Jeremy Evans 79a4484a07 Do not load file with same realpath twice when requiring
This fixes issues with paths being loaded twice in certain cases
when symlinks are used.

It took me multiple attempts to get this working.  My original
attempt tried to convert paths to realpaths before adding them
to $LOADED_FEATURES.  Unfortunately, this doesn't work well
with the loaded feature index, which is based off load paths
and not realpaths. While I was able to get require working, I'm
fairly sure the loaded feature index was not being used as
expected, which would have significant performance implications.
Additionally, I was never able to get that approach working with
autoload when autoloading a non-realpath file. It also broke
some specs.

This takes a more conservative approach. Directly before loading the
file, if the file with the same realpath has been required, the
loading of the file is skipped. The realpaths are stored as
fstrings in a hidden hash.

When rebuilding the loaded feature index, the hash of realpaths
is also rebuilt.  I'm guessing this makes rebuilding process
slower, but I don think that is a hot path. In general, modifying
loaded features is only done when reloading, and that tends to be
in non-production environments.

Change test_require_with_loaded_features_pop test to use 30 threads
and 300 iterations, instead of 4 threads and 1000 iterations.
I saw only sporadic failures with 4/1000, but consistent failures
30/300 threads. These failures were due to the fact that the
concurrent deletions from $LOADED_FEATURES in other threads can
result in rb_ary_entry returning nil when rebuilding the loaded
features index.

To avoid concurrency issues when rebuilding the loaded features
index, the building of the index itself is left alone, and
afterwards, a separate loop is done on a copy of the loaded feature
snapshot in order to rebuild the realpaths hash.

Fixes [Bug #17885]
2021-10-02 05:51:29 -09:00
Jeremy Evans 3f7da458a7 Make encoding loading not issue warning
Instead of relying on setting an unsetting ruby_verbose, which is
not thread-safe, restructure require_internal and load_lock to
accept a warn argument for whether to warn, and add
rb_require_internal_silent to require without warnings.  Use
rb_require_internal_silent when loading encoding.

Note this does not modify ruby_debug and errinfo handling, those
remain thread-unsafe.

Also silent requires when loading transcoders.
2021-10-02 05:51:29 -09:00
Nobuyoshi Nakada e0ef4899f3 [Win32] Prefer Cryptography Next Generation API
[BCryptGenRandom] is available since Windows Vista / Windows
Server 2008.

Regarding [CryptGenRandom]:
> This API is deprecated. New and existing software should start
> using Cryptography Next Generation APIs. Microsoft may remove
> this API in future releases.

[BCryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
[CryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
2021-10-02 21:22:33 +09:00
manga_osyo b8327fb8b1 [ruby/reline] Refactoring Reline::Key.match? and add test.
https://github.com/ruby/reline/commit/90e8999ae4
2021-10-02 19:58:41 +09:00
Jeremy Evans abc0304cb2 Avoid race condition in Regexp#match
In certain conditions, Regexp#match could return a MatchData with
missing captures.  This seems to require at the least, multiple
threads calling a method that calls the same block/proc/lambda
which calls Regexp#match.

The race condition happens because the MatchData is passed from
indirectly via the backref, and other threads can modify the
backref.

Fix the issue by:

1. Not reusing the existing MatchData from the backref, and always
   allocating a new MatchData.
2. Passing the MatchData directly to the caller using a VALUE*,
   instead of indirectly through the backref.

It's likely that variants of this issue exist for other Regexp
methods.  Anywhere that MatchData is passed implicitly through
the backref is probably vulnerable to this issue.

Fixes [Bug #17507]
2021-10-01 19:50:19 -09:00
Nobuyoshi Nakada d087214658 Restore Hash#compare_by_identity mode [Bug #18171] 2021-10-02 11:43:35 +09:00
Nobuyoshi Nakada 806e7947fe Add rb_ident_hash_new_with_size 2021-10-02 11:43:35 +09:00
Nobuyoshi Nakada 601c67e42c
Suppress maybe-uninitialized warning on mingw
The compilation time pragma seems not applied to inline functions
expanded by the link time optimization.  The local variable `mi`
in thread_win32.c:native_thread_init_stack is warned.
2021-10-02 08:02:57 +09:00
Burdette Lamar 8c10fd2583
Enhanced RDoc for Enumerable (#4922)
Treated:

    #drop
    #drop_while
    #cycle
2021-10-01 17:51:39 -05:00
Burdette Lamar 27d9935d51
Enhanced RDoc for Enumerable (#4918)
Treats:

    #zip
    #take
    #take_while
2021-10-01 13:44:28 -05:00
git eaeb0a008b * 2021-10-02 [ci skip] 2021-10-02 02:13:05 +09:00
Jeremy Evans e8d6076fbd Fix typo in static function name 2021-10-01 08:12:46 -09:00
Jeremy Evans 9b04909a85 Introduce rb_vm_call_with_refinements to DRY up a few calls 2021-10-01 08:12:46 -09:00
Nobuyoshi Nakada 0ad3ed5e0e
Checks for CPU specific header on universal build 2021-10-01 20:30:10 +09:00
Nobuyoshi Nakada c7414f517f
Prefer `printf` like the recent autoconf 2021-10-01 20:30:10 +09:00
Nobuyoshi Nakada 3e46117d3f Associate the encoding to the found path 2021-10-01 20:28:44 +09:00
Nobuyoshi Nakada 842b0008c1 Skip broken strings as the locale encoding 2021-10-01 20:28:44 +09:00
Nobuyoshi Nakada 409dbc951b Replace expanded load path only when modified 2021-10-01 20:28:44 +09:00
Nobuyoshi Nakada b6534691a1 Copy path strings as interned strings 2021-10-01 20:28:44 +09:00
Nobuyoshi Nakada 60d0421ca8 Fix the encoding of loaded feature names [Bug #18191]
The feature names loaded from the default load paths should also
be in the file system encoding.
2021-10-01 20:28:44 +09:00
Kazuhiro NISHIYAMA 8e9d696ed0 Use macos-11 instead of macos-latest 2021-10-01 11:14:02 +09:00
Kazuhiro NISHIYAMA 77804be457 Use macos-10.15 and macos-11 instead of macos-latest
https://github.blog/changelog/2021-09-29-github-actions-jobs-running-on-macos-latest-are-now-running-on-macos-big-sur-11/
2021-10-01 11:14:02 +09:00
Nobuyoshi Nakada ca3cc677b3
Define ACTION-IF-UNIVERSAL of `AC_C_BIGENDIAN` [Bug #18156]
As we do not use config.h.in, just define the helper macro
instead.
2021-10-01 10:56:11 +09:00
Jeremy Evans 1f5f8a187a
Make Array#min/max optimization respect refined methods
Pass in ec to vm_opt_newarray_{max,min}. Avoids having to
call GET_EC inside the functions, for better performance.

While here, add a test for Array#min/max being redefined to
test_optimization.rb.

Fixes [Bug #18180]
2021-09-30 15:18:14 -07:00
Burdette Lamar a55a5fc684
Enhanced RDoc for Enumerable (#4917)
Treats:

    #each_with_index
    #reverse_each
    #each_entry
    #each_slice
    #each_cons
    #each_with_object
2021-09-30 15:46:54 -05:00
git 40ef034599 * 2021-10-01 [ci skip] 2021-10-01 05:07:10 +09:00
John Hawthorn bb488a1a7f Use faster any_hash logic in rb_hash
From the documentation of rb_obj_hash:

> Certain core classes such as Integer use built-in hash calculations and
> do not call the #hash method when used as a hash key.

So if you override, say, Integer#hash it won't be used from rb_hash_aref
and similar. This avoids method lookups in many common cases.

This commit uses the same optimization in rb_hash, a method used
internally and in the C API to get the hash value of an object. Usually
this is used to build the hash of an object based on its elements.
Previously it would always do a method lookup for 'hash'.

This is primarily intended to speed up hashing of Arrays and Hashes,
which call rb_hash for each element.

    compare-ruby: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
    built-ruby: ruby 3.1.0dev (2021-09-29T02:13:24Z fast_hash d670bf88b2) [x86_64-linux]
    # Iteration per second (i/s)

    |                 |compare-ruby|built-ruby|
    |:----------------|-----------:|---------:|
    |hash_aref_array  |       1.008|     1.769|
    |                 |           -|     1.76x|
2021-09-30 13:06:53 -07:00
Jean byroot Boussier 529fc204af
marshal.c: don't call the proc with partially initialized objects. (#4866)
For cyclic objects, it requires to keep a st_table of the partially
initialized objects.
2021-09-30 16:50:31 +02:00
Nobuyoshi Nakada 912a8dcfc5
Needs `AC_PROG_CC`
Although `AC_PROG_CC_C99` has been obsolete, `AC_PROG_CC` is not
and the latter is necessary not to make C++ compiler mandatory.
2021-09-30 19:22:08 +09:00
卜部昌平 90f2ab9d62 rb_fiber_raise(): add doxygen
Must not be a bad idea to improve documents.
2021-09-30 20:55:23 +13:00
git 565649cfe8 * 2021-09-30 [ci skip] 2021-09-30 08:04:49 +09:00
Burdette Lamar 49edaa061f
Enhanced RDoc for Enumerable (#4910)
Treats:

    #min
    #max
    #minmax
    #min_by
    #max_by
    #minmax_by
    #include?
2021-09-29 18:04:29 -05:00
Nobuyoshi Nakada bbf98b572e
lldb: Get rid of error at unpreserved encodings [ci skip] 2021-09-29 22:31:24 +09:00
aycabta 5eb8b6d1bd [ruby/reline] Support ed_argument_digit by M+num
The vi mode can handle "argument number" before an operator or a motion,
such as, "3x" (equals "xxx"), and "3l" (equals "lll"). In the emacs
mode, GNU Readline can handle argument number with meta key, like
"Meta+3 x" (equals "xxx").

https://github.com/ruby/reline/commit/9183cc2e8b
2021-09-29 22:07:49 +09:00
Burdette Lamar 0182bf615a
Enhanced RDoc for Enumerable (#4908)
Treated:

    #none?
    #one?
    #min
2021-09-28 18:20:58 -05:00