Commit graph

16449 commits

Author SHA1 Message Date
Bogdan Irimie
74ed881e10
[ruby/ipaddr] Add netmask method that returns net mask as string.
283d16f3a3
2021-10-07 18:22:43 +09:00
Jeremy Evans
abad5e10e8
[ruby/ipaddr] Disallow leading zeros in mask
f49d2d49a4
2021-10-07 18:22:43 +09:00
Nobuyoshi Nakada
38da84296c
[ruby/ipaddr] Raise if extra slashes follow
https://bugs.ruby-lang.org/issues/15832

de9805d6fa
2021-10-07 18:22:42 +09:00
Espartaco Palma
b23fba91ae [ruby/ipaddr] Removing superfluos assingments & return
Also adding test for ntop

0ba16cca10
2021-10-07 17:46:00 +09:00
Yusuke Endoh
273673aeaf test/ruby/test_process (test_no_curdir): tentatively skipped on Solaris
The test gets stuck on Solaris CI.

20211006T050007Z.fail.html.gz#test-all
```
[14558/21042] TestProcess#test_no_curdirtimeout: output interval exceeds 1800.0 seconds.
timeout: the process group 3857 is alive.
```

Related to ee89543e09
2021-10-07 10:40:40 +09:00
Jean Boussier
afcbb501ac marshal.c Marshal.load accepts a freeze: true option.
Fixes [Feature #18148]

When set, all the loaded objects are returned as frozen.

If a proc is provided, it is called with the objects already frozen.
2021-10-05 18:34:56 +02:00
aycabta
dc8fa2691b [ruby/reline] Reduce window size so that it can be displayed in my desktop
22359d50ab
2021-10-05 22:33:13 +09:00
aycabta
2c2a017fe8 [ruby/reline] Cyrillic chars are now forced to be displayed in full-width on Windows
So testing is no longer necessary.

c59589548b
2021-10-05 22:33:02 +09:00
Nobuyoshi Nakada
1f544d6715
Show the last line at unexpected end-of-input error 2021-10-05 16:44:43 +09:00
Jeremy Evans
ee89543e09 Fix regression on Solaris after change to use realpath on loaded features
After the change to use realpath on loaded features, Solaris CI
started failing in test_no_curdir (which tests behavior for running
ruby without a working directory).

I was able to trace the problem to the following call chain:

rb_call_inits->Init_Thread->Init_thread_sync->rb_provide->
get_loaded_features_index->rb_check_realpath->rb_dir_getwd_ospath->
ruby_getcwd

This will throw an exception, but because Ruby hasn't been fully
initialized at the point the exception is thrown, it just exits
with a status of 1.

The bug here is that rb_check_realpath should not raise an
exception, it should return nil.  This bug is hit on Solaris
because Solaris uses the realpath emulation instead of native
realpath, and the realpath emualation raised instead of
returning nil if the mode was RB_REALPATH_CHECK. Use rb_rescue
in the realpath emulation if the mode is RB_REALPATH_CHECK, and
swallow any exceptions raised and return nil.
2021-10-04 19:30:01 -09:00
Jeremy Evans
e4d85d3a2d Revert rescue around internal realpath call on Solaris
Solaris CI still has a problem even with these commits, so it doesn't
appear to fix the issue.  Reverting both 84e8e2a39b
and bfd2f159f0.
2021-10-04 10:51:52 -07:00
Jeremy Evans
3381fa5458 Only rescue realpath calls during require on Solaris
Remove temporary skip of test_no_curdir to see if this fixes the
problem.
2021-10-04 07:43:24 -09:00
Nobuyoshi Nakada
28392d3045
The same warning for static symbol literal 2021-10-04 12:16:31 +09:00
Nobuyoshi Nakada
da139317a5
Fix the warning message for dynamic symbol literal in condition 2021-10-04 12:16:31 +09:00
Nobuyoshi Nakada
19f9d9cf73 Remove extraneous conversion to float [Bug #18236] 2021-10-03 22:06:31 +09:00
aycabta
64e96d6b41 [ruby/reline] Re-calc the scroll pos when the content in dialog is shortened
12ea63e6e0
2021-10-03 21:51:02 +09:00
Nobuyoshi Nakada
ea64e742f5
Revert "mkmf.rb: try linking at try_var" [Bug #18235]
This reverts commit 524513be39,
which can return false positive by existing but unusable symbol,
including functions.
2021-10-03 18:23:39 +09:00
aycabta
d31279fe6f [ruby/reline] Add a test for rerendering arg prompt after pasting
5414a42b0e
2021-10-03 14:53:19 +09:00
aycabta
2a3d0fbe17 [ruby/reline] Add newlines for readability
2a60aacebb
2021-10-03 14:09:03 +09:00
aycabta
7c6ef27d6c [ruby/reline] Stop using Ctrl+j to test on Windows
Because Ctrl+j and Enter are the same on Windows.

fa885ed449
2021-10-03 14:08:38 +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
manga_osyo
b8327fb8b1 [ruby/reline] Refactoring Reline::Key.match? and add test.
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
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
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
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
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").

9183cc2e8b
2021-09-29 22:07:49 +09:00
Yusuke Endoh
be51f4ce83 [ruby/did_you_mean] Disable error_highlight when testing did_you_mean
Fixes #160

93df310873
2021-09-28 17:48:57 +09:00
Ellen Marie Dash
fcaa918445 [rubygems/rubygems] Only disallow FIXME/TODO for first word of gemspec description
7890c98 matched the start of each line, whereas this matches the start
of the entire string.

432de7b819
2021-09-28 17:43:42 +09:00
Jeremy Evans
f9f7f3a75e [ruby/date] Make %v strftime flag use uppercase month
%v is supposed to be the VMS date, and VMS date format uses an
uppercase month.

Ruby 1.8 used an uppercase month for %v, but the behavior was
changed without explanation in r31672.

Time#strftime still uses an uppercase month for %v, so this change
makes Date#strftime consistent with Time#strftime.

Fixes [Bug #13810]

56c489fd7e
2021-09-28 17:34:26 +09:00
Hiroshi SHIBATA
f6c3228794 [ruby/drb] Use omit instead of skip for test-unit
0da149e7a9
2021-09-28 17:31:08 +09:00
rm155
cefa029573 [ruby/ostruct] Allow properties to be accessed even when the object is moved to another Ractor (https://github.com/ruby/ostruct/pull/29)
d85639f2f5
2021-09-28 17:30:06 +09:00
aycabta
c4acde8959 [ruby/reline] Ignore NUL by ed_quoted_insert
43b7c01a98
2021-09-28 14:15:49 +09:00
John Bachir
1147136b8a [ruby/timeout] test that yield is given number of seconds
ec5a614334
2021-09-28 06:05:50 +09:00
Nobuyoshi Nakada
dfa67db62b
Show failed environment variables 2021-09-27 20:47:44 +09:00
John Bachir
582602d142 [ruby/timeout] test for basic functionality
1c6bb90aea
2021-09-27 13:22:46 +09:00
aycabta
40a65030e5 Pend test_complete_require_library_name_first 2021-09-24 22:56:38 +09:00
Lucas Kanashiro
61aedb28ef [rubygems/rubygems] Use pend instead of skip in the absence of git in test helper
798a93a98c
2021-09-24 10:57:27 +09:00
huangduirong
b1ab1ee046 [rubygems/rubygems] Fix error message building changing password of source
Do not change the password of the input parameter source during
anonymization, by using the proper helper instead of changing the
original uri directly.

eaa2dd8a97
2021-09-24 10:57:03 +09:00
Nobuyoshi Nakada
b929af430c Use the flag for uninitialized module [Bug #18185]
Make `Module#ancestors` not to include `BasicObject`.
2021-09-24 08:29:00 +09:00
Nobuyoshi Nakada
65285bf673 Consider modified modules initialized [Bug #18185] 2021-09-24 08:29:00 +09:00
Nobuyoshi Nakada
96c8964e0e
Revive the test using US-ASCII incompatible symbol 2021-09-23 22:04:19 +09:00
Nobuyoshi Nakada
ede95f541b [ruby/irb] Ignore any encoding errors while symbol completion
daa65cded1
2021-09-23 18:01:36 +09:00
Nobuyoshi Nakada
49af9012a2
Prohibit invalid encoding symbols [Bug #18184] 2021-09-23 16:02:44 +09:00
Nobuyoshi Nakada
552728a23a
Check the encoding of ruby2_keywords_flag [Bug #18184] 2021-09-23 00:07:17 +09:00
Kaíque Kandy Koga
782d1d876b [ruby/irb] Use typed spaces when the line is inside the here documents
Use first method instead of square brackets to support 2.5 and 2.6 versions

Use tokens

Clear check_newline_depth_difference

6fec2a5d46
2021-09-22 23:26:41 +09:00
Nobuyoshi Nakada
7c0230b05d
Check the entire name as ruby2_keywords_flag [Bug #18184] 2021-09-22 19:04:55 +09:00
Jonathan
13bb16f41e [rubygems/rubygems] Fix bug where redacted credentials are sent to server
Implement deep cloning for `Gem::Uri` class to fix a bug where redacting
credentials modifies the URI string in place instead of returning a
modified copy.

eafb5a279b
2021-09-22 10:14:48 +09:00