Commit graph

16692 commits

Author SHA1 Message Date
なつき
aded6971ad [rubygems/rubygems] Support non gnu libc arm-linux-eabi platforms
394d7a6fc9
2022-09-01 15:01:40 +09:00
Nobuyoshi Nakada
576bdec03f [Bug #18973] Promote US-ASCII to ASCII-8BIT when adding 8-bit char 2022-08-31 17:27:59 +09:00
David Rodríguez
b98653f766 [rubygems/rubygems] Let Dir.tmpdir use the standard path
We're not fully in control of this folder, even when running our own
tests, because MJIT creates some temp folders there when invoking GC.

This bite tests running in ruby-core when making the behavior of
`FileUtils.rm_rf` more strict, because these extra files could not be
removed.

Since this was originally added due to some failures on systems with non
standard permissions on tmp folders, but I can no longer reproduce
those, I'll remove it.

d2f21596ee
2022-08-30 18:46:06 +09:00
Takashi Kokubun
232e43fd52 Respect RUBY_TESTOPTS on test-all (https://github.com/Shopify/ruby/pull/435)
* Respect RUBY_TESTOPTS on test-all

* Increase the Cirrus timeout

* Increase the CSV test timeout
2022-08-29 09:09:41 -07:00
Alan Wu
ea9ee31744 A64 Linux reports aarach64 in RUBY_PLATFORM
This should fix a version string test
2022-08-29 09:09:41 -07:00
Takashi Kokubun
dca5e74aa1
Fix test_rubyoptions.rb for arm64 (https://github.com/Shopify/ruby/pull/396) 2022-08-29 08:47:10 -07:00
Yusuke Endoh
4bc782ed87 Revert "Chect what remains in TMPDIR"
This reverts commit 7bdb999d0f.

I think I confirmed the mechanism. GCC (invoked by MJIT) creates a
temporary file in TMPDIR, which prevents rm_rf from removing the
directory.
2022-08-29 20:23:51 +09:00
Yusuke Endoh
7bdb999d0f Chect what remains in TMPDIR
I guess it has a shared library file created by MJIT, but I want to make
sure the fact.
2022-08-29 12:50:47 +09:00
Nobuyoshi Nakada
ace2eee544
[Bug #18963] Separate string contents by here document terminator 2022-08-28 09:29:24 +09:00
Takashi Kokubun
111b69e8a0
Pass wait: false to avoid a timeout 2022-08-27 15:47:18 -07:00
Takashi Kokubun
95d2d7920c
Try to prevent the failure of FileUtils.rm_rf 2022-08-27 12:05:45 -07:00
Takashi Kokubun
458d49a04a
Ignore rm -rf failure
http://ci.rvm.jp/results/trunk-mjit@phosphorus-docker/4213386

It's failing with:
rm: cannot remove '/tmp/ruby/v3/build/trunk-mjit/tmp/test_rubygems_20220827-13666-ii8lcp': Directory not empty
rm: cannot remove '/tmp/ruby/v3/build/trunk-mjit/tmp/test_rubygems_20220827-13666-fy77y1': Directory not empty

I'd like to make sure the following `ENV.replace` is called and see if
there's any other issues.
2022-08-27 10:22:30 -07:00
Takashi Kokubun
13d2225c46
Try rm -rf instead of FileUtils.rm_rf
FileUtils.rm_rf started to randomly fail on http://ci.rvm.jp/results/trunk-mjit@phosphorus-docker
since around https://github.com/ruby/fileutils/pull/99.
2022-08-26 23:35:45 -07:00
Takashi Kokubun
d6f21b308b
Convert catch_except_t to stdbool
catch_excep_t is a field that exists for MJIT. In the process of
rewriting MJIT in Ruby, I added API to convert 1/0 of _Bool to
true/false, and it seemed confusing and hard to maintain if you
don't use _Bool for *_p fields.
2022-08-25 23:00:19 -07:00
Jeremy Evans
21cac42385 Raise ArgumentError for IO.foreach with limit of 0
Makes behavior consistent with IO.readlines.

Fixes [Bug #18767]
2022-08-25 13:36:17 -07:00
Takashi Kokubun
881bc2a176
Skip running a DRb test on MinGW
It hangs even after a retry
7966439530

We contacted GitHub Suppport about this before, and we concluded that
the problem is on our end. Unfortunately we don't have a bandwidth to
fix this MinGW problem, so until we get to work on it, this should be
just skipped to avoid a sporadic CI timeout.
2022-08-25 11:37:39 -07:00
Takashi Kokubun
af9fa16c96
Make sure super is called and fix teardown 2022-08-25 11:31:16 -07:00
Takashi Kokubun
52560a9263
Skip flaky mkmf tests on AppVeyor
It seems like TestMkmfTryConstant started to randomly fail, maybe
related to 96562a517d or 073f3b7e0a.

Some of them seem to have failed even after retries, so it feels like
there's a bug in the implementation, which leaves an unrecoverable situation.
44559958/job/7uub5bmkvy4pwwl8
44579924/job/n81xmb2mqs6no7dm
44558471/job/s4qwymmlxmfjjd35

Until we figure out what it is, I'd like to stabilize the CI by not
running it.
2022-08-25 11:11:16 -07:00
Yusuke Endoh
314b76a567 test/-ext-/eval/test_eval.rb: Prevent "assigned but unused variable" 2022-08-24 10:36:17 +09:00
Yusuke Endoh
983115cf3c [ruby/fileutils] FileUtils.rm* methods swallows only Errno::ENOENT when force is true
... instead of any StandardError.

To behave like the standard `rm` command, it should only ignore
exceptions about not existing files, not every exception. This should
make debugging some errors easier, because the expectation is that `rm
-rf` will succeed if and only if, all given files (previously existent
or not) are removed. However, due to this exception swallowing, this is
not always the case.

From the `rm` man page

> COMPATIBILITY
>
> The rm utility differs from historical implementations in that the -f
> option only masks attempts to remove non-existent files instead of
> masking a large variety of errors.

fa65d676ec

Co-Authored-By: David Rodríguez <deivid.rodriguez@riseup.net>
2022-08-23 16:52:41 +09:00
Yusuke Endoh
96562a517d [ruby/fileutils] Narrow the scope of ensure
The ensure in postorder_traverse was added for [Bug #6756].
The intention was to try to delete the parent directory if it failed to
get the children. (It may be possible to delete the directory if it is
empty.)

However, the ensure region rescue'ed not only "failure to get children"
but also "failure to delete each child". Thus, the following raised
Errno::ENOTEMPTY, but we expect it to raise Errno::EACCES.

```
$ mkdir foo
$ touch foo/bar
$ chmod 555 foo
$ ruby -rfileutils -e 'FileUtils.rm_rf("foo")'
```

This changeset narrows the ensure region so that it rescues only
"failure to get children".

ec5d3b84ea
2022-08-23 16:52:40 +09:00
Yusuke Endoh
073f3b7e0a [ruby/fileutils] Fix the test permission of "test_rm_rf"
The test was added for [Bug #6756]. The ticket insisted
`FileUtils.rm_rf` should delete an empty directory even if its
permission is 000. However, the test tried to delete a directory with
permission 700.

d6c2ab2c01
2022-08-23 16:52:39 +09:00
Hiroshi SHIBATA
892fe9bbba
omit all assertions at TestIO_Console#test_intr when running with FreeBSD 2022-08-23 12:49:46 +09:00
David Rodríguez
59f27445ea [rubygems/rubygems] Implement extra rules for libc versioning
7e976d790a
2022-08-23 05:50:23 +09:00
David Rodríguez
492e70c7b4 [rubygems/rubygems] Fix gem install still choosing musl incorrectly
1b9f7f50a5
2022-08-23 05:50:22 +09:00
David Rodríguez
06ae78f8fb [rubygems/rubygems] Remove unnecessary variables
b5e0c683d9
2022-08-23 05:50:22 +09:00
David Rodríguez
9819283044 [rubygems/rubygems] Handle non-gnu libc on linux platforms in RubyGems
Attempting to install a gem published as both *-linux and *-linux-musl
results in the incorrect gem being picked up, causing build failures due
to binary incompatibility. This is caused by the `nil` wildcard
swallowing the libc information upon version comparison.

Handle the linux case by performing only non-wildcard equality on the
version and asserting 'gnu' and nil equivalence, while preserving the
current behaviour for other OSes.

9eead86abc

Co-authored-by: Loic Nageleisen <loic.nageleisen@gmail.com>
2022-08-23 05:50:21 +09:00
Loic Nageleisen
f254b673f8 [rubygems/rubygems] Test platform parsing stability
On past versions there were observed cases of inconsistencies when some
platforms were re-parsed.

Ensure that a platform's string representation parses again in a
platform object equal to the original.

6da35ee93c
2022-08-23 05:50:20 +09:00
dependabot[bot]
085790bdc0 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.29 to 0.9.30.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.29...v0.9.30)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

912da7828e
2022-08-23 04:40:29 +09:00
dependabot[bot]
a9ee13365a [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.29 to 0.9.30.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.29...v0.9.30)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

d54c936c4c
2022-08-23 02:26:16 +09:00
Nobuyoshi Nakada
d5f50463c2
[Bug #18937] Coerce non-Numeric into Complex at comparisons 2022-08-22 12:26:43 +09:00
David Rodríguez
70f69f8539 [ruby/fileutils] Fix mkdir_p hanging on Windows when trying to create a file on a offline drive
9cc6a082d7
2022-08-22 10:12:25 +09:00
Nobuyoshi Nakada
0cc989696e
Add invalid hexadecimal float tests 2022-08-21 20:01:27 +09:00
Takashi Kokubun
ddf96b7693
Drop mswin support of MJIT (#6265)
The current MJIT relies on SIGCHLD and fork(2) to be performant, and
it's something mswin can't offer. You could run Linux MJIT on WSL
instead.

[Misc #18968]
2022-08-20 18:35:36 -07:00
Benoit Daloze
209631a45f Consider resolved-through-zsuper methods equal for compatibility
* Fixes https://bugs.ruby-lang.org/issues/18751
2022-08-20 13:44:00 +02:00
Jeremy Evans
8212aab81a Make Object#method and Module#instance_method not skip ZSUPER methods
Based on c95e7e5329

Among other things, this fixes calling visibility methods (public?,
protected?, and private?) on them.  It also fixes #owner to show the
class the zsuper method entry is defined in, instead of the original
class it references.

For some backwards compatibility, adjust #parameters and #source_location,
to show the parameters and source location of the method originally
defined. Also have the parameters and source location still be shown
by #inspect.

Clarify documentation of {Method,UnboundMethod}#owner.

Add tests based on the description of https://bugs.ruby-lang.org/issues/18435
and based on https://github.com/ruby/ruby/pull/5356#issuecomment-1005298809

Fixes [Bug #18435] [Bug #18729]

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2022-08-20 13:44:00 +02:00
Nobuyoshi Nakada
b32a3f1275
[Bug #18964] Add test for rb_econv_append 2022-08-20 16:25:30 +09:00
Takashi Kokubun
485019c2bd
Rename mjit_exec to jit_exec (#6262)
* Rename mjit_exec to jit_exec

* Rename mjit_exec_slowpath to mjit_check_iseq

* Remove mjit_exec references from comments
2022-08-19 23:57:17 -07:00
Jeremy Evans
6f3857f6a7 Support Encoding::Converter newline: :lf and :lf_newline options
Previously, newline: :lf was accepted but ignored.  Where it
should have been used was commented out code that didn't work,
but unlike all other invalid values, using newline: :lf did
not raise an error.

This adds support for newline: :lf and :lf_newline, for consistency
with newline: :cr and :cr_newline.  This is basically the same as
universal_newline, except that it only affects writing and not
reading due to RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK.

Add tests for the File.open :newline option while here.

Fixes [Bug #12436]
2022-08-19 20:23:36 -07:00
Nobuyoshi Nakada
1a2f99275b [Bug #18958] format string must be ASCII compatible 2022-08-20 10:06:40 +09:00
Nobuyoshi Nakada
d2483393cb [Bug #18956] Negative codepoints are invalid characters 2022-08-20 10:06:16 +09:00
Nobuyoshi Nakada
1ef49de834 [Bug #18955] format single character for %c 2022-08-20 03:57:13 +09:00
Nobuyoshi Nakada
ce384ef5a9 [Bug #18955] Check length of argument for %c in proper encoding 2022-08-20 03:57:13 +09:00
Nobuyoshi Nakada
2652b0da6b
Harden SizedQueue#push timeout test 2022-08-19 00:16:44 +09:00
Jean Boussier
b0b9f7201a rb_str_resize: Only clear coderange on truncation
If we are expanding the string or only stripping extra capacity
then coderange won't change, so clearing it is wasteful.
2022-08-18 10:09:08 +02:00
Jean Boussier
fe61cad749 Implement SizedQueue#push(timeout: sec)
[Feature #18944]

If both `non_block=true` and `timeout:` are supplied, ArgumentError
is raised.
2022-08-18 10:07:37 +02:00
Peter Zhu
b4daf6e28e Fix flaky test for GC thrashing
GC could be in an intermediate state after creating the objects, so we
should finish GC by running a minor GC.
2022-08-17 10:54:28 -04:00
Jean Boussier
3850113e20 [ruby/cgi] Implement CGI.url_encode and CGI.url_decode
[Feature #18822]

Ruby is somewhat missing an RFC 3986 compliant escape method.

c2729c7f33
2022-08-16 19:12:03 +09:00
Nobuyoshi Nakada
5389c9813b
Update the excluding message for Psych [ci skip] 2022-08-16 13:49:28 +09:00
John Hawthorn
0608a9a086
Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229)
* Optimize Marshal dump of large fixnum

Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit
platforms the 63-bit fixnums need to be represented in Marshal's
BIGNUM.

Previously this was done by converting to a bugnum and serializing the
bignum object.

This commit avoids allocating the intermediate bignum object, instead
outputting the T_FIXNUM directly to a Marshal bignum. This maintains the
same representation as the previous implementation, including not using
LINKs for these large fixnums (an artifact of the previous
implementation always allocating a new BIGNUM).

This commit also avoids unnecessary st_lookups on immediate values,
which we know will not be in that table.

* Fastpath for loading FIXNUM from Marshal bignum

* Run update-deps
2022-08-15 16:14:12 -07:00