Commit graph

14675 commits

Author SHA1 Message Date
David Rodríguez
261f5d3202 [rubygems/rubygems] Add naive infinite loop detection when fixing lockfile dependencies
5e933968a2
2024-11-06 13:16:58 +00:00
David Rodríguez
c79d236493 [rubygems/rubygems] Note about why we don't fix lockfile dependencies backed by installed specs
6fa94b5d72
2024-11-06 13:16:58 +00:00
David Rodríguez
40a2e8e9cf [rubygems/rubygems] This is not about the lockfile anymore
f2e0a72291
2024-11-06 13:16:57 +00:00
David Rodríguez
54f6b787e3 [rubygems/rubygems] Automatically fix lockfile when the API reveals missing deps
92196ccfdb
2024-11-06 13:16:57 +00:00
David Rodríguez
db7455ae65 [rubygems/rubygems] Check for EndpointSpecification exactly
8fac200ded
2024-11-06 13:16:56 +00:00
David Rodríguez
3e7a43e5e8 [rubygems/rubygems] Simplify code structure
a4dd06f095
2024-11-06 13:16:56 +00:00
David Rodríguez
350baed6a9 [rubygems/rubygems] Fix manifest in gem package using incorrect platform sometimes
If a gem package is built from a specification whose platform has been
modified, it will include metadata using the old platform.

This change should fix the problem by making sure `original_platform` is
always properly set.

ecd5cd4547
2024-11-06 11:37:29 +00:00
David Rodríguez
8c184885b0 [rubygems/rubygems] Fix some JRuby warnings when using bundler/setup with Ruby's -w flag
When using the `bundler/setup` entrypoint, Bundler prints the following
warnings in JRuby in `-w` is passed to Ruby.

```
/path/to/bundler/shared_helpers.rb:10: warning: constant Bundler::WINDOWS is deprecated
/path/to/bundler/shared_helpers.rb:11: warning: constant Bundler::FREEBSD is deprecated
/path/to/bundler/lib/bundler/shared_helpers.rb:12: warning: constant Bundler::NULL is deprecated
```

This does not happen in CRuby.

This seems like a JRuby bug but we can skip it by autoloading the
constants.

761ca29fa2
2024-11-06 11:37:10 +00:00
Hiroshi SHIBATA
82008d38e0 [ruby/shellwords] Bump up v0.2.1
ee08b981ac
2024-11-06 08:57:59 +00:00
Hiroshi SHIBATA
8f4227b664 [ruby/open-uri] Bump up v0.5.0
8f5a4ef6f9
2024-11-06 08:37:52 +00:00
Hiroshi SHIBATA
0c59048b3a [ruby/timeout] Bump up v0.4.2
2f52522994
2024-11-06 08:26:55 +00:00
Hiroshi SHIBATA
7d9e9eabe7 [ruby/tmpdir] Bump up v0.3.0
ef9ca591cf
2024-11-06 08:05:01 +00:00
Hiroshi SHIBATA
7e167b3225 [ruby/tempfile] Bump up v0.3.0
2ff9b3ccef
2024-11-06 07:47:49 +00:00
Hiroshi SHIBATA
a3a0c675c1 [ruby/yaml] Bump up v0.4.0
5e9bfff132
2024-11-06 07:32:52 +00:00
Jean Boussier
ca8f21ace8 [ruby/json] Resync 2024-11-05 18:00:36 +01:00
YO4
ed06f018bd [ruby/irb] windows does not support Process.kill("TERM", pid)
(https://github.com/ruby/irb/pull/1026)

7bbb885163
2024-11-05 13:53:41 +00:00
Alexis Bernard
7ae4b858b3 [ruby/rdoc] Display class ancestors in the sidebar #1183
50dda13426
2024-11-04 17:34:27 +00:00
David Rodríguez
e7518a7859 Validate user input encoding
If the user has the encoding of her system messed up, she may end up
sending us incorrectly encoding input, causing "invalid byte sequence in
UTF-8" errors at random places.

These errors can be forced on a system without encoding issues with
something like:

```
$ gem install$(echo -e "\xFF") foo
/Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/config_file.rb:534:in `block in set_config_file_name': invalid byte sequence in UTF-8 (ArgumentError)
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/config_file.rb:530:in `each'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/config_file.rb:530:in `set_config_file_name'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/config_file.rb:177:in `initialize'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/gem_runner.rb:71:in `new'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/gem_runner.rb:71:in `do_configuration'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/gem_runner.rb:33:in `run'
	from /Users/deivid/.asdf/installs/ruby/3.2.1/bin/gem:10:in `<main>'
```

This commit makes RubyGems print a better error in this case:

```
$ ruby -Ilib bin/gem install$(echo -e "\xFF") foo
/Users/deivid/Code/rubygems/rubygems/lib/rubygems/gem_runner.rb:75:in `validate_encoding': invalid argument: 'install�' has invalid encoding (Gem::OptionParser::InvalidArgument)
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/gem_runner.rb:31:in `run'
	from bin/gem:10:in `<main>'
```
2024-11-04 10:18:55 +00:00
David Rodríguez
9ce1b5e11f [rubygems/rubygems] Fix commands with 2 MFA requests when webauthn is enabled
If a command requires two MFA authenticated requests, and webauthn is
enabled, then first one will succeed but the second one will fail
because it tries to reuse the OTP code from the first request and that
does not work.

This happens when you have not yet logged in to rubygems.org, or when
you have an API key with invalid scopes for the current operation. In
that case, we need:

* An API request to get a token or change scopes for the one that you
  have.
* Another API request to perform the actual operation.

Instead of trying to reuse the token, make sure it's cleared so we are
asked to authenticate again. We only do this when webauthn is enabled
because reusing TOPT tokens otherwise is allowed and I don't want to
break that.

669e343935
2024-11-04 10:04:58 +00:00
David Rodríguez
7fba517d50 [rubygems/rubygems] OTP is already added by rubygems_api_request
15930fe126
2024-11-04 10:04:57 +00:00
David Rodríguez
50dbe19b68 [rubygems/rubygems] Fix incompatible encodings error
d478ec403f
2024-11-04 10:04:40 +00:00
Hiroshi SHIBATA
314b556cc5 [ruby/fileutils] Bump up v1.7.3
c138e67613
2024-11-01 05:04:32 +00:00
Jean Boussier
7daa1083c9 [ruby/json] Move State#configure back into C
While less nice, this open the door to eluding the State object
allocation when possible.

5c0d428d4c
2024-11-01 13:04:24 +09:00
Sarah Sehr
80fd846353 [rubygems/rubygems] Add useful error message for plugin load
If a plugin has previously been installed, but the path is no longer
valid, `rake setup` will fail with an unexpected error due to the file
not existing.

Instead, we want to present the user with what the issue is and how to
resolve the problem.

0c6ad3ecbb
2024-10-31 17:10:31 +00:00
Stan Lo
53df2a3c54 [ruby/rdoc] Use thicker fonts with high contrast to improve
readability
(https://github.com/ruby/rdoc/pull/1197)

7fb0e509ec
2024-10-31 10:05:19 +00:00
Guilherme Carreiro
c3fea18094 [rubygems/rubygems] Update --ext=rust to support compiling the native extension from source
9b0ec807c7
2024-10-30 23:09:12 +00:00
David Rodríguez
5da1cc6c9c [rubygems/rubygems] Rely on PATH if Ruby is not installed in the same directory as the binstub
ab7d65cc18

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-10-30 19:38:08 +00:00
David Rodríguez
116d6cbc83 [rubygems/rubygems] Simplify enable-load-relative prolog script creation
f2ed507afe
2024-10-30 19:38:07 +00:00
David Rodríguez
1e1a37220b [rubygems/rubygems] Fix gem update --system leaving old default bundler executables around
4b81add54c
2024-10-30 14:22:08 +00:00
David Rodríguez
ec0d0449dd [rubygems/rubygems] Remove confusing documentation
The first paragraph is misleading because command line flags that set
configuration are deprecated.

The second one is unnecessary because configuration precedence is
explained before the different configurations.

6cc64964ff
2024-10-30 14:20:52 +00:00
Jerome Dalbert
caa6bcc91f [rubygems/rubygems] Indent github workflow steps for generated gems
a1784e2efa
2024-10-30 14:06:58 +00:00
Jean Boussier
b094ee3f23
Handle all formatting configs potentially being nil.
Fix: https://github.com/ruby/json/issues/653

I don't think this was really fully supported in the past, but
it kinda worked with some of the implementations.
2024-10-29 13:25:01 +09:00
David Rodríguez
5fa491b405 Normalize lockfile platforms 2024-10-26 18:44:15 +09:00
Nobuyoshi Nakada
10e0ebc7c2 [ruby/rdoc] Remove details markers in HTML documents
`summary {list-style: none;}` still does not work in Safari 18.

c6a0a6a0d5
2024-10-25 07:12:07 +00:00
tomoya ishida
979e447d7e [ruby/reline] nonprinting_start and nonprinting_end should be
removed
(https://github.com/ruby/reline/pull/771)

e36441652a
2024-10-24 16:36:39 +00:00
Wu
78378cae66 append completion_append_character only when continous completion is … (#764)
* append completion_append_character only when continous completion is not possible

* refactoring

* remove debug puts
2024-10-24 14:12:41 +00:00
Ellen Marie Dash
5549dd2c12 [rubygems/rubygems] [SpecFetcher] Change < to <= like it should be.
3d5135e69b
2024-10-24 00:55:30 +00:00
Guilherme Carreiro
0b3d518e81 [ruby/error_highlight] Rename the ErrorHighlight::DefaultFormatter setting to max_snippet_width for clarity
e13cbd4335
2024-10-24 00:29:20 +00:00
Stan Lo
60c0c324b2 [ruby/rdoc] Red-based darkfish color scheme
(https://github.com/ruby/rdoc/pull/1191)

* Cleanup rdoc.css

* Use red as the highlight color

* Use the same red as ruby-lang.org

* Make main section links stand out more

* Remove scrollbar styling

f69dc470ac
2024-10-23 22:36:27 +00:00
Ellen Marie Dash
60d8435418 [rubygems/rubygems] [SpecFetcher] Avoid unneeded string allocation.
1024505d8e
2024-10-23 20:03:15 +00:00
Ellen Marie Dash
ab7c800ea8 [rubygems/rubygems] [SpecFetcher] Bail before calling available_specs()
0719921af4
2024-10-23 20:03:15 +00:00
Ellen Marie Dash
0f5941a5dd [rubygems/rubygems] Replace .map{...}.compact with .filter_map {...}
18c4ea7d00
2024-10-23 20:03:15 +00:00
Ellen Marie Dash
65fd8606a9 [rubygems/rubygems] Add another bail-early condition to suggest_gems_from_name(), with test.
7bb7c0ac2d
2024-10-23 20:03:14 +00:00
Ellen Marie Dash
ff749d9956 [rubygems/rubygems] Optimize when suggest_gems_from_name finds an exact match.
6c67298584
2024-10-23 20:03:14 +00:00
Ellen Marie Dash
fe66eee1a0 [rubygems/rubygems] Document suggest_gems_from_name()
8f9983cc21
2024-10-23 20:03:13 +00:00
Ellen Marie Dash
35f0b7c83f [rubygems/rubygems] [suggest_gems_from_name] Bail early if the value is guaranteed to be rejected.
56262a9384
2024-10-23 20:03:13 +00:00
David Rodríguez
438d36eb4b [rubygems/rubygems] Print a proper error when there's a previous empty installation path with bad permissions
07e7f0bf5e
2024-10-23 11:16:53 +00:00
David Rodríguez
f2380081df [rubygems/rubygems] Improve Bundler errors when trying to install to a protected folder in macOS
### Before

```
$ GEM_HOME=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/ bundle
Fetching gem metadata from https://rubygems.org/.
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=sqlite3 version=1.3.13 platform=ruby> because it is missing extensions
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=nokogiri version=1.13.8 platform=ruby> because it is missing extensions
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=libxml-ruby version=3.2.1 platform=ruby> because it is missing extensions
Resolving dependencies...
Fetching ruby2_keywords 0.0.5

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Bundler::GenericSystemCallError: There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/shared_helpers.rb:119:in `rescue in filesystem_access'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/shared_helpers.rb:104:in `filesystem_access'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/rubygems_integration.rb:431:in `block in download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/retry.rb:40:in `run'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/retry.rb:30:in `attempt'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/rubygems_integration.rb:423:in `download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:479:in `download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:436:in `fetch_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:420:in `fetch_gem_if_possible'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:162:in `install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/gem_installer.rb:55:in `install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/gem_installer.rb:17:in `install_from_spec'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/parallel_installer.rb:133:in `do_install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/parallel_installer.rb:124:in `block in worker_pool'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:62:in `apply_func'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:57:in `block in process_queue'
  <internal:kernel>:187:in `loop'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:54:in `process_queue'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing ruby2_keywords (0.0.5), and Bundler cannot continue.

In Gemfile:
  ruby2_keywords
```

### After

```
$ GEM_HOME=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/ bundle
There was an error creating `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/bundler.lock`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/bundler.lock
```

345ec45f5a
2024-10-23 08:53:19 +00:00
David Rodríguez
055ed5f592 [rubygems/rubygems] Improve Bundler::GenericSystemCall error message
ccd7e084a8
2024-10-23 08:53:18 +00:00
David Rodríguez
cc29d737ef [rubygems/rubygems] Consistently use :create action when creating directories
It gives better errors.

bedae080ef
2024-10-23 08:53:18 +00:00