Commit graph

14675 commits

Author SHA1 Message Date
João Pinheiro
e62a0126cd [ruby/open-uri] apply default max_redirects
5d29e626bc
2024-07-11 04:49:59 +00:00
Dmitriy Ivliev
6dc0086d20 [rubygems/rubygems] fix s3 source configuration issue
356726bd1a
2024-07-11 02:27:46 +00:00
Evgeni Golov
bc1b4235fb [ruby/net-http] implement talking SSL to the proxy too
https://bugs.ruby-lang.org/issues/16482

ae2d83f88b
2024-07-11 01:56:08 +00:00
fatkodima
70bdc0f777 [ruby/net-http] Add ability to configure default settings for new connections
fed3dcd0c2
2024-07-11 01:51:03 +00:00
MSP-Greg
d605fb54cf [ruby/net-http] net/http.rb - derive SSL_IVNAMES from SSL_ATTRIBUTES
7191bb923b
2024-07-11 01:10:08 +00:00
David Rodríguez
133fec4ce9 [rubygems/rubygems] Fix another strange error when running bundle add in frozen mode
If there's a lockfile, but it's out of sync with the Gemfile because a
dependency has been deleted, and frozen mode is set, Bundler will print
the following strange error:

```
$ bundle add rake
, but the lockfile can't be updated because frozen mode is set

You have deleted from the Gemfile:
* rake (~> 13.2)

Run `bundle install` elsewhere and add the updated Gemfile to version control.
```

This commit changes the error to:

```
Some dependencies were deleted from your gemfile, but the lockfile can't be updated because frozen mode is set

You have deleted from the Gemfile:
* rake (~> 13.2)

Run `bundle install` elsewhere and add the updated Gemfile to version control.
```

452da4048d
2024-07-10 08:04:07 +00:00
David Rodríguez
7e612b7414 [rubygems/rubygems] Fix strange error when running bundle add with frozen mode set
If Gemfile is empty and there's no lockfile (situation after `bundle init`), and
`frozen` is configured, running `bundle add` will result in an strange
error, like this:

```
$ bundle add rake
, but the lockfile can't be updated because frozen mode is set

You have deleted from the Gemfile:
* rake (~> 13.2)

Run `bundle install` elsewhere and add the updated Gemfile to version control.
```

This commit fixes the problem to instead print

152331a9dc
2024-07-10 08:04:07 +00:00
David Rodríguez
140d8318db [rubygems/rubygems] Fix generic platform gems getting incorrectly removed when locked for a specific platform
If they are already in the lockfile as the most specific variant for a
platform, we shouldn't change that unless explicitly unlocking.

a901660498
2024-07-09 16:34:09 +00:00
David Rodríguez
e6c7a309d0 [rubygems/rubygems] Refactor selecting specs from a SpecSet
bcbbff5149
2024-07-09 16:34:09 +00:00
David Rodríguez
dd05191bc3 [rubygems/rubygems] Resolve all platforms directly
Instead of having to do a complete pass after resolve.

To do this, we add to the ruby group all the platform specs with the
same dependencies as the ruby specs.

e50415f2a6
2024-07-09 16:34:08 +00:00
David Rodríguez
00acc70348 [rubygems/rubygems] Don't memoize sorted_spec_names
It's just for debugging and a simple method, so no need.

3230425a9a
2024-07-09 16:34:08 +00:00
David Rodríguez
086cde1651 [rubygems/rubygems] Instantiate Resolver::SpecGroup with explicit priority
e2c1bc1b6c
2024-07-09 16:34:07 +00:00
David Rodríguez
5fdfdc30f1 [rubygems/rubygems] Let resolver consider unique specs from the beginning
It results in more consistent error messages.

a4b34361cc
2024-07-09 16:34:07 +00:00
David Rodríguez
ae6a2d0641 [rubygems/rubygems] Fix wrong version is comment
This RubyGems feature is being released as 3.5.15, so we can stop
monkeypatching RubyGems once support for the previous version is
dropped.

36f146840d
2024-07-08 17:06:26 +00:00
David Rodríguez
39826f384a [rubygems/rubygems] Backport binstub race condition fix to Bundler
b07e46820d
2024-07-08 17:06:25 +00:00
David Rodríguez
e4825a5194 [rubygems/rubygems] Fix another race condition
We also need to protect prior removal of the binstub, otherwise it can
happen that:

* Process A removes prior binstub FOO.
* Process B removes prior binstub FOO (does nothing actually because Process A already removed it).
* Process A writes binstub FOO for gem BAR from the beginning of file.
* Process B writes binstub FOO for gem BAZ from the beginning of file.

Similarly as before, if binstub FOO for gem BAR is bigger that binstub
FOO for gem BAZ, garbage bytes will be left around at the end of the
file, corrupting the binstub.

The solution is to also protect removal of the previous binstub. To do
this, we use a file lock on an explicit `.lock` file.

d99a80e62d
2024-07-08 14:38:31 +09:00
David Rodríguez
d90a930ede [rubygems/rubygems] Properly protect writing binstubs with a file lock
There's an issue when multiple processes try to write the same binstub.
The problem is that our file locking mechanism is incorrect because
files are truncated _before_ they are locked. So it can happen that:

* Process A truncates binstub FOO.
* Process B truncates binstub FOO.
* Process A writes binstub FOO for gem BAR from the beginning of file.
* Process B writes binstub FOO for gem BAZ from the beginning of file.

If binstub FOO for gem BAR is bigger than binstub FOO for gem BAZ, then
some bytes will be left around at the end of the binstub, making it
corrupt.

This was not a problem in our specs until the spec testing binstubs with
the same name coming from different gems changed from using gems named
"fake" and "rack" to using gems named "fake" and "myrack". Because of
the difference in gem name length, the generated binstub for gem
"myrack" is now longer, causing the above problem if binstub for gem
myrack is written first.

The solution is to make sure when using flock to always use modes that
DON'T truncate the file when opening it. So, we use `r+` if the file
exists previously (it requires the file to exist previously), otherwise
we use `a+`.

ce8bcba90f
2024-07-08 14:38:30 +09:00
David Rodríguez
da12d63431 [rubygems/rubygems] Scope rescuing Errno::ENOLCK to just File.open
2a9d347d29
2024-07-08 14:38:29 +09:00
David Rodríguez
7cf7e7e2c0 [rubygems/rubygems] Add missing blank line after method documentation
2df7560ade
2024-07-08 14:38:29 +09:00
David Rodríguez
6db1c53fce [rubygems/rubygems] Remove unnecessary FileUtils usage
All other `chmod` usages in the file use `File.chmod`, so keep it
consistent.

3dc0cf8703
2024-07-08 14:38:28 +09:00
Stan Lo
abaa1b913d [ruby/irb] Bump version to v1.14.0
(https://github.com/ruby/irb/pull/980)

6a9e129714
2024-07-06 17:55:00 +00:00
Stan Lo
32ba86c9be [ruby/irb] Return only commands when completing help command's
argument
(https://github.com/ruby/irb/pull/973)

The command only takes command names as arguments, so we should only
return command names as candidates.

This will help users find a command faster as completion will be
another useful hint too.

7b6557cc24
2024-07-05 17:51:17 +00:00
なつき
88a2a46e23 [rubygems/rubygems] Restrict generic arm to only match 32-bit arm
14c4c16e96
2024-07-05 09:02:52 +00:00
Stan Lo
7fe5f0a1d0 [ruby/irb] Introduce cd command
(https://github.com/ruby/irb/pull/971)

It's essentially a combination of pushws and popws commands that are
easier to use.

Help message:

```
Usage: cd ([target]|..)

IRB uses a stack of workspaces to keep track of context(s), with `pushws` and `popws` commands to manipulate the stack.
The `cd` command is an attempt to simplify the operation and will be subject to change.

When given:
- an object, cd will use that object as the new context by pushing it onto the workspace stack.
- "..", cd will leave the current context by popping the top workspace off the stack.
- no arguments, cd will move to the top workspace on the stack by popping off all workspaces.

Examples:

  cd Foo
  cd Foo.new
  cd @ivar
  cd ..
  cd
```

4a0e0e89b7
2024-07-03 17:17:42 +00:00
Nobuyoshi Nakada
9aa62bda46 [ruby/shellwords] [DOC] Beautify links and formats
53e6ef2e71
2024-07-03 10:15:26 +00:00
Nobuyoshi Nakada
777fcd18a7 [ruby/shellwords] Satisfy rdoc -C
fa50d40a33
2024-07-03 10:15:23 +00:00
Nobuyoshi Nakada
7a43147407 [ruby/shellwords] Exclude unnecessary files from the packages
08c87a964e
2024-07-03 10:15:22 +00:00
Jerome Dalbert
2830a6ae38 [rubygems/rubygems] Only allow valid values for --test, --ci, and --linter options
d4360c9032
2024-07-02 19:54:23 +00:00
David Rodríguez
cd57c1294d [rubygems/rubygems] Only remove current platform when added right before resolution
If it has been explicitly added by `bundle lock --add-platform`, we
don't want to remove it.

09cf921dd6
2024-07-02 19:53:54 +00:00
David Rodríguez
7fc04276ac [rubygems/rubygems] Refactor previous fix a bit
1c80c6072f
2024-07-02 19:53:53 +00:00
Jerome Dalbert
d5500e621c [rubygems/rubygems] Feature add_dependency more prominently
0236cb6191
2024-07-02 19:53:29 +00:00
Stan Lo
d7af8afe1b [ruby/rdoc] Group code object files into the same directory
(https://github.com/ruby/rdoc/pull/1114)

It's hard to distinguish code object classes by their file names alone.
And given that we have 18 such classes, it'd make the codebase a lot
easier to understand if we grouped them into a single directory.

Given that these classes are all autoloaded in `lib/rdoc.rb` instead
of required individually, this change should have minimum impact on
projects using RDoc as they generally just require `rdoc`, not individual
files. An example is Rails' `sdoc`:
https://github.com/rails/sdoc/blob/main/lib/sdoc/rdoc_monkey_patches.rb

4211292ffe
2024-07-02 10:15:00 +00:00
Yudai Takada
15ceb95d78 [ruby/rdoc] Fix some typos (https://github.com/ruby/rdoc/pull/1129)
* constist ==> consist

* Tidyness ==> Tidiness

* Currentry ==> Currently

* valus ==> values

8412705721
2024-07-01 11:08:37 +09:00
tomoya ishida
de2d9c8e22 [ruby/irb] Allow assigning and using local variable name conflicting
with command
(https://github.com/ruby/irb/pull/961)

00603d470f
2024-06-30 17:13:27 +00:00
David Rodríguez
98c923ff4b
Synchronize Bundler & RubyGems (#11071) 2024-06-28 10:12:29 -04:00
David Rodríguez
5c826ebea5 [rubygems/rubygems] Protect binstub access during creation with a flock
88e3f1d23c
2024-06-28 10:49:07 +00:00
David Rodríguez
091a6ea8c1 [rubygems/rubygems] Move flock logic to its own method
91274128a8
2024-06-28 10:49:06 +00:00
David Rodríguez
f41a2c96c3 [rubygems/rubygems] More compact open_file fallback on Windows
8f34396af6
2024-06-28 10:49:06 +00:00
David Rodríguez
815b345b41 [rubygems/rubygems] Print a proper error when bin dir does not have writable permission bit
979cd898f9
2024-06-27 12:53:05 +00:00
David Rodríguez
d29a76b90b [rubygems/rubygems] Only override pre_install_checks when necessary
RubyGems >= 3.5 no longer raises `Gem::FilePermissionError` explicitly.

df54b9fd90
2024-06-27 12:53:04 +00:00
Jerome Dalbert
c6c817df28 [rubygems/rubygems] Add --no-test, --no-ci, and --no-linter options
f58660ffcc
2024-06-26 11:24:47 +00:00
Thomas Marshall
b88ac94eec [rubygems/rubygems] Only validate resolution info in Bundler
This commit switches out the full gemspec validation for a partial one
which only performs resolution related checks. This will allow gem
authors to run `bundle` commands immediately after creating a new gem
with Bundler, rather than having to fix metadata validation issues in
the default gemspec.

d5aa9cae9d
2024-06-25 14:32:20 +00:00
Thomas Marshall
39951293b4 [rubygems/rubygems] Add Specification#validate_for_resolution
This method validates only what is required for resolution, skipping any
irrelevant metadata validation. This will be used by Bundler instead of
doing a full validation, allowing gem authors to use `bundle` commands
immediately in newly created gems without first having to fix invalid
metafata fields in the default gemspec.

da7704cfc0
2024-06-25 14:32:19 +00:00
Josef Šimánek
bfb4272d8a [rubygems/rubygems] Regenerate bundler docs for June 2024.
72103ca1e8
2024-06-25 12:55:56 +00:00
tomoya ishida
691d85d342 [ruby/reline] Rerender and enter raw mode again by SIGCONT
(https://github.com/ruby/reline/pull/727)

be45660c83
2024-06-25 00:55:07 +00:00
ccmywish
185a6c991e [rubygems/rubygems] Update contents of gem.bat on Windows
(https://github.com/rubygems/rubygems/pull/6483)

41d8cffd2e

Co-Authored-By: MSP-Greg <Greg.mpls@gmail.com>
2024-06-21 02:27:47 +00:00
nick evans
b558fc0e36 [ruby/securerandom] Update UUID documentation with RFC9562 links
RFC9562 was released almost two weeks ago, so we can replace the "draft"
UUIDv7 URL with the final RFC URL too.  RFC9562 obsoletes RFC4122, so I
replaced its link as well.

1e41c3d2cb
2024-06-20 08:34:31 +00:00
David Rodríguez
f7acfeb4ce [rubygems/rubygems] Fix credentials being readded when re-resolving without a full unlock
a8670e43f8
2024-06-20 07:15:06 +00:00
David Rodríguez
bf6b8dd6a8 [rubygems/rubygems] Fix bundle update <gem_name> edge case
When locked only to RUBY, and some locked spec does not meet locked
dependencies, Bundler would remove the only locked platform and end up
creating a lockfile with empty sections.

We can't rely on our criteria to remove invalid platforms if locked
specs are not valid in the first place.

1dba05cf53
2024-06-20 07:14:47 +00:00
David Rodríguez
ae7d609456 [rubygems/rubygems] Don't expire git specs unnecessarily when remote! or cached! are used
04b26731cb
2024-06-20 15:22:20 +09:00