Commit graph

183 commits

Author SHA1 Message Date
Hiroshi SHIBATA
aeea88174d
Merge RubyGems and Bundler HEAD
125415593e
2022-05-20 17:32:19 +09:00
David Rodríguez
9a20bcd5c8 [rubygems/rubygems] I don't think this is necessary
836f3e5aa5
2022-04-16 22:58:34 +09:00
David Rodríguez
7d42b442bb [rubygems/rubygems] Support binstubs with --enable-load-relative prolog
32a5e9057a
2022-01-15 00:00:11 +09:00
David Rodríguez
044b0ae8e0 [rubygems/rubygems] Extract a bit of common logic to methods
9a1b891435
2022-01-15 00:00:10 +09:00
David Rodríguez
810516ca31 [rubygems/rubygems] Fix method documentation to be more correct English
bcffd92c48
2022-01-15 00:00:09 +09:00
David Rodríguez
1976b38f7a [rubygems/rubygems] Add support in binstubs for trampolining bundler
If `bundler _<version>_` is given, I guess the most reasonable approach
is to completely skip version switching, because the user is technically
opting out of it. But since binstubs completely remove this argument
from `ARGV` after processing it, we have no way of detecting that it was
actually passed in the first place in order to skip the feature. So we
set `BUNDLER_VERSION` explicitly in this case.

e0f360d6d7
2021-12-20 07:42:53 +09:00
David Rodríguez
7fd88da935 [rubygems/rubygems] Fix race condition when reading & writing gemspecs concurrently
When bundler parallel installer installs gems concurrently, one can get
confusing warnings like the following:

```
"[/home/runner/work/rubygems/rubygems/bundler/tmp/2/gems/system/specifications/zeitwerk-2.4.2.gemspec] isn't a Gem::Specification (NilClass instead).
```

I've got these warnings several times in the past, but I never managed
to reproduce them, and never look deeply into the root cause, but this
time a got a cause that reproduced quite frequently, so I looked into
it.

The problem is one thread reading a gemspec while another thread is
writing it. The write of the gemspec was not protected, so
`Gem::Specification.load` could end up seeing a truncated gemspec and
thus throw this warning.

The fix involve two changes:

* Change the methods that write gemspecs to use `Gem.binary_write` which
  is protected by a lock.

* Fix `Gem.binary_write` to create the file lock at file creation time,
  not when the file already exists after.

The realworld user problem caused by this issue happens in bundler, but
I'm fixing it in rubygems first, and then I'll backport to bundler
whatever needs backporting to fix the issue on the bundler side.

a672e7555c
2021-11-30 20:54:05 +09:00
David Rodríguez
d7f6cb0f78 [rubygems/rubygems] Revert "Remove spec file before building"
This reverts commit af604436d8141c34cb2e1e645b9b0d47bfd55a55.

The issue that led to introducing it was never reproduced. I tried to
repro with this patch and it still works just fine. Since this removal
is getting in the middle for some race conditions I'm facing, I'm
reverting the patch.

2dd267f0e4
2021-11-30 20:54:05 +09:00
David Rodríguez
8bdb56fcaf [rubygems/rubygems] Protect specs access at a finer level
c8cc053bde
2021-11-18 04:37:28 +09:00
Hiroshi SHIBATA
f3bda8987e
Merge the master branch of rubygems repo
Picked from 4b498709a0
2021-11-16 20:19:13 +09:00
David Rodríguez
54ae3f587e [rubygems/rubygems] Prefer require_relative to require for internal requires
c74fc58695
2021-08-31 19:06:14 +09:00
David Rodríguez
553ee573d4 [rubygems/rubygems] Don't use gemdeps on bundler binstub
320fdc1513
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.

b25379a295
2021-08-31 19:06:14 +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
Hiroshi SHIBATA
96741765d8 Merge the master branch of RubyGems 2021-04-15 15:36:15 +09:00
Hiroshi SHIBATA
339227363c Merge RubyGems 3.2.3 and Bundler 2.2.3 2020-12-23 10:17:41 +09:00
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc1 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00
Nobuyoshi Nakada
ebf008b9ae [rubygems/rubygems] Install plugins to user directory
Fixes the `Gem::FilePermissionError` without the privilege.
Initialize `@plugins_dir` to the user gem directory, when
installing with `--user` option.

21a71ac769
2020-07-31 21:07:19 +09:00
David Rodríguez
985309ac38 [rubygems/rubygems] Support PATH's using File::ALT_SEPARATOR in Gem::Installer
Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

710b969b60
2020-07-31 21:07:19 +09:00
David Rodríguez
04d3e0727a [rubygems/rubygems] Move traling if to the same line for readablity
d722b8b578
2020-07-31 21:07:19 +09:00
David Rodríguez
c090c64b4f [rubygems/rubygems] Prefer the standard separator on Windows
It seems like the most common case since it requires no tricks on our
CI environment.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

751c475574
2020-07-31 21:07:19 +09:00
David Rodríguez
a89665b7b1 Enforce no empty lines around class body in rubygems
To normalize the code style with `bundler`.
2020-07-31 21:07:19 +09:00
David Rodríguez
955f1837a1 Use space inside block braces everywhere
To make rubygems code style consistent with bundler.
2020-06-15 21:20:37 +09:00
Olle Jonsson
5eacf4e72c Enable rubocop-performance StartWith cop
- this would keep the could-be-a-string-method matches few
2020-06-05 07:32:42 +09:00
Nobuyoshi Nakada
ef13558fcd
Revert a commit miss in "Fixed potential memory leak"
This reverts an unintentional change in commit
79d9528ddc.
2020-05-22 21:24:51 +09:00
Nobuyoshi Nakada
79d9528ddc
Fixed potential memory leak
Create a wrapper object first, then buffer allocation which can
fail.
2020-05-22 06:50:29 +09:00
David Rodríguez
0d7e0eb2fa [rubygems/rubygems] Prefer tr to gsub when replacing path separators
This is not detected by the `Performance/StringReplacement` cop, I guess
because of using constants. But still seems like a good change.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

f862103133
2020-05-08 14:13:29 +09:00
David Rodríguez
de57d3895e [rubygems/rubygems] Shortcuit method earlier
If the class variable is set, we can skip the whole thing from the
beginning.

Co-authored-by: MSP-Greg <MSP-Greg@users.noreply.github.com>

83abf3a3d4
2020-05-08 14:13:29 +09:00
David Rodríguez
3315ce6904 [rubygems/rubygems] Fix race condition on bundler's parallel installer
When installing in parallel, bundler creates several `Gem::Installer`
instances that run in parallel. These installers access the `@@all` class
variable of `Gem::Specification` concurrently.

If a concurrent thread calls `Gem::Specification.reset` (resetting
`@all` to `nil`) while another thread is running
`Gem::Specification._all` or another method that expects `@@all` to be
loaded and not `nil`, that can result in `Enumerable` methods being
called on `nil`, resulting in crashes.

I fix it by protecting the other concurrent access to the `@all`
variable.

58b343c530
2020-05-08 14:13:29 +09:00
bronzdoc
7db538a7c9 [rubygems/rubygems] Rename version horizon deprecation methods
6afd914fda
2020-05-08 07:38:50 +09:00
bronzdoc
ff37dd7e9e [rubygems/rubygems] Modify files to use new version horizon deprecations
4fe5bb5bf3
2020-05-08 07:38:50 +09:00
David Rodríguez
96064e6f1c
Sync rubygems with current master (#2889) 2020-03-24 15:39:24 +09:00
Hiroshi SHIBATA
600a715c9b
Merge the current master branch of rubygems/rubygems.
Just started to develop RubyGems 3.2.0.
2020-02-01 11:14:57 +09:00
Hiroshi SHIBATA
7d463e360b Merge RubyGems 3.1.0.pre3
* Fix gem pristine not accounting for user installed gems. Pull request
    #2914 by Luis Sagastume.
  * Refactor keyword argument test for Ruby 2.7. Pull request #2947 by
    SHIBATA Hiroshi.
  * Fix errors at frozen Gem::Version. Pull request #2949 by Nobuyoshi
    Nakada.
  * Remove taint usage on Ruby 2.7+. Pull request #2951 by Jeremy Evans.
  * Check Manifest.txt is up to date. Pull request #2953 by David Rodríguez.
  * Clarify symlink conditionals in tests. Pull request #2962 by David
    Rodríguez.
  * Update command line parsing to work under ps. Pull request #2966 by
    David Rodríguez.
  * Properly test `Gem::Specifications.stub_for`. Pull request #2970 by
    David Rodríguez.
  * Fix Gem::LOADED_SPECS_MUTEX handling for recursive locking. Pull request
    #2985 by MSP-Greg.
2019-11-11 16:59:49 +09:00
Hiroshi SHIBATA
1eb503373e
[rubygems/rubygems] filter dependency type and name strictly.
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>

92892bbc3a
2019-09-26 17:48:01 +09:00
David Rodríguez
4f87a1583d
[rubygems/rubygems] Introduce default prerelease requirement
506c5bce49
2019-09-26 17:48:01 +09:00
David Rodríguez
d9e6315177
[rubygems/rubygems] Bump rubocop to 0.74.0 and fix new offenses
d4fc383497
2019-09-05 18:48:15 +09:00
Hiroshi SHIBATA
7664b5cb65
Support the current stable version of Ruby like 2.5 and 2.6. 2019-08-17 17:06:36 +09:00
MSP-Greg
56a28a8728
[rubygems/rubygems] installer.rb - fix #windows_stub_script
use ruby_exe in heredocs instead of ruby.exe

9f1b7d6590
2019-08-17 07:35:49 +09:00
Koichi Sasada
1cffd5b4f0 fix last commit. 2019-08-14 16:30:30 +09:00
Koichi Sasada
182a408c2c
change Proc#to_s format ('@...' -> ' ...') (#2362)
Now Proc#to_s returns
"#<Proc:0x00000237a0f5f170@t.rb:1>".
However, it is convenient to select a file name by (double-)clicking
on some terminals by separating ' ' instead of '@' like
"#<Proc:0x00000237a0f5f170 t.rb:1>"
[Feature #16101]
2019-08-14 16:25:15 +09:00
Vít Ondruch
a3b784b3a0
[rubygems/rubygems] Move default specifications dir definition out of BasicSpecification.
This was never the right place. The method got there just by evolution,
not by design. Move it within default methods, where it suits better.

Since this method is presumably used just internally, it should be safe
to deprecate it and remove later.

0c0dd9458a
2019-07-31 07:47:02 +08:00
Daniel Berger
8103d46a4d
[rubygems/rubygems] Add a package attr_reader to Gem::Installer.
Add some basic specs for the package attr_reader.

68af2a0ee3
2019-07-31 07:47:01 +08:00
David Rodríguez
d0a5467320 Update rubygems with latest upstream changes
Closes: https://github.com/ruby/ruby/pull/2154
2019-04-28 11:07:45 +09:00
hsbt
f28be7e02d Merge rubygems/rubygems from upstream.
The current master branch is
  97b264f0fa

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-02 11:48:18 +00:00
hsbt
08f8cfe14e Merge RubyGems upstream: 56c0bbb69e4506bda7ef7f447dfec5db820df20b
It fixed the multiple vulnerabilities.
  https://blog.rubygems.org/2019/03/05/security-advisories-2019-03.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-05 03:32:58 +00:00
hsbt
4ae3df42f7 Merge RubyGems master@9be7858f7f17eae3058204f3c03e4b798ba18b9c
This version contains the some style changes by RuboCop.

    * 9d810be0ed
    * 61ea98a727
    * 795893dce3
    * 9be7858f7f

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-14 12:59:03 +00:00