Commit graph

12164 commits

Author SHA1 Message Date
Sutou Kouhei
1f46793406 [ruby/csv] parser: add one more trace
5df650be0c
2023-06-28 16:37:09 +09:00
Nobuyoshi Nakada
ae71bbbc44 [ruby/syntax_suggest] [DOC] Fix method name
08a9afb64f
2023-06-28 16:34:53 +09:00
tomoya ishida
8aedfefb21 [ruby/irb] Remove keyword exception from Context#evaluate because
the value is always nil
(https://github.com/ruby/irb/pull/617)

62691384f8
2023-06-27 20:43:53 +00:00
Stan Lo
caddd0274b [ruby/irb] Move input line mutation out of Context#evaluate
(https://github.com/ruby/irb/pull/615)

This makes sure `Context#evaluate` really just evaluates the input.
It will also make #575's implementation cleaner.
2023-06-27 19:51:18 +00:00
Hiroshi SHIBATA
9dd8698597 [rubygems/rubygems] Fixup
https://github.com/rubygems/rubygems/pull/6766

c5c5797227
2023-06-27 07:37:24 +00:00
Hiroshi SHIBATA
a99d0c1555 [rubygems/rubygems] Removed unused variable
68cc941bed
2023-06-27 02:15:40 +00:00
Hiroshi SHIBATA
65c2179336 [rubygems/rubygems] Molinillo::DependencyGraph is initialized in Molinillo::Resolver#resolve
1c39e24c95
2023-06-27 02:15:40 +00:00
Nobuyoshi Nakada
8307627245 [ruby/uri] String literals are frozen now
0b6ad60af6
2023-06-25 15:45:32 +00:00
Nobuyoshi Nakada
c21436cb35 [ruby/uri] Fix host part in relative referece #83
In relative referece, host part can be ommitted but can not be empty.

2980f0ba02
2023-06-25 15:24:05 +00:00
tomoya ishida
00216c8aa0 [ruby/irb] Fix process_continue(rename to should_continue?) and
check_code_block(rename to check_code_syntax)
(https://github.com/ruby/irb/pull/611)

b7f4bfaaa4
2023-06-25 05:12:16 +00:00
tomoya ishida
406799cae8 [ruby/irb] Omit nesting_level, use indent_level to build prompt
string
(https://github.com/ruby/irb/pull/610)

f01ff0811b
2023-06-24 22:20:43 +00:00
Hiroshi SHIBATA
b7375770ef [ruby/timeout] Bump up v0.4.0
413194f8d2
2023-06-23 03:52:03 +00:00
Jeremy Evans
e8c9385123 [ruby/timeout] Raise exception instead of throw/catch for timeouts
(https://github.com/ruby/timeout/pull/30)

throw/catch is used for non-local control flow, not for exceptional situations.
For exceptional situations, raise should be used instead.  A timeout is an
exceptional situation, so it should use raise, not throw/catch.

Timeout's implementation that uses throw/catch internally causes serious problems.
Consider the following code:

```ruby
def handle_exceptions
  yield
rescue Exception => exc
  handle_error # e.g. ROLLBACK for databases
  raise
ensure
  handle_exit unless exc # e.g. COMMIT for databases
end

Timeout.timeout(1) do
  handle_exceptions do
    do_something
  end
end
```

This kind of design ensures that all exceptions are handled as errors, and
ensures that all exits (normal exit, early return, throw/catch) are not
handled as errors.  With Timeout's throw/catch implementation, this type of
code does not work, since a timeout triggers the normal exit path.

See https://github.com/rails/rails/pull/29333 for an example of the damage
Timeout's design has caused the Rails ecosystem.

This switches Timeout.timeout to use raise/rescue internally.  It adds a
Timeout::ExitException subclass of exception for the internal raise/rescue,
which Timeout.timeout will convert to Timeout::Error for backwards
compatibility.  Timeout::Error remains a subclass of RuntimeError.

This is how timeout used to work in Ruby 2.0.  It was changed in Ruby 2.1,
after discussion in [Bug #8730] (commit
238c003c92 in the timeout repository). I
think the change from using raise/rescue to using throw/catch has caused
significant harm to the Ruby ecosystem at large, and reverting it is
the most sensible choice.

From the translation of [Bug #8730], it appears the issue was that
someone could rescue Exception and not reraise the exception, causing
timeout errors to be swallowed.  However, such code is broken anyway.
Using throw/catch causes far worse problems, because then it becomes
impossible to differentiate between normal control flow and exceptional
control flow.

Also related to this is [Bug #11344], which changed how
Thread.handle_interrupt interacted with Timeout.

f16545abe6

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-06-22 18:24:46 +00:00
ima1zumi
218a8d8ef1 [ruby/reline] Remove unused method
(https://github.com/ruby/reline/pull/557)

`get_mbchar_byte_size_by_first_char` isn't used in Reline.
Also, this method implements the same functionality as `String#bytesize` and is unnecessary.
2023-06-22 17:07:23 +00:00
Jeremy Evans
de51a4a13e [ruby/ipaddr] Consider IPv4-mapped IPv6 addresses private if IPv4 address is private
Fixes [Bug #19479]

7faa0768d3
2023-06-22 16:40:46 +00:00
Jemma Issroff
cc7f765f2c [Feature #19741] Sync all files in yarp
This commit is the initial sync of all files from ruby/yarp
into ruby/ruby. Notably, it does the following:

* Sync all ruby/yarp/lib/ files to ruby/ruby/lib/yarp
* Sync all ruby/yarp/src/ files to ruby/ruby/yarp/
* Sync all ruby/yarp/test/ files to ruby/ruby/test/yarp
2023-06-21 11:25:39 -07:00
tomoya ishida
e25403d0d9 [ruby/irb] Improve indentation: bugfix, heredoc, embdoc, strings
(https://github.com/ruby/irb/pull/515)

* Implement heredoc embdoc and string indentation with bugfix

* Fix test_ruby_lex's indentation value

* Add embdoc indent test

* Add workaround for lines==[nil] passed to auto_indent when exit IRB with CTRL+d
2023-06-20 15:13:43 +00:00
Yuta Kusuno
9ce6e09637 [ruby/reline] Omit constant under Struct
(https://github.com/ruby/reline/pull/554)

8761a11fa5
2023-06-20 14:02:58 +00:00
Hiroshi SHIBATA
1edbaa850f Merge rubygems/rubygems HEAD
Pick from 880dd95996
2023-06-20 13:35:13 +09:00
tomoya ishida
b8cd79c82f [ruby/irb] Add missing token that ignored by ripper
(https://github.com/ruby/irb/pull/608)

1cd3b45402
2023-06-19 10:38:24 +00:00
Hiroshi SHIBATA
5bc1b56c14 [rubygems/rubygems] Auto-correct Performance/FlatMap
b696edcd73
2023-06-16 04:10:38 +00:00
tomoya ishida
364a6d56d7 [ruby/irb] Rewrite RubyLex to fix some bugs and make it possible to
add new features easily
(https://github.com/ruby/irb/pull/500)

* Add nesting level parser for multiple use (indent, prompt, termination check)

* Rewrite RubyLex using NestingParser

* Add nesting parser tests, fix some existing tests

* Add description comment, rename method to NestingParser

* Add comments and tweak code to RubyLex

* Update NestingParser test

* Extract list of ltype tokens to constants
2023-06-15 15:39:58 +00:00
Petrik
0c55ef1150 [ruby/rdoc] Use flat_map for better performance
76192a280d
2023-06-14 23:47:25 +00:00
Hiroshi SHIBATA
c2f4b41480
Merge rubygems/rubygems HEAD
Pick from 7a7b234721
2023-06-15 07:02:03 +09:00
Hiroshi SHIBATA
827d66266b [rubygems/rubygems] auto-correct Style/YodaCondition
6d9e8025dc
2023-06-15 07:01:28 +09:00
David Rodríguez
3e7f5b02ae [rubygems/rubygems] Improve error message in frozen mode edge case
When a top level dependency is missing from the lockfile, and we're in
frozen mode, we should also print a "frozen error".

3e82b835e3
2023-06-15 07:01:25 +09:00
David Rodríguez
e86f4c581b [rubygems/rubygems] Improve frozen mode error message
This error message is also printed when using `bundler/setup` in frozen
model, so we're not necessarily installing any gems when it happens.

This new message play nicer with all situations.

6874bbacce
2023-06-15 07:01:25 +09:00
David Rodríguez
23ecaab8dd [rubygems/rubygems] Use "frozen" rather than "deployment" in error message
I think it communicates better what's going on.

07a25767a4
2023-06-15 07:01:24 +09:00
David Rodríguez
2ff9b7b93d [rubygems/rubygems] Show missing spec in lockfile incomplete error message
b86caaa3d5
2023-06-15 07:01:24 +09:00
David Rodríguez
21238f38a8 [rubygems/rubygems] Extract Definition#no_resolved_needed?
1ff8626571
2023-06-15 07:01:23 +09:00
David Rodríguez
4f1b1817a8 [rubygems/rubygems] There should always be a reason
4180008c2d
2023-06-15 07:01:23 +09:00
David Rodríguez
c12168185e [rubygems/rubygems] Show relative path to Gemfile in error message
For conciseness and consistency with printing the relative path to the
lockfile just before.

74cf6aea7c
2023-06-15 07:01:22 +09:00
David Rodríguez
e7749c4dea [rubygems/rubygems] Remove weird line breaks in the middle of error message
22b8caf42f
2023-06-15 07:01:21 +09:00
David Rodríguez
90c60e8138 [rubygems/rubygems] Simplify checking Gemfile vs lockfile sources
251e80aec6
2023-06-15 07:01:21 +09:00
David Rodríguez
96e3f31c1e [rubygems/rubygems] Make frozen mode spec also pass on Bundler 3
ad52f840f2
2023-06-15 07:01:20 +09:00
Hiroshi SHIBATA
6e93320c1b
Update RDoc::RD parsers generated by racc-1.7.1 2023-06-14 12:56:34 +09:00
tomoya ishida
5d91be7c1f [ruby/irb] Use symbol.inspect instead of ":"+symbol.id2name to avoid
completion candidates including newline characters
(https://github.com/ruby/irb/pull/539)

aaf0c46645
2023-06-13 10:46:38 +00:00
Samuel Williams
27b07776c9 [rubygems/rubygems] Autoload shellwords when it's needed.
e916ccb2d9
2023-06-13 09:32:47 +00:00
Nobuyoshi Nakada
6d734a8975 [ruby/uri] Fix RFC3986 regexps
8e38592241
2023-06-13 05:57:17 +00:00
Nobuyoshi Nakada
57c5b0a980 [ruby/uri] Refactor RFC3986 regexps to make more readable
3dfa19e920
2023-06-13 03:25:45 +00:00
Stan Lo
e1ccb2838b [ruby/irb] Use Kernel.warn to print command alias warning
(https://github.com/ruby/irb/pull/601)

This aligns with other warnings in irb and properly channel the message
to stderr.
2023-06-10 15:01:46 +00:00
Stan Lo
a41e088604 [ruby/irb] Remove the unused fork command definition
(https://github.com/ruby/irb/pull/600)

b039b89343
2023-06-10 12:51:38 +00:00
Gareth Adams
eaf11d3dd4 [rubygems/rubygems] Stop publishing Gemfile in default gem template
Similarly to how the other ignored files are intended for local
development and not for production, the Gemfile and Gemfile.lock files
for a gem only relate to local development and aren't useful to people
installing the gem.

59049c04be
2023-06-08 15:20:05 +00:00
Hiroshi SHIBATA
d1775aa388 Try to promote racc as bundled gems 2023-06-08 17:25:38 +09:00
Hiroshi SHIBATA
7ef1a2387e
Re-generate RDoc::RD parsers with racc-1.7.0 2023-06-08 10:20:32 +09:00
Hiroshi SHIBATA
0f2ebfee85 [ruby/racc] Bump up v1.7.0
0feca00301
2023-06-08 01:09:05 +00:00
Hiroshi SHIBATA
8206a82140
Update parser-text.rb with https://github.com/ruby/racc/pull/218 2023-06-08 09:59:44 +09:00
Peter Zhu
7577c101ed
Unify length field for embedded and heap strings (#7908)
* Unify length field for embedded and heap strings

The length field is of the same type and position in RString for both
embedded and heap allocated strings, so we can unify it.

* Remove RSTRING_EMBED_LEN
2023-06-06 10:19:20 -04:00
David Rodríguez
79e8d91410 [rubygems/rubygems] Delay cache access in LockfileParser
It's the only part that needs "root folder resultion" to figure out the
folder for the cache, but it's only needed for some things, so run that
logic lazily when needed.

c7b9eae0bc
2023-06-06 10:52:57 +09:00
David Rodríguez
03246719cc [rubygems/rubygems] Fix path vs deployment precedence when path set through ENV
The `deployment` setting sets `path` to `vendor/bundle` implicitly, but
that should only apply if `path` is not set explicitly, at any level.

3552c064c1
2023-06-06 10:52:57 +09:00