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

61276 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada dd830fab69
Fixed a typo 2020-05-10 18:40:47 +09:00
Nobuyoshi Nakada 42e8de8db9
Fix for cross_compiling
`RubyVM.each_builtin` is not defined when cross compiling.
2020-05-10 17:28:03 +09:00
Takashi Kokubun 967ae6278f
Run rb_syswait on exec failure
not only when !w but also when w == WAITPID_LOCK_ONLY.
See also: f7c0cc3692 and a226434206.
We thought this change was an oversight in the latter commit.

Without this change, the test fails like:

$ make test-all TESTS="../test/ruby/test_process.rb -n test_exec_failure_leaves_no_child" RUN_OPTS="--jit"
...
  1) Failure:
TestProcess#test_exec_failure_leaves_no_child [/home/k0kubun/src/github.com/ruby/ruby/test/ruby/test_process.rb:2493]:
Expected [[26799, #<Process::Status: pid 26799 exit 127>]] to be empty.

Co-Authored-By: Yusuke Endoh <mame@ruby-lang.org>
2020-05-10 00:59:55 -07:00
卜部昌平 50a6d292c0 nmake doesn't understand $<
Fix MSVC build error.
2020-05-10 16:51:10 +09:00
卜部昌平 4fca592e8c delete mk_builtin_binary.rb
To generate what is necessary via generic_erb.rb instead.
2020-05-10 16:51:10 +09:00
卜部昌平 191cfcc407 delete mk_call_iseq_optimized.rb
To generate what is necessary via generic_erb.rb instead.
2020-05-10 16:51:10 +09:00
Takashi Kokubun a6f8589914
Workaround a zombie process created by Open3
with MJIT worker enabled

The problem:

```
$ ruby -ropen3 --jit -e 'Open3.capture2e("cmake") rescue nil;binding.irb'
irb(main)[01:0]> Process.waitall
=> [[10656, #<Process::Status: pid 10656 exit 127>]]

$ ruby -ropen3 -e 'Open3.capture2e("cmake") rescue nil;binding.irb'
irb(main)[01:0]> Process.waitall
=> []
```

Not sure why it's happening yet, but first I'd like to prevent trunk-mjit-wait
from failing like http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2929075.
2020-05-09 22:36:34 -07:00
git 18f22490e8 * 2020-05-10 [ci skip] 2020-05-10 14:19:58 +09:00
Yusuke Endoh 3bf0d2bb92 test/rubygems/test_gem_ext_cmake_builder.rb: make sure cmake available
just for a case.  In addition, this change suppresses unused variable
warning.
2020-05-10 14:18:25 +09:00
卜部昌平 889b0fe46f .github/workflows/compilers.yml: GCC 10.1 released 2020-05-09 22:24:57 +09:00
Nobuyoshi Nakada 883214f8e9
Use %w instead of %i not to create unused IDs 2020-05-09 20:13:30 +09:00
Yusuke Endoh 595e74ae4b test/io/console/test_io_console.rb: Rescue Errno::ENXIO for Solaris
https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20200509T100003Z.fail.html.gz
```
  1) Failure:
TestIO_Console#test_failed_path [/export/home/users/chkbuild/cb-gcc/tmp/build/20200509T100003Z/ruby/test/io/console/test_io_console.rb:40]:
[Errno::ENODEV, Errno::ENOTTY, Errno::EBADF] exception expected, not #<Errno::ENXIO: No such device or address - /dev/null>.
```
2020-05-09 20:07:38 +09:00
Nobuyoshi Nakada be575a6eef
[ruby/io-console] Use sys_fail_fptr macro
https://github.com/ruby/io-console/commit/2b8ba023c8
2020-05-09 17:05:14 +09:00
Hiroshi SHIBATA 7df6eaf29e
Addeed missing RSpec namespace 2020-05-09 16:58:21 +09:00
Nobuyoshi Nakada 581763d14c [ruby/io-console] Fails with EBADF on mingw
https://github.com/ruby/io-console/commit/530cec574c
2020-05-09 14:51:43 +09:00
Nobuyoshi Nakada d7a59e2ffe
[ruby/io-console] Expanded expected errors
May fail with ENOTTY instead of ENODEV.

https://github.com/ruby/io-console/commit/fe117b89e0
2020-05-09 14:46:08 +09:00
Kazuhiro NISHIYAMA 0a86679a7b
Fix a typo [ci skip] 2020-05-09 14:22:33 +09:00
Kazuhiro NISHIYAMA 4314c05377
Fix typos 2020-05-09 14:22:04 +09:00
Nobuyoshi Nakada cc9bc14530 [ruby/io-console] Added test for failed path
https://github.com/ruby/io-console/commit/06a540f9b4
2020-05-09 13:57:04 +09:00
Nobuyoshi Nakada 0ce45db115 [ruby/io-console] Show path name at error
https://github.com/ruby/io-console/commit/6a4b1c1a6d
2020-05-09 13:56:55 +09:00
Nobuyoshi Nakada 5eb446d12f
mjit_worker.c: compile_compact_jit_code is not used on mingw 2020-05-09 13:46:47 +09:00
Nobuyoshi Nakada 1181edd54c
rbuninstall.rb: show paths without destdir as well as rbinstall.rb 2020-05-09 13:45:50 +09:00
Nobuyoshi Nakada e88bb6a2f7
rbuninstall.rb: get rid of errors when prefix ends with "/." 2020-05-09 01:43:53 +09:00
Nobuyoshi Nakada 8830d60dae
rbuninstall.rb: print output record separator instead of $\ 2020-05-09 01:40:40 +09:00
git 721060388e * 2020-05-09 [ci skip] 2020-05-09 01:25:26 +09:00
Nobuyoshi Nakada 3333d02357
rbinstall.rb: get rid of installing duplicate files
Should not overwrite ext/rubyvm/lib/forwardable/impl.rb by
lib/forwardable/impl.rb.
2020-05-09 01:22:16 +09:00
Nobuyoshi Nakada cc3352cc41
rbinstall.rb: record bundled gem files 2020-05-09 00:55:55 +09:00
Nobuyoshi Nakada 8a504b224f
Added GC guard for splatted array 2020-05-08 21:23:21 +09:00
Marc-Andre Lafortune adf709a785 Classes made from Struct should have default `new` singleton method.
[Bug #16465] [Bug #16801]
[Fix GH-2795] [Fix GH-2944] [Fix GH-3045] [Fix GH-3093]

Note: Backporting shouldn't modify object.h and instead can use
struct_new_kw which is basically a duplicate implementation of
rb_class_new_instance_pass_kw

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: John Hawthorn <john@hawthorn.email>
Co-authored-by: Adam Hess <HParker@github.com>
Co-authored-by: Jose Cortinas <jacortinas@gmail.com>
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2020-05-08 04:18:45 -04:00
Hiroshi SHIBATA da345adc1c
`Open3.capture2e` raises exception when the command is not present. 2020-05-08 14:27:41 +09:00
Hiroshi SHIBATA ac2c07e983 Revert "[rubygems/rubygems] Remove unneeded global teardown"
This reverts commit 93d1588c782ab9d61699f98b6c64d7f0ab8121c0.
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA ceacb06311 Revert "[rubygems/rubygems] Remove unneeded teardown"
This reverts commit 0da416ab170dbe1cbd530a5a7c5e8128910014b2.
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA 20971d0df4 Revert "[rubygems/rubygems] Use a local temporary directory"
This reverts commit e98455f289047c43a733e61ac6317fb74b68de82.
2020-05-08 14:13:29 +09:00
David Rodríguez 07d4ad935d [rubygems/rubygems] Remove unneeded teardown
Tests using credentials shouldn't be leaving side effects.

https://github.com/rubygems/rubygems/commit/975bcafdfc
2020-05-08 14:13:29 +09:00
David Rodríguez 93293043f1 [rubygems/rubygems] Remove unneeded global teardown
Instead, make each test cleanup after itself.

https://github.com/rubygems/rubygems/commit/e0aba9d64f
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA b9031b1043 [rubygems/rubygems] Restore the old .gemrc example for compatible tests
https://github.com/rubygems/rubygems/commit/c45d65a06d
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA 4e436e605c [rubygems/rubygems] Removed needless setup to clear credential
https://github.com/rubygems/rubygems/commit/4f694f4fb7
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA ab1b31ffe0 [rubygems/rubygems] Also added credential_setup to the some of tests
https://github.com/rubygems/rubygems/commit/2ac557d008
2020-05-08 14:13:29 +09:00
Hiroshi SHIBATA 58af4c0a1f [rubygems/rubygems] Split credential helper as credential_setup and use it
https://github.com/rubygems/rubygems/commit/b0c55c76ca
2020-05-08 14:13:29 +09:00
David Rodríguez 18ac783ea6 [rubygems/rubygems] Revert adding loaded specs to `Gem::Specification.stubs` and `Gem::Specification.stubs_for`
The rationale is that:

* The change has caused realworld issues. See for example
https://github.com/ruby/did_you_mean/issues/117 and specifically [this
comment](https://github.com/ruby/did_you_mean/issues/117#issuecomment-482733159)
for a great explanation of the issue it caused for `did_you_mean`.

* The change also causes problems for our development workflows. For
example, because of it, our `bundler` specs cannot currently be run with
`bin/rake` and we have to use `bin/rspec` or `bin/parallel_spec`
directly. The explanation for this is:

  - Our specs install test dependencies to `tmp` before running specs.
  - `rake` is one of these test dependencies.
  - Before installing each test dependency, we check whether it has
  matching installed specs: 2bbcdcde08/bundler/spec/support/rubygems_ext.rb (L109-L114).

  - Normally, if `rake` has not yet been installed to `tmp`, this check
  fails and `rake` is installed, but since the loaded specs are now
  added to `Gem::Specification.stubs` and `rake`'s specification _is_
  loaded because we're running through `bin/rake`, the check incorrectly
  assumes that `rake` is already installed to `tmp` and skips
  installation.
  - At a later point the specs check whether `rake` is actually
  installed and fail if it's not: 2bbcdcde08/bundler/spec/support/builders.rb (L372-L383)

Essentially, both of the issues are the same. If at runtime we change
the location of gems, we'll _want_ to not consider loaded specifications
when dealing with the new gem location, because the loaded
specifications have not been loaded from there. Loaded specifications is
something different from installed stub specifications and those should
not be mixed.

The PR still seemed to have fixed an issue, so I did my archaeology job
and investigated the original issue to double check if reverting is ok.
The logs for the original error can be found here:
https://ci.appveyor.com/project/rubygems/rubygems/build/1172/job/ogubyucpljcv22ux.

So I installed ruby 2.4.4, checked out the commit reference before the
offending PR, and the exact error reproduced. 🎉

```
$ rake test
/home/deivid/Code/rubygems/lib/rubygems/resolver.rb:231:in `search_for': Unable to resolve dependency: user requested 'bundler (= 1.16.2)' (Gem::UnsatisfiableDependencyError)
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:283:in `block in sort_dependencies'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:277:in `each'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:277:in `sort_by'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:277:in `with_index'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:277:in `sort_dependencies'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:165:in `initial_state'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:106:in `start_resolution'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:64:in `resolve'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:42:in `resolve'
  from /home/deivid/Code/rubygems/lib/rubygems/resolver.rb:188:in `resolve'
  from /home/deivid/Code/rubygems/lib/rubygems/request_set.rb:396:in `resolve'
  from /home/deivid/Code/rubygems/lib/rubygems/request_set.rb:408:in `resolve_current'
  from /home/deivid/Code/rubygems/lib/rubygems.rb:243:in `finish_resolve'
  from /home/deivid/Code/rubygems/lib/rubygems/rdoc.rb:13:in `<top (required)>'
  from /home/deivid/Code/rubygems/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/deivid/Code/rubygems/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
  from /home/deivid/Code/rubygems/lib/rubygems/test_case.rb:1563:in `<top (required)>'
  from /home/deivid/Code/rubygems/test/rubygems/test_bundled_ca.rb:2:in `require'
  from /home/deivid/Code/rubygems/test/rubygems/test_bundled_ca.rb:2:in `<top (required)>'
  from /home/deivid/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/rake_test_loader.rb:15:in `require'
  from /home/deivid/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/rake_test_loader.rb:15:in `block in <main>'
  from /home/deivid/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/rake_test_loader.rb:4:in `select'
  from /home/deivid/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1)

Tasks: TOP => test
```

Now the explanation of the error:

* Rubygems base `TestCase` class requires `bundler` because some tests
use `bundler`:
2bbcdcde08/lib/rubygems/test_case.rb (L26)

* That `require` (our custom rubygems require) would activate the
default bundler spec (1.16.1 for ruby 2.4.4) but then overwrite it with
a 1.16.2 version (the locally provided bundler those days) due to [this
old
hack](9f7bf0ac3a/lib/bundler/version.rb (L7-L23)).

* Rubygems base `TestCase` class requires `rubygems/rdoc`:
2bbcdcde08/lib/rubygems/test_case.rb (L1536)

* And that file ends up calling `Gem.finish_resolve`:
2bbcdcde08/lib/rubygems/rdoc.rb (L13)

* `Gem.finish_resolve` adds the currently loaded specs to the
resolution:
2bbcdcde08/lib/rubygems.rb (L235)

* That means it would try to resolve bundler 1.16.2, but no
specification for that version was installed since the default was
1.16.1. That explains why upgrading to rubygems 2.7.7 fixed the issue,
since it provided bundler 1.16.2 by default so there was not bundler
version discrepancy.

After understanding the error, I conclude that:

* Only this part of the original patch was actually needed to resolve
the error, not any of the changes in `Gem::Specification.stubs` and
`Gem::Specification.stubs_for`:

```diff
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index f1cd3d274c..92c848e870 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -13,6 +13,15 @@ else
   require 'rubygems'
 end

+# If bundler gemspec exists, add to stubs
+bundler_gemspec = File.expand_path("../../../bundler/bundler.gemspec", __FILE__)
+if File.exist?(bundler_gemspec)
+  Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
+  Gem::Specification.class_variable_set :@@stubs, nil
+  Gem::Specification.stubs
+  Gem::Specification.dirs.shift
+end
+
 begin
   gem 'minitest'
 rescue Gem::LoadError
```

So, I propose to revert adding loaded specification to
`Gem::Specification.stubs` and `Gem::Specification.stubs_for` because I
think it's safe, it fixes the issues caused by their addition, and it
simplifies `Gem::Specification` code, which is already complicated
enough.

https://github.com/rubygems/rubygems/commit/5269cd617c
2020-05-08 14:13:29 +09:00
Vít Ondruch 46462200af [rubygems/rubygems] Test that two calls to `stub_for` returns the same (cached) instance.
https://github.com/rubygems/rubygems/commit/00b3f55562
2020-05-08 14:13:29 +09:00
Vít Ondruch acc86570dd [rubygems/rubygems] Let `@@stubs_by_name` to be incrementally populated again.
Originally, the call to `.stubs_for` allowed to incrementally populate
the `@@stubs_by_name` (especially see the `"#{name}-*.gemspec"` pattern
in 4fa03bb7aac9f25f44394e818433fdda9962ae8d). Now it looks like it
expects that all stubs are loaded, but the `.stubs_for` still matches
the .gemspec files by the `name` pattern:

6d45e0f7ac/lib/rubygems/specification.rb (L845)

I think this was done by mistake incrementally by PR #1239 and
4cee8ca9199ac7b3ab8647e0b78615f55d3eb02b. I think the best option is to
get back to the original implementation, to let RubyGems incrementally
populate the array. Other option would be to replace the logic in
`.stub_for` by call to `.stubs`, but the means the performance
improvement from the original commit was lost.

https://github.com/rubygems/rubygems/commit/4d0e18185a
2020-05-08 14:13:29 +09:00
David Rodríguez 15a4b7d769 [rubygems/rubygems] Remove unnecessary code
This list of exceptions is no longer rescued since
1f03275ff3faa1c808d3a3b89ef5db62dc2eb2ba.

https://github.com/rubygems/rubygems/commit/6e71e7be67
2020-05-08 14:13:29 +09:00
David Rodríguez c832e3faa4 [rubygems/rubygems] Require open3 before using it
Otherwise if this test file is run in isolation, this test will fail.

https://github.com/rubygems/rubygems/commit/79da003948
2020-05-08 14:13:29 +09:00
David Rodríguez 5df6082786 [rubygems/rubygems] Improve gzip errors logging
By default, the `Zlib::GzipFile::Error` does not include the actual data
that was not in gzip format that caused the error.

However, its `#inspect` method includes it.

I think this can be helpful to troubleshoot errors.

https://github.com/rubygems/rubygems/commit/11c8717133
2020-05-08 14:13:29 +09:00
Samuel Williams b24f7dbcfd [rubygems/rubygems] Update util.rb
Remove unused module variable.
https://github.com/rubygems/rubygems/commit/98135bb3d8
2020-05-08 14:13:29 +09:00
David Rodríguez 0e195c82c1 [rubygems/rubygems] Remove old `gauntlet_rubygems` file on rubygems upgrade
The file was removed at
65b709b095,
shipped with rubygems 2.6.5.

https://github.com/rubygems/rubygems/commit/739159a120
2020-05-08 14:13:29 +09:00
David Rodríguez c982c5efac [rubygems/rubygems] Skip flaky tests on jruby
I believe these are most certainly due to a problem outside of rubygems.
I'm skipping these at least until webrick officially supports jruby
(defining "officially" as "webrick's CI passes on jruby").

https://github.com/rubygems/rubygems/commit/4fca025358
2020-05-08 14:13:29 +09:00
David Rodríguez ce88e2a8aa [rubygems/rubygems] Suppress warnings coming from `jar-dependencies`
This is a default gem on jruby, which ships with a rubygems plugin,
which prints warnings all over the place during our tests.

This plugin is unnecessary from our tests, so I disable it through the
`JARS_SKIP` environment variable provided by this gem.

https://github.com/rubygems/rubygems/commit/0aabbcf269
2020-05-08 14:13:29 +09:00
David Rodríguez 314d7f897c Remove `builder` gem requirement for `gem regenerate_index`
This requirement was introduced 14 years ago in
7ce7039b390440754954df5efea619e9f57ef823, and I don't think it's
necessary anymore. I made several tests introducing UTF-8 characters in
gemspec files and generating indexes out of them, and couldn't find any
issues. Gemspecs are read with UTF-8 encoding these days.
2020-05-08 14:13:29 +09:00