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

1327 Коммитов

Автор SHA1 Сообщение Дата
Dmitriy Ivliev 6dc0086d20 [rubygems/rubygems] fix s3 source configuration issue
https://github.com/rubygems/rubygems/commit/356726bd1a
2024-07-11 02:27:46 +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.

https://github.com/rubygems/rubygems/commit/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+`.

https://github.com/rubygems/rubygems/commit/ce8bcba90f
2024-07-08 14:38:30 +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.

https://github.com/rubygems/rubygems/commit/3dc0cf8703
2024-07-08 14:38:28 +09:00
なつき 88a2a46e23 [rubygems/rubygems] Restrict generic `arm` to only match 32-bit arm
https://github.com/rubygems/rubygems/commit/14c4c16e96
2024-07-05 09:02:52 +00:00
Jerome Dalbert d5500e621c [rubygems/rubygems] Feature add_dependency more prominently
https://github.com/rubygems/rubygems/commit/0236cb6191
2024-07-02 19:53:29 +00:00
David Rodríguez 5c826ebea5 [rubygems/rubygems] Protect binstub access during creation with a flock
https://github.com/rubygems/rubygems/commit/88e3f1d23c
2024-06-28 10:49:07 +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.

https://github.com/rubygems/rubygems/commit/da7704cfc0
2024-06-25 14:32:19 +00:00
ccmywish 185a6c991e [rubygems/rubygems] Update contents of gem.bat on Windows
(https://github.com/rubygems/rubygems/pull/6483)

https://github.com/rubygems/rubygems/commit/41d8cffd2e

Co-Authored-By: MSP-Greg <Greg.mpls@gmail.com>
2024-06-21 02:27:47 +00:00
Yuri Kanivetsky 84c9f2a240 [rubygems/rubygems] Make "bundler? update --bundler" behave identically
https://github.com/rubygems/rubygems/commit/30dce3f87d
2024-06-20 00:12:31 +00:00
Alexey Schepin a3930db275 [rubygems/rubygems] Delete extra spaces left after rubocop autofix
https://github.com/rubygems/rubygems/commit/a552732bed
2024-06-18 01:52:04 +00:00
Yuta Saito 97a23db5ac [rubygems/rubygems] Disable `install_extension_in_lib` when cross-compiling
https://github.com/rubygems/rubygems/commit/643e154f32
2024-06-18 00:59:36 +00:00
Yuta Saito 273d41b9e3 [rubygems/rubygems] Add `--target-rbconfig` option to `gem install` and `gem update` commands
This patch adds `--target-rbconfig` option to specify the rbconfig.rb file
for the deployment target platform. This is useful when cross-compiling
gems. At the moment, this option is only available for `extconf.rb`-based
extensions.

https://github.com/rubygems/rubygems/commit/cf2843f7a2
2024-06-18 00:59:35 +00:00
David Rodríguez 62fc473224 [rubygems/rubygems] Never remove executables that may belong to a default gem
https://github.com/rubygems/rubygems/commit/ed585f2fca
2024-06-14 08:02:38 +00:00
David Rodríguez c2f8e91815 [rubygems/rubygems] Also disambiguate gems not in the first Gem.path position
https://github.com/rubygems/rubygems/commit/7e6e7ccc58
2024-06-13 14:25:14 +00:00
David Rodríguez 5c573b7652 [rubygems/rubygems] Fix default gem priority when sorting specs
https://github.com/rubygems/rubygems/commit/8dbe1dbdc7

Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
2024-06-13 14:25:14 +00:00
David Rodríguez 82b68bc358 [rubygems/rubygems] Move Bundler settings specific logic to Bundler
https://github.com/rubygems/rubygems/commit/7d1e8be2ce
2024-06-06 18:53:29 +00:00
David Rodríguez 10c256f98f Sychronize with rubygems/rubygems repo 2024-06-01 01:13:55 +09:00
David Rodriguez 8e2a6435e4 [rubygems/rubygems] Fix `gem uninstall` warning when two versions of psych installed
https://github.com/rubygems/rubygems/commit/1b5644b666
2024-05-31 15:09:37 +00:00
David Rodríguez f4f56b23c3 [rubygems/rubygems] Make stub sorting stable
https://github.com/rubygems/rubygems/commit/6b70e9043d
2024-05-31 11:58:00 +00:00
Hiroshi SHIBATA ba8e6e77fd
Revert "[rubygems/rubygems] Fix `gem pristine` sometimes failing to pristine user installed gems"
This reverts commit a3edc4abc5.

That commit caused test failure with Windows platform.

* https://github.com/ruby/ruby/actions/runs/9289018414/job/25561871390
* https://github.com/ruby/ruby/actions/runs/9289018425/job/25561873060
2024-05-30 12:46:19 +09:00
David Rodriguez a3edc4abc5 [rubygems/rubygems] Fix `gem pristine` sometimes failing to pristine user installed gems
https://github.com/rubygems/rubygems/commit/0eb6ed8f86
2024-05-29 15:35:04 +00:00
License Update 5853a38043 [rubygems/rubygems] Update SPDX license list as of 2024-05-22
https://github.com/rubygems/rubygems/commit/f91ac04397
2024-05-27 01:45:38 +00:00
David Rodriguez c55c11d7d5 [rubygems/rubygems] Fix binstubs sometimes not getting regenerated when `--destdir` is given
This was only working for gems also installed in the default gem home.

https://github.com/rubygems/rubygems/commit/47df02dbd9
2024-05-16 13:34:33 +00:00
David Rodriguez 35c5c7edb9 [rubygems/rubygems] Refactor `Gem::Specification#find_all_by_name`
So that it can also be delegated to `Gem::SpecificationRecord`.

https://github.com/rubygems/rubygems/commit/1407807a99
2024-05-16 13:34:33 +00:00
David Rodriguez 5111b3d479 [rubygems/rubygems] Fix `gem uninstall --user-install` for symlinked HOME's
https://github.com/rubygems/rubygems/commit/7f0706a897
2024-05-16 11:55:53 +00:00
David Rodriguez 847fc9af18 [rubygems/rubygems] Fix error message calling method removed a long time ago
https://github.com/rubygems/rubygems/commit/5fbe5e43d6
2024-05-16 11:55:52 +00:00
David Rodriguez 965cb3ab4c [rubygems/rubygems] Fix issue when cleaning up plugin stubs
When `gem uninstall <gem> --install-dir <dir>` is run, if the version
removed had a plugin, and that same version happened to also be
installed globally, then the plugin stub would fail to be removed.

https://github.com/rubygems/rubygems/commit/4e2fa0be77
2024-05-14 16:08:03 +00:00
David Rodriguez bd84236169 [rubygems/rubygems] Extract a `Gem::SpecificationRecord` class
This class handles all logic to handle the list of specifications, given
a set of GEM_PATH directories. Makes `Gem::Specification` has less
responsibilities and will help with fixing some bugs next.

https://github.com/rubygems/rubygems/commit/df280dbbed
2024-05-14 16:08:03 +00:00
David Rodriguez c219ee00b4 [rubygems/rubygems] Fix typo in attribute documentation
https://github.com/rubygems/rubygems/commit/8c9807092c
2024-05-14 16:08:02 +00:00
David Rodriguez 5628cc1229 [rubygems/rubygems] Add missing docs
Other analog methods are documented, so document this one too.

https://github.com/rubygems/rubygems/commit/76da34d44d
2024-05-14 16:08:02 +00:00
David Rodriguez 91e3871970 [rubygems/rubygems] Simplify documentation
I don't think this method is any worse than others, let's only document
what it does.

https://github.com/rubygems/rubygems/commit/dec722187f
2024-05-14 16:08:01 +00:00
David Rodriguez 4dc0b23018 [rubygems/rubygems] Remove redundant receivers
https://github.com/rubygems/rubygems/commit/7b71965a70
2024-05-14 16:08:00 +00:00
Samuel Giddins 02c8e6583b [rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
https://github.com/rubygems/rubygems/commit/716666f65f
2024-05-13 13:01:44 +00:00
Vít Ondruch 5880103450 [rubygems/rubygems] Use spec.base_dir to remove plugins
The plugin loader from `@gem_home` was removed during uninstallation.
However, this could leave behind the plugins for `--user-install`
installed gems.

Use `Gem::Specifictaions#base_dir` instead. This ensures that the plugin
loader for associated .gemspec is uninstalled.

https://github.com/rubygems/rubygems/commit/6047f78210
2024-05-13 10:35:57 +00:00
Yuta Saito 80adf6a18c [rubygems/rubygems] Accept WASI as an OS name in Gem::Platform
https://github.com/rubygems/rubygems/commit/1209d3c6b0
2024-05-07 05:36:35 +00:00
David Rodriguez 5c018cddcc [rubygems/rubygems] Remove unnecessary compatibility code
https://github.com/rubygems/rubygems/commit/160a515412
2024-05-06 17:06:50 +00:00
David Rodriguez 281df1e495 [rubygems/rubygems] Remove `Gem::Specification#mark_version`
This gets in the middle if we ever start allowing to build as if using a
different RubyGems version than the one being run.

This could be useful to make `gem rebuild` a little more usable, and
it's already done by Bundler specs which already make this method a noop
when they need this.

I'm not sure forcefully setting this, even if user explicitly specified
something else is helpful.

Since this could potentially prevent gems explicitly setting a constant
RubyGems version from building, I changed the error of incorrect
RubyGems version from a hard error to a warning, since it will start
happening in those cases if we stop overwriting the version.

https://github.com/rubygems/rubygems/commit/45676af80d
2024-05-03 15:12:55 +00:00
Jenny Shen c1b11c50cb [rubygems/rubygems] Rename credential email to identifier in WebAuthn poller
https://github.com/rubygems/rubygems/commit/5e3e55f8bc
2024-05-03 10:54:27 +00:00
Samuel Giddins d7ba0fec49 [rubygems/rubygems] Update lib/rubygems/package.rb
https://github.com/rubygems/rubygems/commit/c4e75b9f74
2024-04-30 15:34:49 +00:00
Samuel Giddins d950609ec7 [rubygems/rubygems] Add a limit to the size of the metadata and checksums files in a gem package.
This is to prevent a malicious gem from causing a denial of service by
including a very large metadata or checksums file,
which is then read into memory in its entirety just by opening the gem package.

This is guaranteed to limit the amount of memory needed, since
gzips (which use deflate streams for compression) have a maximum compression
ratio of 1032:1, so the uncompressed size of the metadata or checksums file
will be at most 1032 times the size of the (limited) amount of data read.

This prevents a gem from causing 500GB of memory to be allocated
to read a 500MB metadata file.

https://github.com/rubygems/rubygems/commit/a596e3c5ec
2024-04-30 15:34:48 +00:00
David Rodríguez 53571de8e9 [rubygems/rubygems] Fix circular require warning
https://github.com/rubygems/rubygems/commit/241d0aafcd
2024-04-29 09:04:33 +00:00
Nobuyoshi Nakada 9b580ee7b6 [rubygems/rubygems] Clear temporary directory
https://github.com/rubygems/rubygems/commit/4158034d89
2024-04-21 23:47:47 +00:00
Hiroshi SHIBATA 0930231361 [rubygems/rubygems] Allow to use String keys some of configuration
https://github.com/rubygems/rubygems/commit/ee0bef2786
2024-04-04 11:30:02 +09:00
Hiroshi SHIBATA 0be7133b7f [rubygems/rubygems] Re-order configuraiton keys
https://github.com/rubygems/rubygems/commit/b2a88983db
2024-04-04 11:30:01 +09:00
Ellen Marie Dash 174b671699 [rubygems/rubygems] [commands/rebuild] Remove unused DATE_FORMAT constant.
https://github.com/rubygems/rubygems/commit/3c4e3fadc9
2024-03-31 02:37:13 +00:00
Ellen Marie Dash 38331c8981 [rubygems/rubygems] [gemspec_helpers] Fix Rubocop warning.
https://github.com/rubygems/rubygems/commit/4ebf6ee5ac
2024-03-29 08:03:41 +00:00
Ellen Marie Dash d19744fbd6 [rubygems/rubygems] [build, rebuild] Split common find_gemspec() out to GemspecHelpers.
https://github.com/rubygems/rubygems/commit/2f80a595c4
2024-03-29 08:03:40 +00:00
Ellen Marie Dash d916dbcb84 [rubygems/rubygems] Improve formatting of "gem rebuild --help" output.
https://github.com/rubygems/rubygems/commit/701550f9dd
2024-03-29 08:03:40 +00:00
Ellen Marie Dash 54d90e1355 [rubygems/rubygems] [rebuild] If --diff is not passed and a rebuild fails, suggest passing --diff.
https://github.com/rubygems/rubygems/commit/7caadd182c
2024-03-29 08:03:39 +00:00