Commit graph

89567 commits

Author SHA1 Message Date
Takashi Kokubun
d2930f8e7a v3.4.2 2025-02-14 13:25:54 -08:00
Kevin Newton
d5f42a07b2 Fix locals_test based on previous backports 2025-02-14 11:41:55 -08:00
Kevin Newton
62f736f23e Backport Bug #21137 2025-02-14 10:19:25 -08:00
Kevin Newton
eaa26b8c8c Backport Bug #21118 and Bug #21043 2025-02-14 10:19:25 -08:00
Kevin Newton
45fe3c137b Backport Bug #21031 2025-02-14 10:19:25 -08:00
Nobuyoshi Nakada
24f48c83e7 [Bug #20982] Put spaces in ENV.inspect results as well as Hash 2025-02-13 21:43:19 -08:00
Nobuyoshi Nakada
80f2329f76 Refine ENV tests 2025-02-13 21:43:19 -08:00
Takashi Kokubun
270129fdcb merge revision(s) 19c39e4cfa, d78ff6a767: [Backport #20984]
[Bug #20984] ENV.inspect should be encoding aware

	[Bug #20984] Fix test with locale encoding
2025-02-13 21:29:23 -08:00
Takashi Kokubun
de7a196bd4 Revert "merge revision(s) cb419e3912: [Backport #21031]"
This reverts commit 7adf89d7ad.
2025-02-13 21:20:27 -08:00
Yuta Saito
d5666bbf91 tool/downloader.rb: Stop caching already existing files
Previously, the script was caching any file already present in the
destination directory, regardless of its origin. This caused issues
when the directory contained files copied from external sources like
`autoreconf --install`.

For example:
1. `./autogen.sh --install` copies `config.guess` and `config.sub`
   from the system to `./tool`.
2. `ruby tool/downloader.rb -d tool -e gnu config.guess config.sub`
   treats those files as if they were downloaded and caches them.
3. Removing the files: `rm tool/config.guess tool/config.sub`.
4. Running the downloader again, it mistakenly restores the cached
   files instead of downloading fresh versions.
2025-02-13 21:19:01 -08:00
Hiroshi SHIBATA
18daf8326a Use configu.guess with wasi compatible version 2025-02-13 21:19:01 -08:00
Takashi Kokubun
9a09844368 merge revision(s) b21e1aed2e: [Backport #21114]
[ruby/prism] Fix infinite loop in error recovery

	When recovering from a depth error that occurs at the end of the
	file, we need to break out of parsing statements.

	Fixes [Bug #21114]

	a32e268787
2025-02-13 21:17:41 -08:00
Takashi Kokubun
d3fc56dcfa merge revision(s) 127325a4ba: [Backport #21117]
[ruby/prism] No writing to numbered parameters

	Fixes [Bug #21117]

	19d4bab5a0
2025-02-13 21:17:04 -08:00
Takashi Kokubun
e3b16320e6 merge revision(s) 91a10c0757: [Backport #21112]
Fix a typo in WeakKeyMap argument error

	[Bug #21112]
2025-02-13 21:14:14 -08:00
Takashi Kokubun
319c3c7038 merge revision(s) 1683dadb19: [Backport #21088]
Do not save ResolutionError if resolution succeeds for any address family (#12678)

	* Do not save ResolutionError if resolution succeeds for any address family

	Socket with Happy Eyeballs Version 2 performs connection attempts and name resolution in parallel.

	In the existing implementation, if a connection attempt failed for one address family while name resolution was still in progress for the other, and that name resolution later failed, the method would terminate with a name resolution error.
	This behavior was intended to ensure that the final error reflected the most recent failure, potentially overriding an earlier error.

	However, [Bug #21088](https://bugs.ruby-lang.org/issues/21088) made me realize that terminating with a name resolution error is unnatural when name resolution succeeded for at least one address family.

	This PR modifies the behavior so that if name resolution succeeds for one address family, any name resolution error from the other is not saved.

	This PR includes the following changes:

	* Do not display select(2) as the system call that caused the raised error, as it is for internal processing

	* Fix bug: Get errno with Socket::SO_ERROR in Windows environment with a workaround for tests not passing
2025-02-13 21:13:47 -08:00
Takashi Kokubun
e5403bd137 merge revision(s) db02a6b3ab: [Backport #21103]
[Bug #21103] Fix local variable index calculation with forwarding

	Forwarding argument is optimized not to packed when no other arguments
	and an internal object refers values before it.  This size is decided
	at called time, calculate the local variable index from the fixed end
	point.
2025-02-13 21:12:33 -08:00
Takashi Kokubun
feb4a688a2 merge revision(s) 46b544c549, d3abee739f: [Backport #21095]
Prefer `uname -n` over `hostname`. (#12647)

	Add fallback for `hostname` if `uname` isn't available. (#12655)
2025-02-13 21:12:07 -08:00
Takashi Kokubun
2ee25f7b47 merge revision(s) 2b6fc9ea72: [Backport #21092]
[Bug #21092] Fallback variables after execonf has done

	When reading from a dummy makefile, the global variables initialized
	in `init_mkmf` may not be overridden.
2025-02-13 21:11:06 -08:00
Takashi Kokubun
ead3bbc240 merge revision(s) d4a1a2780c: [Backport #21032]
rb_feature_p: skip `get_expanded_load_path` for absolute paths

	Ref: https://github.com/fxn/zeitwerk/pull/308

	```ruby
	require 'benchmark'

	$LOAD_PATH << 'relative-path'

	autoload :FOO, '/tmp/foo.rb'

	puts Benchmark.realtime {
	  500_000.times do
	    Object.autoload?(:FOO)
	  end
	}
	```

	The above script takes 2.5 seconds on `master`, and only
	50ms on this branch.

	When we're looking for a feature with an absolute path, we don't
	need to call the expensive `get_expanded_load_path`.
2025-02-13 21:09:41 -08:00
Takashi Kokubun
2108ab2cb6 merge revision(s) 04ec077946: [Backport #21038]
Preserve `errno` in `rb_fiber_scheduler_unblock`. (#12576)

	[Bug #21038]

	Co-authored-by: Julian Scheid <julians37@gmail.com>
2025-02-13 21:09:15 -08:00
Takashi Kokubun
3fdf7279a0 merge revision(s) e0d600ec19: [Backport #21012]
Avoid opt_aset_with optimization inside multiple assignment

	Previously, since the opt_aset_with optimization was introduced,
	use of the opt_aset_with optimization inside multiple assignment
	would result in a segfault or incorrect instructions.

	Fixes [Bug #21012]

	Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
2025-02-13 21:08:44 -08:00
Takashi Kokubun
3db440f5a1 merge revision(s) f7059af50a: [Backport #21046]
Use no-inline version `rb_current_ec` on Arm64

	The TLS across .so issue seems related to Arm64, but not Darwin.
2025-02-13 21:08:20 -08:00
Takashi Kokubun
04298f2d15 merge revision(s) c290861336: [Backport #21048]
[ruby/prism] Fix rescue modifier precedence

	Fixes [Bug #21048]

	07202005cb
2025-02-13 21:07:57 -08:00
Takashi Kokubun
cd395232b0 merge revision(s) 241ada7b1c: [Backport #21085]
[ruby/prism] Do not put empty statements in while because of -n

	Fixes [Bug #21085]

	ebb9c36a10
2025-02-13 21:07:25 -08:00
Takashi Kokubun
7adf89d7ad merge revision(s) cb419e3912: [Backport #21031]
[PRISM] Handle forwarding inside eval

	Fixes [Bug #21031]
2025-02-13 21:06:50 -08:00
Takashi Kokubun
579b94ae61 merge revision(s) 931a870606: [Backport #21044]
[ruby/prism] Increase value of PRISM_DEPTH_MAXIMUM to 10000

	The previous value of 1_000 was added with a reference to the Bison
	parser[^1], but the value of YYMAXDEPTH in the Bison docs is 10_000,
	not 1_000.

	[^1]: https://www.gnu.org/software/bison/manual/html_node/Memory-Management.html

	Fixes [Bug #21044]

	e098533ab4

	Co-authored-by: Nony Dutton <nonydutton@gmail.com>
2025-02-13 21:06:07 -08:00
Takashi Kokubun
bc359b9971 merge revision(s) b176d4f52e: [Backport #21008]
[Bug #21008] Normalize before sum to float

	After switching to `Float`-mode when summing `Numeric` objects,
	normalization for `Float` is still needed.
2025-02-13 18:01:42 -08:00
Takashi Kokubun
b65cea7429 merge revision(s) 8034e9c3d0: [Backport #20995]
[Bug #20995] Protect `IO.popen` block from exiting by exception
2025-02-13 18:01:20 -08:00
Takashi Kokubun
c989d90754 merge revision(s) 117d6e145a: [Backport #21027]
[ruby/prism] Fix `not` receiver

	`not foo` should be `!foo`
	`not()` should be `!nil`

	Fixes [Bug #21027]

	871ed4b462
2025-02-13 17:54:41 -08:00
Takashi Kokubun
9240f01b1f merge revision(s) 63723c8d59: [Backport #21014]
Correctly set node_id on iseq location

	The iseq location object has a slot for node ids.  parse.y was correctly
	populating that field but Prism was not. This commit populates the field
	with the ast node id for that iseq

	[Bug #21014]
2025-02-13 17:54:21 -08:00
Takashi Kokubun
c3d30e4dab merge revision(s) 051af9529b: [Backport #21017]
[Bug #21017] Fix `--with-parser` configure option
2025-02-13 17:53:47 -08:00
Takashi Kokubun
698f808cc7 merge revision(s) 5fec930832, 1a06bee027: [Backport #20992]
[Bug #20992] Test for local variable name encodings

	Do not intern invalid symbols in eval parse

	When the inner code cannot represent the name of the locals in the
	outer code, do not bother putting them into the constant pool as
	they will not be referenced.

	Fixes [Bug #20992]

	Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-13 17:53:11 -08:00
Takashi Kokubun
82f7cb7941 merge revision(s) ad96c5a729, ca81142eff: [Backport #21010]
[ruby/prism] Throw syntax error for endless method with `[]=`

	Prism shoudld throw a syntax error for endless methods when the method
	name uses brackets. Previously it would not. This matches the behavior
	of parse.y.

	Fixes https://bugs.ruby-lang.org/issues/21010

	43c16a89ef

	[ruby/prism] [Bug #21010] Reject endless method definition of `[]=`

	Fixes: https://bugs.ruby-lang.org/issues/20785

	192960ce5d
2025-02-13 17:52:28 -08:00
Takashi Kokubun
68013d43a3 merge revision(s) 31905d9e23: [Backport #21001]
Allow escaping from ensures through next

	Fixes [Bug #21001]
2025-02-13 17:52:03 -08:00
Takashi Kokubun
8a86e52fb5 merge revision(s) 668701cb0b: [Backport #21002]
Added copyright for vendored turbo_tests.

	[Bug #21002]
2025-02-13 17:51:38 -08:00
Takashi Kokubun
d720ea59ca merge revision(s) 2a1cff40f5: [Backport #21003]
Do not warn unused block when using forwarding

	Fixes [Bug #21003]
2025-02-13 17:51:03 -08:00
Takashi Kokubun
5ba052675f merge revision(s) fb18bb183c: [Backport #20989]
[Bug #20989] Ripper: Pass `compile_error`

	For the universal parser, `rb_parser_reg_fragment_check` function is
	shared between the parser and ripper.  However `parser_params` struct
	is partially different, and `compile_error` function depends on that
	part indirectly.
2025-02-13 17:50:05 -08:00
Takashi Kokubun
4bafaef0a5 merge revision(s) 7df5d65eac: [Backport #20981]
[Bug #20981] Bring back `rb_undefine_finalizer`
2025-02-13 17:47:24 -08:00
Alan Wu
294aef53b8 YJIT: Filter & calls from specialized C method codegen
Evident with the crash reported in [Bug #20997], the C replacement
codegen functions aren't authored to handle block arguments (nor
should they because the extra code from the complexity defeats
optimization). Filter sites with VM_CALL_ARGS_BLOCKARG.
2025-02-13 17:46:14 -08:00
Alan Wu
706f1d0573 YJIT: Initialize locals in ISeqs defined with ...
Backport of GH-12660:

    Previously, callers of forwardable ISeqs moved the stack pointer up
    without writing to the stack. If there happens to be a stale value in
    the area skipped over, it could crash due to "try to mark T_NONE". Also,
    the uninitialized local variables were observable through `binding`.

    Initialize the locals to nil.

    [Bug #21021]
2025-02-13 17:44:58 -08:00
nick evans
12c716eea0 Bump net-imap to v0.5.6 for Ruby 3.4 (CVE-2025-25186)
This update addresses CVE-2025-25186 (GHSA-7fc5-f82f-cx69).
2025-02-13 17:44:25 -08:00
Hiroshi SHIBATA
787436cd1a Support git ls-files ....split style for file list of gemspec 2025-02-13 17:42:41 -08:00
Hiroshi SHIBATA
555373aec8 Bump up net-smtp-0.5.1 2025-02-13 17:42:41 -08:00
Hiroshi SHIBATA
3c9e65d370 glibc and musl didn't provide A1-A7, FP and S3-S8 constants.
* https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/loongarch/sys/ucontext.h
* https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits/signal.h
2025-02-13 17:42:11 -08:00
Nobuyoshi Nakada
b5c921e010 [Bug #21024] <cstdbool> header has been useless
And finally deprecated at C++-17.
Patched by jprokop (Jarek Prokop).
2025-02-13 17:40:19 -08:00
Alan Wu
73690b520d YJIT: Fix crash when yielding keyword arguments
Previously, the code for dropping surplus arguments when yielding
into blocks erroneously attempted to drop keyword arguments when there
is in fact no surplus arguments. Fix the condition and test that
supplying the exact number of keyword arguments as require compiles
without fallback.
2025-02-13 17:37:38 -08:00
Nick Dower
cefa630bce YJIT: Add crashing test for yielding keyword args
Code like the following is crashing for us on 3.4.1:

```ruby
def a(&) = yield(x: 0)

1000.times { a { |x:| x } }
```

Crash:

```
ruby: YJIT has panicked. More info to follow...
thread '<unnamed>' panicked at ./yjit/src/codegen.rs:8018:13:
assertion `left == right` failed
  left: 0
 right: 1
```

Co-authored-by: Dani Acherkan <dtl.117@gmail.com>
2025-02-13 17:37:38 -08:00
Takashi Kokubun
65f2a4beec Add k0kubun as CODEOWNERS 2025-02-13 17:36:58 -08:00
NARUSE, Yui
48d4efcb85 v3.4.1 2024-12-25 16:43:20 +09:00
Takashi Kokubun
f450108330 [DOC] Fix indentation for rdoc 2024-12-24 20:50:41 -08:00