Commit graph

16449 commits

Author SHA1 Message Date
Nobuyoshi Nakada
79af8ce6d7 [ruby/irb] Colorize __END__ as keyword
9b84018311
2021-04-02 10:52:53 +09:00
Koichi Sasada
ecfa8dcdba fix return from orphan Proc in lambda
A "return" statement in a Proc in a lambda like:
  `lambda{ proc{ return }.call }`
should return outer lambda block. However, the inner Proc can become
orphan Proc from the lambda block. This "return" escape outer-scope
like method, but this behavior was decieded as a bug.
[Bug #17105]

This patch raises LocalJumpError by checking the proc is orphan or
not from lambda blocks before escaping by "return".

Most of tests are written by Jeremy Evans
https://github.com/ruby/ruby/pull/4223
2021-04-02 09:25:33 +09:00
Koichi Sasada
1ac68bba4e [ruby/irb] SIGINT should raise Interrupt after IRB session
5832cfe75b
2021-04-02 01:57:44 +09:00
Nobuyoshi Nakada
ccb0b7ab7d [ruby/irb] Suppress verbose messages in the parallel test
`:VERBOSE` flag needs to be set prior to `IRB::Irb.new`.

78604682d9
2021-04-02 01:47:58 +09:00
Nobuyoshi Nakada
2a02b61fae
Use EnvUtil.under_gc_stress 2021-03-31 22:14:15 +09:00
Koichi Sasada
1fac99afda skip marking for uninitialized imemo_env.
RUBY_INTERNAL_EVENT_NEWOBJ can expose uninitialized imemo_env
objects and marking it will cause critical error. This patch
skips marking on uninitialized imemo_env.

See: 20210329T183003Z.fail.html.gz

Shortest repro-code is provided by mame-san.
2021-03-31 19:18:32 +09:00
Kazuki Yamaguchi
e2bf3659e1 [ruby/openssl] pkcs7: keep private key when duplicating PKCS7_SIGNER_INFO
ASN1_dup() will not copy the 'pkey' field of a PKCS7_SIGNER_INFO object
by design; it is a temporary field kept until the PKCS7 structure is
finalized. Let's bump reference counter of the pkey in the original
object and use it in the new object, too.

This commit also removes PKCS7#add_signer's routine to add the
content-type attribute as a signed attribute automatically. This
behavior was not documented or tested. This change should not break any
working user code since the method was completely useless without the
change above.

20ca7a27a8
2021-03-31 18:05:07 +09:00
Nobuyoshi Nakada
5cdf99f64e
mkmf: fixed install directories of header files in extension libraries [Bug #17761]
When installing an extension library which provides a header, that
header should be installed under site_ruby (or vendor_ruby when
"--vendor" option was given to extconf.rb).  However, currently
this file is about to be installed in the core include directory.
2021-03-30 23:28:49 +09:00
Samuel Williams
611e711085 Test incorrect behaviour of rb_io_wait_readable/writable. 2021-03-30 23:16:59 +13:00
Samuel Williams
92449e0e99 Fix handling of timeout accessing scheduler outside of non-blocking context. 2021-03-30 18:38:42 +13:00
Samuel Williams
af1c587546 Improve timeout tests. 2021-03-30 18:38:42 +13:00
Samuel Williams
511acba4ae Update method name and add documentation. 2021-03-30 18:38:42 +13:00
Samuel Williams
4c53dc970b Add hook for Timeout.timeout. 2021-03-30 18:38:42 +13:00
Jeremy Evans
62e66aedb0 Add more tests for defined? with method calls 2021-03-29 07:45:15 -07:00
Nobuyoshi Nakada
e8317d90b0
[ruby/optparse] Fixed error message of unparsed non-option
Close https://github.com/ruby/optparse/issues/3

94c5cf4032
2021-03-29 19:37:24 +09:00
Jeremy Evans
eca8ffaa0b
[ruby/optparse] Add OptionParser#require_exact accessor
This allows you to disable allowing abbreviations of long options
and using short options for long options.

Implements Ruby Feature #11523

dfefb2d2e2
2021-03-29 15:55:41 +09:00
aycabta
a1938ec308 [ruby/irb] Always add input method when calling Irb.new in tests
When passes input method as nil to Context.new through Irb.new,
ReidlineInputMethod.new is executed and the global internal state of Reline is
rewritten, therefore other tests are failed in the Ruby repository. This
commit changes to use TestInputMethod.

010dce9210
2021-03-29 05:10:08 +09:00
Kenichi Kamiya
9af57eeed6
[ruby/pathname] Fix segfault of Pathname#split
Fix segmentation fault of Pathname#split when File.split returns
non array value [Bug #17755]

e29b49e3b1
1db7479a74
2021-03-28 14:04:10 +09:00
Hiroshi SHIBATA
447e095413
[ruby/pathname] Support Ruby 3.0
Update test/pathname/test_pathname.rb

29645187e0
78584864de

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-03-28 14:03:42 +09:00
Kenichi Kamiya
31e0382723
Keep non evaluated keys in Hash#transform_keys! [Bug #17735] 2021-03-28 09:14:57 +09:00
Kenichi Kamiya
0a544c0c35
Fix segmentation fault when Module#name returns non string value [Bug #17754]
* Add test for NoMethodError#to_s does not segfault

* Ensure no segfault even if Module#name is overridden
2021-03-28 08:47:42 +09:00
Kenichi Kamiya
aceb8c0b4b
Fix Enumerable#tally with some arguments pattern [Feature #17744]
* Add test cases for Enumerable#tally with hash argument

* Add ruby/spec for Enumerable#tally with hash argument

* Fix Enumerable#tally does not update given frozen hash

* Add test cases for Enumerable#tally with hash convertible arguments

* Fix SEGV when Enumerable#tally takes non Hash convertible

* FIx cosmetic damage enum.c
2021-03-27 12:55:46 +09:00
Nobuyoshi Nakada
8a89dd2a6c
No codesign in tests 2021-03-27 10:15:01 +09:00
Nobuyoshi Nakada
9143d21b1b
Enumerable#tally with the resulting hash [Feature #17744] 2021-03-26 16:29:21 +09:00
aycabta
ad8842c06d [ruby/irb] Cache completion files to require
612ebcb311
2021-03-25 18:54:02 +09:00
Peter Zhu
b25361f731 Change heap walking to be safe for object allocation 2021-03-24 14:31:10 -04:00
Jeremy Evans
f9f13a4f6d Ensure that caller respects the start argument
Previously, if there were ignored frames (iseq without pc), we could
go beyond the requested start frame.  This has two changes:

1) Ensure that we don't look beyond the start frame by using
last_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(last_cfp) until the
desired start frame is reached.

2) To fix the failures caused by change 1), which occur when a
limited number of frames is requested, scan the VM stack before
allocating backtrace frames, looking for ignored frames. This
is complicated if there are ignored frames before and after
the start, in which case we need to scan until the start frame,
and then scan backwards, decrementing the start value until we
get to the point where start will result in the number of
requested frames.

This fixes a Rails test failure.  Jean Boussier was able to
to produce a failing test case outside of Rails.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2021-03-24 11:15:00 -07:00
Nobuyoshi Nakada
2dcbc6ef96
[ruby/irb] fix completion test when out-of-place build 2021-03-24 16:10:27 +09:00
aycabta
89caf51d93 [ruby/reline] Suppress crashing when completer_{quote,word_break}_characters is empty
c6f1164942
2021-03-24 15:43:34 +09:00
aycabta
758f2b35f9 [ruby/reline] Support preposing and postposing for Reline.completion_proc
1f469de90c
2021-03-24 15:43:27 +09:00
aycabta
4b33d860e8 [ruby/reline] Reline.delete_text removes the current line in multiline
da90c094a1
2021-03-24 15:43:19 +09:00
aycabta
0927756e58 [ruby/irb] Complete require and require_relative
1c61178b4c
2021-03-24 15:11:41 +09:00
aycabta
0259ee6008 [ruby/irb] Change ripper_lex_without_warning to a class method
d9f8abc17e
2021-03-24 14:39:50 +09:00
Peter Zhu
850448abd5 Fix leaked file descriptor in passwd test 2021-03-24 13:02:54 +09:00
Nobuyoshi Nakada
607aa11711
Ignore useless separators preceding a file encoding comment 2021-03-23 17:20:19 +09:00
Nobuyoshi Nakada
a58f9aa350
Assertion for colon-separated encoding pragma 2021-03-23 16:44:55 +09:00
Nobuyoshi Nakada
c83bd2a5ea
Refined failure messages in TestFileExhaustive#test_test 2021-03-23 16:32:55 +09:00
Yusuke Endoh
81d52978d0 test/zlib/test_zlib.rb: stop a failure on armv7l
The platform defines a constant File::TMPFILE, but it seems unavailable
(maybe depending on the file system?).

20210322T171707Z.fail.html.gz

This change adds some rescue cluases to the test, copied from
test/ruby/test_file.rb.
2021-03-23 12:20:58 +09:00
Yusuke Endoh
17550c6400 test/ruby/test_fiber.rb: relax timeout on Solaris
... of test_many_fibers_with_threads because the test seems to take
about 180 sec. on Solaris. This change extends the limit to 300 sec on
Solaris.
BTW, 180 sec. is too long for other normal environments, so this reverts
Related to 6ab7d439f8 for them.
2021-03-23 12:20:44 +09:00
Nobuyoshi Nakada
4bc09c9696
Suppress verbose messages
Get rid of warnings in the parallel test.

```
unknown command: "Switch to inspect mode."
```
2021-03-23 08:20:02 +09:00
Jean Boussier
7e8a9af9db rb_enc_interned_str: handle autoloaded encodings
If called with an autoloaded encoding that was not yet
initialized, `rb_enc_interned_str` would crash with
a NULL pointer exception.

See: https://github.com/ruby/ruby/pull/4119#issuecomment-800189841
2021-03-22 21:37:48 +09:00
Kenichi Kamiya
7d3fdfb27d
Hash#transform_values! ensures receiver modifiable in block [Bug #17736] 2021-03-22 14:10:52 +09:00
Takashi Kokubun
450d1f2c5c [ruby/irb] Deal with different screen sizes
e.g. 20210321T063003Z.fail.html.gz

ddb3472ba2
2021-03-21 15:57:10 +09:00
Kazuki Tsujimoto
21863470d9
Pattern matching pin operator against expression [Feature #17411]
This commit is based on the patch by @nobu.
2021-03-21 15:14:31 +09:00
Takashi Kokubun
232433f224 [ruby/irb] Add whereami command
bc822e4aac
2021-03-21 13:40:21 +09:00
Takashi Kokubun
5f72962a09 [ruby/irb] Implement ls command
19b6c20604
2021-03-21 12:59:51 +09:00
Nobuyoshi Nakada
d36ac283d1
Ensure the receiver hash modifiable before updating [Bug #17736]
Close https://github.com/ruby/ruby/pull/4298
2021-03-21 10:07:24 +09:00
Kenichi Kamiya
d319eb602d
Add Hash#{update, merge!} test to ensure receiver modifiable in block 2021-03-21 09:38:35 +09:00
Kenichi Kamiya
7954bb056b Some Hash destructive methods ensure the receiver modifiable [Bug #17736]
refs:

* https://bugs.ruby-lang.org/issues/17736
* https://github.com/ruby/ruby/pull/4296

This commit aims to cover following methods

* Hash#select!
* Hash#filter!
* Hash#keep_if
* Hash#reject!
* Hash#delete_if

I think these are not all.

---

* Ensure the receiver is modifiable or not
* Assert the receiver is not modified
2021-03-20 20:46:15 +09:00
Takashi Kokubun
278522f053 [ruby/irb] Don't call Ruby 2.4+'s String#pretty_print
89bcf107be
2021-03-20 20:25:32 +09:00