Commit graph

67695 commits

Author SHA1 Message Date
Daniel Niknam
49176e8c8c
[rubygems/rubygems] Refactor Bundler::Dsl#check_rubygems_source_safety to improve readability
`check_rubygems_source_safety` is responsible for:

1. if there are multiple global sources
  - for bundle 3.x raise an error
  - for bundle 2.x print a warning
2. print a warning if there is no explicit global source

The second responsibility was added recently and now the logic could be
extracted to improve readability. Conditions are still live in the `check_rubygems_source_safety` method
since we don't want to call both functions always and that would help us achieve that.

f3d7e946ee
2021-07-27 09:25:57 +09:00
Daniel Niknam
1ef360230e
[rubygems/rubygems] Deprecate Gemfile without an explicit global source
Raise a warning when parsing a Gemfile and it doesn't have a global source. Gemfiles like this, specially now that rubygems sources are are no longer merged into a single source for security, are very confusing because they generate a different lockfile depending on the gems you have locally installed. This is because bundler always use an implicit global source that defaults to locally installed gems.

b7523ad21c
2021-07-27 09:25:57 +09:00
Daniel Niknam
2f9e0cf181
[rubygems/rubygems] Explicitly define a global source for tests
This is in preparation for deprecating source-less gemfiles.

d6493fa3e2
2021-07-27 09:25:57 +09:00
Daniel Niknam
b500e8fab4
[rubygems/rubygems] Implement Bundler::SourceList#implicit_global_source?
This method is created to tell whether any global source exist in the object or not and it will be used by `Bundler:Dsl` to print a warning if no global source has been defined in the Gemfile.

422fec4438
2021-07-27 09:25:57 +09:00
Daniel Niknam
91a3f06e98
[rubygems/rubygems] Implement Bundler::Source::Rubygems#no_remotes?
This method is created to tell whether any remote exist in the object or not and it will be used by `Bundler:SourceList` to tell if a global source has been defined implicitly or not.

47e3ff0e47
2021-07-27 09:25:56 +09:00
David Rodríguez
095b5bbcc1
[rubygems/rubygems] Lazily load shellwords
ef6388656a
2021-07-27 09:25:56 +09:00
David Rodríguez
350f4a0b66
[rubygems/rubygems] Rubygems doesn't need to load the base64 library
fe723c0f7f
2021-07-27 09:25:56 +09:00
David Rodríguez
960023ff54
[rubygems/rubygems] Rubygems doesn't need to load the resolv library
8bf41f53cc
2021-07-27 09:25:56 +09:00
David Rodríguez
9cddc0ec94
[rubygems/rubygems] Lazily load shellwords library
e5532ef886
2021-07-27 09:25:56 +09:00
David Rodríguez
9ac89fe35e
[rubygems/rubygems] The --quiet should still display warnings
The is the previous intentional behaviour until
ca0676cb1c.

In my opinion, that previous behaviour was better and should be
restored, because we want our users to always see warnings and fix them.
And the original issue that motivated the change is fixable by other
means, namely through `BUNDLE_SILENCE_ROOT_WARNING`, or through
`BUNDLE_SILENCE_DEPRECATIONS` in general. Finally, the --quiet option is
still documented as "only print errors and warnings".

So this PR essentially reverts
ca0676cb1c
for the above reasons.

35f2254dfc
2021-07-27 09:25:56 +09:00
David Rodríguez
24aca87def
[rubygems/rubygems] Make --quiet spec independent on the specific warning
We'll be removing the warning about no gem sources, so this spec will no
longer test that warnings are hidden by `--quiet`.

Test that in another way so that we don't lose the coverage when we
drop the specific warning about no gem server sources.

cce4f86d28
2021-07-27 09:25:56 +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

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.

afcb15d556
2021-07-27 09:25:56 +09:00
David Rodríguez
6bcedabfdd
[rubygems/rubygems] Remove gem install hint when installing a gem fails
A fresh `gem install` might not reproduce the exact `bundle install`
environment that originally caused the error. It also makes it harder
for the user to troubleshoot the error since she needs to run a separate
command.

Instead, show the original error and backtrace directly.

49c2abfec6
2021-07-27 09:25:55 +09:00
David Rodríguez
6eb6f740f2
[rubygems/rubygems] Show a backtrace in case gem installation fails
For example, due to extension compilation issues.

adbe55bb6a
2021-07-27 09:25:55 +09:00
David Rodríguez
4271f4aea5
[rubygems/rubygems] Fix bundler binstub version selection
To mimic built-in rubygems behaviour, only thing that should be
approximated is the lockfile version. Other alternatives like
`BUNDLER_VERSION` should be respected exactly.

dbd667d4bc
2021-07-27 09:25:55 +09:00
Daniel Niknam
90899c50c2
[rubygems/rubygems] Remove LoadError message in regards to requiring a relative file
Ruby 1.9.2 removed "." from LOAD_PATH for robustness and security reasons.
This code was introduced by 56fc830e19 commit
to helping users understand the issue and had a guard condition to include the message for `RUBY_VERSION >= "1.9"`.
However, the guard condition was removed as part of the "Ruby version leftover" cleanup by
8c9cf76e41

Ruby 1.9 development was ended a long time ago and this message is not useful anymore.

a23609b15a
2021-07-27 09:25:55 +09:00
Andrew Haines
705b1bdef2
[rubygems/rubygems] Fix interrupt handling in Bundler workers
The existing interrupt handling using `SharedHelpers.trap` fails when the previous
handler for a signal is not callable (for example, when it is the string "DEFAULT").

Instead, we now handle interrupts by aborting the process when worker threads are
running, and restore the previous handler after worker threads are finished.

Fixes #4764.

b9f455d487
2021-07-27 09:25:55 +09:00
Benoit Daloze
c8172d0b96 rb_iterate is no longer used in ruby/spec 2021-07-26 13:24:38 +02:00
Nobuyoshi Nakada
b8386f7f7f
Prepend DebugSystem to VCS class only
And revert 24e5f1c982, pepending to
Kernel did not affect the top level methods before 3.0.
2021-07-26 15:44:40 +09:00
Nobuyoshi Nakada
24e5f1c982
Ignore 7z unless available
`DebugSystem#system` is prepended in vcs.rb and defaulted to
`exception: true`.
2021-07-26 14:17:30 +09:00
git
165a098ffc * 2021-07-26 [ci skip] 2021-07-26 05:09:20 +09:00
Nobuyoshi Nakada
070557afc4 Distinguish signal and timeout [Bug #16608] 2021-07-25 13:09:03 -07:00
Kazuhiro NISHIYAMA
8897098b5c
Update bundled_gems 2021-07-25 20:58:58 +09:00
git
02facb86da * 2021-07-25 [ci skip] 2021-07-25 20:07:55 +09:00
Nobuyoshi Nakada
b360588cd3
Sort feature index arrays by the priority of file types [Bug #15856]
When looking for libraries to load with a feature name without
extension, `.rb` files are given priority. However, since the
feature index arrays were not in that order of priority, but in
the order in which they were loaded, a lower priority extension
library might be returned. In that case, the `.rb` file had to be
searched for again from the `$LOAD_PATH`, resulting in poor
performance.
2021-07-24 23:59:07 +09:00
git
971d24cd97 * 2021-07-24 [ci skip] 2021-07-24 17:58:57 +09:00
Nobuyoshi Nakada
eec45a93ef
Escape unprintable chars only, without surrounding quotes 2021-07-24 14:31:41 +09:00
Nobuyoshi Nakada
8cc18703cf
[NEWS] added [Feature #17798] [ci skip] 2021-07-23 12:43:51 +09:00
Nobuyoshi Nakada
5385731374
[NEWS] adjusted formats [ci skip] 2021-07-23 12:41:01 +09:00
Nobuyoshi Nakada
377995035a Suppress exception message in finalizer [Feature #17798] 2021-07-23 12:01:15 +09:00
Nobuyoshi Nakada
fc4dd45d01 Show exception in finalizer [Feature #17798] 2021-07-23 12:01:15 +09:00
Nobuyoshi Nakada
63e5f4df38 Access rb_execution_context_t::errinfo directly 2021-07-23 12:01:15 +09:00
Nobuyoshi Nakada
b726c4ee38 Use rb_equal
It can be optimized and handles Qnil properly.
2021-07-23 10:25:37 +09:00
Nobuyoshi Nakada
4da07ac2f3 Finalizers no longer store the safe level 2021-07-23 10:25:37 +09:00
git
fc78a08904 * 2021-07-23 [ci skip] 2021-07-23 03:13:31 +09:00
manga_osyo
86e0eecc84 [ruby/irb] Fix #256
Support int that follow on symbeg in IRB

90cb27b1bd
2021-07-23 03:13:14 +09:00
Peter Zhu
62661dd9e4 Don't recompute the heap page
We already page the page of the zombie calculated. Don't recalculate the
page.
2021-07-22 10:10:23 -04:00
Peter Zhu
018f3961ae Don't set flags in finalize_list
The call after it to `heap_page_add_freeobj` will set the flags.
2021-07-22 10:10:23 -04:00
Nobuyoshi Nakada
75f60e5a46 Sort out quad_t related macros 2021-07-22 15:41:42 +09:00
S.H
fc50b2eae5
Remove unneeded function declarations 2021-07-22 15:41:03 +09:00
Ulysses Zhan
e4b68ab700
[DOC] Fixed the description of regexp alternations [ci skip] 2021-07-22 14:10:57 +09:00
S-H-GAMELINKS
d6b8819b79 Refactor rb_proc_call_with_block function 2021-07-22 14:02:54 +09:00
S-H-GAMELINKS
e882905d0d Refactor sym_each_i function 2021-07-22 14:02:23 +09:00
Nobuyoshi Nakada
e3cda75436
Remove useless casts 2021-07-22 09:58:23 +09:00
Nobuyoshi Nakada
a4e39112a8
Cast to size_t instead of int
len and *retlen are size_t since r22957
(commit:4de12b6ae9a7fc1e28ada4b62291a78f28ae7528).
2021-07-22 09:52:29 +09:00
Peter Zhu
31144fe987 Change GC verification to walk all pages
`gc_verify_internal_consistency_` does not walk pages in the tomb heap
so numbers were off. This commit changes it to walk all allocated pages.
2021-07-21 14:40:44 -04:00
git
f5f7010613 * 2021-07-22 [ci skip] 2021-07-22 02:06:59 +09:00
eileencodes
b940a45357 Fix interpolated heredoc
This fixes https://bugs.ruby-lang.org/issues/18038. The provided
reproduction showed that this happens in heredocs with double
interpolation. In this case `DSTR` was getting returned but needs to be
convered to a `EVSTR` which is what is returned by the function. There
may be an additional bug here that we weren't able to produce. It seems
odd that `STR` returns `DSTR` while everything else should return
`EVSTR` since the function is `new_evstr`.

[Bug #18038][ruby-core:104597]

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-07-21 10:06:33 -07:00
Nobuyoshi Nakada
fa308a683d
Update bundled_gems 2021-07-21 20:44:34 +09:00