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

725 Коммитов

Автор SHA1 Сообщение Дата
Lars Kanis 576b2e64cd MINGW-UCRT: Set CONFIG['arch'] and RUBY_PLATFORM to "x64-mingw-ucrt"
This allows easy differentiation between ABI incompatible platforms like MSWIN64 and MSVCRT-based MINGW32.
This also implicates a distinct rubygem platform which is also "x64-mingw-ucrt".

Although the term "mingw32" is the OS-part for 64 bit systems as well, the "32" is misleading and confusing for many users.
Therefore the new platform string drops the "32" from the OS part to just "mingw".
This conforms to the common practice of windows platform testing per RUBY_PLATFORM=~/mswin|mingw/ .
2021-09-20 00:15:30 +09:00
David Rodríguez 1e290c31f4 [rubygems/rubygems] Merge `Gem::UriParser` and `Gem::PrintableUri` into a `Gem::Uri` class
The new class is a wrapper on top of an URI. And then, when you want
credentials redacted, you call `#redacted` that returns a copy of itself,
but with credentials redacted.

https://github.com/rubygems/rubygems/commit/9581c2740a
2021-08-31 19:06:14 +09:00
Daniel Niknam ceba866864 [rubygems/rubygems] Remove unnecessary tests
We will be passing string to this class so there is no need to be defensive about it.

https://github.com/rubygems/rubygems/commit/30bd52a977
2021-08-31 19:06:14 +09:00
Daniel Niknam aa898b4206 [rubygems/rubygems] Remove @credential_redacted instance variable
https://github.com/rubygems/rubygems/commit/c3bb52eb5c
2021-08-31 19:06:14 +09:00
Daniel Niknam 589377fbdc [rubygems/rubygems] Refactor `Gem::RemoteFetcher::FetchError.build` back to its initialize method
https://github.com/rubygems/rubygems/commit/21dcdd2dc5
2021-08-31 19:06:14 +09:00
Daniel Niknam a508693f06 [rubygems/rubygems] Remove defensive guards
https://github.com/rubygems/rubygems/commit/dba130cd80
2021-08-31 19:06:14 +09:00
Daniel Niknam fafd9d280a [rubygems/rubygems] Rename `Gem::PrintableUri#parsed_uri?` to `Gem::PrintableUri#valid_uri?`
https://github.com/rubygems/rubygems/commit/a5177709c9
2021-08-31 19:06:14 +09:00
Daniel Niknam 3adc141a79 [rubygems/rubygems] Refactor `Gem::RemoteFetcher::FetchError` initializer to `build` method
The `initialize` method is already doing a lot and by adding the `Gem::PrintableUri` to redact sensitive information, things are getting complicated and hard to read here. For the start, I have refactored the `initialize` method into a class method called `build`.

https://github.com/rubygems/rubygems/commit/4312e8fdf5
2021-08-31 19:06:14 +09:00
Daniel Niknam 19e1d3cdce [rubygems/rubygems] Using `Gem::PrintableUri` in `Gem::Request` class
The `@uri` variable could be a source URI with a credential. Using `Gem::PrintableUri` to make sure we are redacting sensitive information from it when logging on verbose mode.

https://github.com/rubygems/rubygems/commit/f566787211
2021-08-31 19:06:14 +09:00
Daniel Niknam 31c2e6c08e [rubygems/rubygems] Using `Gem::PrintableUri` in `Gem::Commands::InstallCommand` class
The `x.source.uri` could be a source URI with a credential. Using `Gem::PrintableUri` to make sure we are redacting sensitive information from it.

https://github.com/rubygems/rubygems/commit/8755ee0aaa
2021-08-31 19:06:14 +09:00
Daniel Niknam b41802421a [rubygems/rubygems] Introduce `Gem::PrintableUri` that would redact URIs to be used on outputs
We need to redact URI credential in several places and copy pasting the code into each part of it is not ideal. This class is responsible for parsing URI strings and redacting credential from it. Also, it will handle URI object in the same manner. We will be reusing this class whenever we need to print/display a URI to users.
URI with the following format will be redacted:
- Token: `http://my-secure-token@example.com` => `http://REDACTED@example.com`
- Username & Password: `http://my-username:my-secure-password@example.com` => `http://my-username:REDACTED@example.com`
- x-oauth-basic: `http://my-secure-token:x-oauth-basic@example.com` => `http://REDACTED:x-oauth-basic@example.com`

https://github.com/rubygems/rubygems/commit/f1e45d3a89
2021-08-31 19:06:14 +09:00
Daniel Niknam 14a9e24f7e [rubygems/rubygems] Add a few tests for `Gem::UriParser.parse_uri`
https://github.com/rubygems/rubygems/commit/1ea73df161
2021-08-31 19:06:14 +09:00
Daniel Niknam c71d1a26ef [rubygems/rubygems] Pick the last founded gems when fetching metadata
https://github.com/rubygems/rubygems/commit/e3d150d822

Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2021-08-31 19:06:14 +09:00
David Rodríguez 907fa88a76 [rubygems/rubygems] Remove unused file
No longer used since
b7f6270b9e.

https://github.com/rubygems/rubygems/commit/76803894a0
2021-08-31 19:06:14 +09:00
David Rodríguez 590d2222a0 [rubygems/rubygems] Remove helper method not buying us much
https://github.com/rubygems/rubygems/commit/81dc685d20
2021-08-31 19:06:14 +09:00
David Rodríguez d01c3111c2 [rubygems/rubygems] Remove MacOS specific extra GEM_PATH
They should properly configure `GEM_PATH` instead.

https://github.com/rubygems/rubygems/commit/3bd9ae33ca
2021-08-31 19:06:14 +09:00
Daniel Niknam 717ad64f41 [rubygems/rubygems] Replace StandardError with Exception
We think it's unlikely that `rubygems/defaults/operating_system` could be shipped with a SyntaxError so StandardError could be better choice to prevent "false positives" errors.

https://github.com/rubygems/rubygems/commit/1f73e784dd
2021-08-31 19:06:14 +09:00
Daniel Niknam 34e073c0ca [rubygems/rubygems] Reword the message
For errors that could happened while loading `rubygems/defaults/operating_system`

https://github.com/rubygems/rubygems/commit/6e1e2141f8
2021-08-31 19:06:14 +09:00
Daniel Niknam 744e128ed9 [rubygems/rubygems] Exclude truffleruby from the test for failure of operating_system.rb
truffleruby does not raise any error when requiring `rubygems`.

https://github.com/rubygems/rubygems/commit/21e2fcd0b2
2021-08-31 19:06:14 +09:00
Daniel Niknam aafc615b4a [rubygems/rubygems] Enhance error handling when loading the rubygems/defaults/operating_system file
When loading `rubygems/defaults/operating_system`
- we want to keep it silent if the raised exception is a LoadError
- we want to print a message in other cases and ask users to report the issue to their OS support.

Ruby 3 comes with special error handling for loading `rubygems` and it will show a warning when LoadError exception raised for requiring 'rubygem'.
Because of that, we decided to leave the LoadError scenario as it is.
Reference: d1998d8767/gem_prelude.rb (L1-L5)

https://github.com/rubygems/rubygems/commit/0a97e12fe1
2021-08-31 19:06:14 +09:00
David Rodríguez 9fa5c4cd07 [rubygems/rubygems] Also load user installed rubygems plugins
https://github.com/rubygems/rubygems/commit/82960c262f
2021-08-31 19:06:14 +09:00
David Rodríguez 2d0d1c339a [rubygems/rubygems] Recommend `bundle install` rather than `gem install -g`
https://github.com/rubygems/rubygems/commit/4028cbc408
2021-08-31 19:06:14 +09:00
David Rodríguez 76b77d9275 [rubygems/rubygems] Refactor reseting `RUBYGEMS_GEMDEPS` in tests
https://github.com/rubygems/rubygems/commit/91dca11112
2021-08-31 19:06:14 +09:00
David Rodríguez 87dfb55c16 [rubygems/rubygems] Use `Gem.use_gemdeps` only from binstubs
The previous behavior was to automatically require `bundler/setup`
everytime `rubygems` was required, which I think was too much.

https://github.com/rubygems/rubygems/commit/b25379a295
2021-08-31 19:06:14 +09:00
David Rodríguez b6c082fd09 [rubygems/rubygems] Remove misleading comment
When I read, I thought the assertion was incorrect. It's doing the right
thing, though.

https://github.com/rubygems/rubygems/commit/e72c27367a
2021-08-31 19:06:14 +09:00
David Rodríguez 19d77a1cfc [rubygems/rubygems] Remove unnecessary spec manipulation
https://github.com/rubygems/rubygems/commit/c7c00c280f
2021-08-31 19:06:14 +09:00
David Rodríguez b17cdad2f8 [rubygems/rubygems] Remove redundant part of error message
It doesn't really add much, in my opinion. We want to be helpful, but
also concise when possible.

https://github.com/rubygems/rubygems/commit/9d56009cf7
2021-08-31 19:06:14 +09:00
Nobuyoshi Nakada 803c60858e
[rubygems/rubygems] Check requirements classes
Mitigate the security risk:
https://devcraft.io/2021/01/07/universal-deserialisation-gadget-for-ruby-2-x-3-x.html

https://github.com/rubygems/rubygems/commit/141c2f4388
2021-07-27 09:25:56 +09:00
David Rodríguez 88e46cf6b8
[rubygems/rubygems] Remove all `syck` traces from `rubygems`
After reading [this blog
post](https://blog.rubygems.org/2011/08/31/shaving-the-yaml-yak.html),
published almost 10 years ago already, my understanding is that this
problem could come up in two ways:

* Rubygems.org serving corrupted gemspecs". As far as I understand this
was fixed in rubygems.org a lot time ago, since
https://github.com/rubygems/rubygems.org/pull/331.

* Clients having a ten years old gemspec cache with some of these bad
gemspecs. In this case, there's no easy solution but I think ten years
is enough and rebuilding the cache should do the trick.

So, I think it's time we remove this.

https://github.com/rubygems/rubygems/commit/afcb15d556
2021-07-27 09:25:56 +09:00
Jared Beck bbaebbf529
[rubygems/rubygems] Fix contradictory message about deletion of default gem
[Fixes #4733]

https://github.com/rubygems/rubygems/commit/fce7f3eb7d
2021-07-16 15:40:07 +09:00
Hiroshi SHIBATA 896bbb9fad Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 2021-07-14 10:48:07 +09:00
Hiroshi SHIBATA c082c6eb7c Sync RubyGems and Bundler with upstream 2021-07-07 15:31:52 +09:00
David Rodríguez 6e2240a2f9 Sync latest bundler & rubygems development version 2021-07-07 13:30:20 +09:00
Yusuke Endoh ff609eee98 Avoid a duplicated method definition of Object#stub
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20210622T063005Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/rubygems/helper.rb:1565: warning: method redefined; discarding old stub
/home/chkbuild/chkbuild/tmp/build/20210622T063005Z/ruby/test/resolv/test_dns.rb:8: warning: previous definition of stub was here
```
2021-06-22 16:36:36 +09:00
Nobuyoshi Nakada 95ef545997 [rubygems/rubygems] Close then unlink tempfiles on Windows
In ruby/ruby test actions, number of "leaked tempfile" messages
are shown on Windows.

As Windows disallows removing open files, `Tempfile#unlink` fails
silently before `#close`.
Close then unlink by `#close!` instead.

https://github.com/rubygems/rubygems/commit/fe0b88ac30
2021-06-17 12:28:15 +09:00
Yusuke Endoh b957c3dbcb [rubygems/rubygems] Rename test/rubygems/test_{case,utilities}.rb to avoid "test_" prefix
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".

The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:

```
t.test_files = FileList['test/**/test_*.rb']
```

Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820971, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.

Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.

https://github.com/rubygems/rubygems/commit/6460e018df
2021-06-03 12:23:22 +09:00
Hiroshi SHIBATA 12214b7814
Resolve to missing `Gem::TestCase` issue with random order tests 2021-05-28 14:01:58 +09:00
Hiroshi SHIBATA e487ba7dda
[rubygems/rubygems] Use pend instead of skip 2021-05-28 12:33:16 +09:00
David Rodríguez a634ef5376 [rubygems/rubygems] Fix "instance variable not initialized" warning
This variable had a typo (it's `@gemhome`), but the test is still
passing, so I assume it's not needed.

https://github.com/rubygems/rubygems/commit/3b88642bdb
2021-05-28 11:53:57 +09:00
David Rodríguez 1f505000e6 [rubygems/rubygems] Test installing a non deprecated file
https://github.com/rubygems/rubygems/commit/a678959eda
2021-05-28 11:53:45 +09:00
David Rodríguez 9382bda78b [rubygems/rubygems] Remove no longer needed `RUBYGEMS_TEST_PATH` env variable
https://github.com/rubygems/rubygems/commit/0efb894c3b
2021-05-28 11:53:33 +09:00
David Rodríguez 4fb3dd2c42 [rubygems/rubygems] Remove no longer relevant commentsº
https://github.com/rubygems/rubygems/commit/8dfe1e30b5
2021-05-28 11:53:21 +09:00
David Rodríguez f7732ae2eb [rubygems/rubygems] Require the new files in `test/` relatively
https://github.com/rubygems/rubygems/commit/c77868a555
2021-05-28 11:53:09 +09:00
David Rodríguez 59c6820971 [rubygems/rubygems] Copy files specific to testing rubygems to `test`
https://github.com/rubygems/rubygems/commit/aa390a3500
2021-05-28 11:52:57 +09:00
Hiroshi SHIBATA f7d661e783
[rubygems/rubygems] Try fix ruby-core CI
* Port
8e91b969df
from ruby-core, and make it compatible with psych 3 & 4.
2021-05-28 11:52:32 +09:00
Yusuke Endoh ceea1ea8af test/rubygems/test_gem_commands_open_command.rb: prevent a warning
http://rubyci.s3.amazonaws.com/debian9/ruby-master/log/20210518T093002Z.log.html.gz
```
[ 9396/21186] TestGemCommandsOpenCommand#test_execute-e:1: warning: possibly useless use of a literal in void context
 = 0.06 s
```
2021-05-18 19:06:48 +09:00
Hiroshi SHIBATA 8e91b969df
Workaround with fbb4e3f96c 2021-05-17 12:00:05 +09:00
Yusuke Endoh 9484f9ebdf [rubygems/rubygems] Use `Time.stub :now` to avoid a random failure
Essentially this reverts 45464bfcbdf9f9cfb440950bc57a27d237627a17.
The commit removed a mock of Time.now, which caused a random failure.

http://rubyci.s3.amazonaws.com/ubuntu1804/ruby-master/log/20210512T123004Z.fail.html.gz
```
  1) Failure:
TestGemPackageTarWriter#test_add_file_signer [/home/chkbuild/chkbuild/tmp/build/20210512T123004Z/ruby/test/rubygems/test_gem_package_tar_writer.rb:117]:
Field mtime of the tar header differs..
<"14046746312\u0000"> expected but was
<"14046746311\x00">.
```

Object#stub is defined at f1af59fe02ef2cc58f13e2742e4cc6cf8c2a1a20, so
now `Time.stub :now` works.

https://github.com/rubygems/rubygems/commit/85f60a9ed0
2021-05-13 09:26:13 +09:00
Hiroshi SHIBATA cdcfe1082c Revert 924ce2c5ba4d1c1dc781a6a06682204d358421bb
Because test-unit didn't provide the benchmark test. And This test
  is fragile with the several environments.
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA bef49e6e8d [rubygems/rubygems] Added begin-end block for java platform
Because pend of test-unit raises exception.

https://github.com/rubygems/rubygems/commit/b5e2d0855a
2021-05-12 17:24:43 +09:00