82793 Commits

Author SHA1 Message Date
Lars Kanis
c3aee764d1 Fix callcc on Windows on ARM64
Otherwise using callcc fails with a segfault for instance in this test case:
  TestEnsureAndCallcc#test_bug20655_extension_using_rb_ensure

(cherry picked from commit 142001cd64fcb7ec6896f04b0c837857590e26ce)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
16bafba9c7 Win32: Add coroutine for mswin on arm64
(cherry picked from commit c25dd4ee472e1516be64b9b2f0a9e222ef7532d6)
2026-11-04 10:48:29 +09:00
Lars Kanis
2c46f0f5f0 Fix coroutine implementaion on Windows-Arm64
When setjmp/longjmp/exceptions are used on Windows it's necessary to store+restore additional information from the TEB.
I didn't find any official documentation about the values to be saved, but found the corresponding boost/context implemenataion:
    abf8e04e23

This is similar to the special TIB handling on x86/x86_64 on Windows.

Without this fix an exception in a fiber segfaults without any output:
  ruby -e "Fiber.new{ raise 'test' }.resume"

(cherry picked from commit 187b8fdb6990145210ef6394ca8d866c2f885854)

The conflicts in coroutine/arm64/Context.S and Context.h are resolved by keeping the ruby_3_3 context, which has neither the PAC b-key check nor the uintptr_t cast of the start function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:48:29 +09:00
jeremyd2019
dcfc032723 [win32] fix arm64 instruction decoding
Two minor fixes to arm64 instruction decoding when looking for __pioinfo:
1. add_mask was shifted by one bit, it was intended to be 0x7f800000.  However, since the mask was already excluding matching the 'sh' bit, and since the purpose of the add following the adrp is to add in the lower 12 bits, I opted to set the mask to 0x7fc00000 and simply remove the handling for the 12 bit shift option which is now required to be disabled in order to match.
2. adrp's immediate was supposed to be sign extended.  So far, I have not seen cases where the global variable ends up before the code in memory, but it's a possibility, so handle the sign extension.

(cherry picked from commit 4745338a3f336d7bedb02895534721661551ebb9)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
61e4eafd80 Win32: Fix the macro for arm64 on mswin
Visual C defines `_M_`-prefixed macros for the target architectures.

(cherry picked from commit e4a4dea2c0b67048ec73f36e8dac3c637249119e)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
296d494503 Win32: Fix rbimpl_size_mul_overflow on arm64
`_umul128` is specific to x86_64 platform, see higher words by
`__umulh` on arm64.

(cherry picked from commit 5a7a1a4a13ae11e4cef274c98e0c5bbcb7b1d192)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
cca357b36f Win32: Allow arm64 platform
(cherry picked from commit 36c36d0486b0c884759c038ceaf4aa495785996a)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
bed730fe14 Win32: Use TARGET_OS for word-size
It is derived from `_WIN64` pre-defined macro, at `-osname-` in
win32/setup.mak.

(cherry picked from commit 90fe1b4402498f61208e9b72ce3206d4bcbffb7d)
2026-11-04 10:48:29 +09:00
Nobuyoshi Nakada
ef720503cf Win32: Fix pre-defined macros for platforms
Use `_WIN64` for word-size, `_M_AMD64` for CPU-specific feature.

(cherry picked from commit c77f736bc1e6b73d62e9ba3dcf3dcbeff0657b38)

The static assertions added to the fallbacks of rbimpl_atomic_size_inc and rbimpl_atomic_size_dec are left out, as the arm64 mswin build does not need them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 10:48:29 +09:00
Hiroshi SHIBATA
af48f08f21
Bump up to 3.3.13 v3_3_13 2026-10-23 12:17:41 +09:00
Hiroshi SHIBATA
f6496bca68 Keep the program size error from OP_END with subexp calls
With a subexp call, the result of unset_addr_list_fix overwrote the error, so a pattern over the limit compiled without raising RegexpError.

Follow-up to cf35145fc46.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 16d8a554b2ad279e08128b5e1dc4b342fccd33d7)
2026-10-23 12:00:20 +09:00
Sethu
745e06b1b0 [Bug #22384] Fix memory leak on compile error in a later branch of an alternation
(cherry picked from commit bf937bfa16767a4dd857ee16f4f18df1bae4d5ca)
2026-10-23 12:00:20 +09:00
Hiroshi SHIBATA
b03e500193 Reject a compiled program too big for its offset type
Concatenated large repeats reach a program past INT_MAX from a few hundred
kilobytes of source, and the offsets emitted into it wrap.  Cap the size
while the program is emitted, which does not depend on the length pass that
overflows along with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit cf35145fc46bc278e0ab0003478fc4afe6564819)
2026-10-23 12:00:20 +09:00
Hiroshi SHIBATA
fa98ef030a Avoid overflow in the quantifier expansion size check
Nested bounded repeats let the int product tlen * qn->lower overflow, so
the check that keeps the compiler from unrolling a large repeat could pass
for an enormous one, hanging the compile or emitting wrapped jump offsets.
Compare against the limit by division instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7cfe8dc82f9f1b3f9c37c78e362fcbdf3c0b84f4)
2026-10-23 12:00:20 +09:00
Hiroya Fujinami
63eda2681e Reject overflowed repeat/null-check IDs in huge regexps (#16801)
Add explicit errors for excessive range-repeat and null-check IDs;
map new errors in regerror; add regression tests for oversized generated
patterns.

(cherry picked from commit 493d26dcdea8b2f0ac5d28e057b401bc809e7fae)
2026-10-23 12:00:20 +09:00
Hiroya Fujinami
63d0ba80a7 Prevent double free for too big repetition quantifiers (#13332)
Prevent double free for too big repetition quantifiers

The previous implementation calls `free(node)` twice (on parsing and compiling a
regexp) when it has an error, so it leads to a double-free issue. This
commit enforces `free(node)` once by introducing a temporal pointer to hold
parsing nodes.

(cherry picked from commit 35000ac2ed3a1829f8d193ffb23da0e44cc6fe5f)
2026-10-23 12:00:20 +09:00
Nobuyoshi Nakada
08d0d1d43d [ruby/io-console] Use gperf 3.1 to generate ANSI-C code
https://github.com/ruby/io-console/commit/3798aae42d
(cherry picked from commit 25c2aa0a1c55b5a90e29fc9d4f64166ddb498f51)
2026-10-23 09:45:31 +09:00
Nobuyoshi Nakada
7692732061 [ruby/date] Use gperf 3.1 to generate ANSI-C code
https://github.com/ruby/date/commit/5d67437b1f
(cherry picked from commit 12e66f11e526ba89103ca0b10a80b9b61a16af3e)
2026-10-23 09:45:31 +09:00
Nobuyoshi Nakada
ae497d0607 Use gperf 3.1 to generate ANSI-C code
(cherry picked from commit 1213623e5c11d63793e6966752904cc265012b25)
2026-10-23 09:45:31 +09:00
nagachika
5c2a9b2789 merge revision(s) b0a4e2399b34701d4fc05f9543142b0c73d1fb9b:
CI: mingw: Use the official actions for msys2

	Because ruby/setup-ruby is affected to test result.

Also includes the prerequisite changes from e4b386e090, 90f8199412,
a443cd012a and 4adb6f6969 (Remove Strawberry Perl pkg-config, misc
system & package info, `cmd` as the default shell, set up msys2
environment variables).

(cherry picked from commit 98ec35899b, adapted to the mingw workflow on ruby_3_3)
2026-10-23 09:45:31 +09:00
Takashi Kokubun
8531f63a36 Bump ruby/setup-ruby to v1.329.0
setup-ruby v1.236.0 raises "Cannot find Git's cert file" on Windows
runners because Git for Windows moved from mingw64 to ucrt64.
This was fixed in ruby/setup-ruby#947 (v1.328.0).

(cherry picked from commit 89856b96b1, adapted to the workflows on ruby_3_3)
2026-10-23 09:45:31 +09:00
nagachika
199ada88b3 Fix pm_memchr constness.
cast memchr result (or make return const void *) to resolve -Werror incompatible-pointer-types"

(cherry picked from commit 2d4992fc9df22fe581df95879ffedf7470f0503c)
2026-10-23 09:45:31 +09:00
Étienne Barrié
ad3490a035 Remove discard qualifiers warning with C23 strchr
C23 has qualifier-preserving standard library functions, so calling
strchr with a `const char *` will return a `const char *`. We can change
the type of the local variables because we don't mutate the strings.

(cherry picked from commit e068856616922f117b6de74c58a63d386c7496c9)
2026-10-23 09:45:31 +09:00
Hiroshi SHIBATA
7ad8db2311 Stop using the macos-14 runner image
GitHub retires the macOS 14 image on November 2, 2026. Jobs that ran only there move to macos-15, the oldest remaining image, and the matrices that also cover newer images drop it.

https://github.blog/changelog/2026-10-01-github-actions-macos-14-runner-image-retirement/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 14:26:19 +09:00
st0012
f569684a55 Use ubuntu-latest for macOS result jobs
The result jobs in macOS workflows only check if other jobs failed
(just runs `exit 1`). They don't need macOS runners. Using
ubuntu-latest instead frees up macOS runner slots and starts faster
due to shorter queue times.
2026-10-02 14:26:19 +09:00
Nobuyoshi Nakada
0c8ab2a111 [Bug #22311] Check the availability of APIs added in macOS 27
To account for cases where binaries for older OS versions are built
using the new SDK, check at runtime whether the API functions are
available actually.
2026-09-17 09:54:30 +09:00
Peter Zhu
52c54450f9 Don't use non blocking pipes for RUBY_CRASH_REPORT
[Bug #21703]

RUBY_CRASH_REPORT does not work in some cases when shelling out on Linux.
For example, given the following shell script dump.sh:

    #!/usr/bin/env bash
    cat > /tmp/crash

And we see it fails like this:

    $ RUBY_CRASH_REPORT="|dump.sh" ruby -rfiddle -e "Fiddle::Pointer.new(1, 10)[0]"
    cat: -: Resource temporarily unavailable
2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada
fead12a314 Use assert_crash_report in test_crash_report_pipe
Instead of using `assert_in_out_err` directly.
2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada
94b8dbc104 Fix crash report path test on Windows 2026-09-17 09:54:30 +09:00
Nobuyoshi Nakada
176b4c14ed Fix to use assert_crash_report results 2026-09-17 09:54:30 +09:00
Hiroshi SHIBATA
e675ccc096 Install MSYS2 perl on the MinGW runner
MSYS2 dropped perl from its base install and the windows-2022 runner
image picked that up in 20260818.277.1, so autogen.sh now dies with
`/usr/bin/perl: bad interpreter`. master and ruby_4_0 set up their own
MSYS2 with autoconf, which pulls perl in as a dependency, so only the
branches that reuse the image MSYS2 need this.

https://github.com/actions/runner-images/issues/14562

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 11:25:26 +09:00
Hiroshi SHIBATA
619ea0f602 Bump up resolv-0.3.2 for Ruby 3.3
Backport of the August 2026 resolv security release.

CVE-2026-80212
CVE-2026-80213

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 11:25:26 +09:00
Hiroshi SHIBATA
0581089df9
Bump up to 3.3.12 v3_3_12 2026-07-16 13:03:30 +09:00
Hiroshi SHIBATA
876f7b671b CI: trim the tarball-test macOS matrix on PR and push
The full macOS fan-out (10 jobs, about 117 runner-minutes) repeats
test tasks that macos.yml already runs from the git tree on every
event; what is tarball-specific is only that the packaged tarball
configures, builds and installs. Run a single check on macos-26 for
pull requests and pushes, and keep the full matrix for
workflow_dispatch, which is how the nightly schedule and release
verification invoke it. Only macOS is trimmed: its org-wide
concurrency pool of 50 runners saturates during peak hours and has
been delaying release jobs, while Linux and Windows share a pool with
headroom.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit df977545f07404ac6b49b6992a4ab78c2f2b0f9a)
2026-07-16 12:38:03 +09:00
Hiroshi SHIBATA
35554384b9 Use archname input for downloaded-cache path in tarball-windows.yml
The cache step hardcoded snapshot-*, which no longer matches when this
reusable workflow is called with a release archname such as
ruby-3.4.0-rc1 from ruby/actions, turning cache save and restore into
a no-op.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 674e93935c846f129329e78c4270015ed1805e80)
2026-07-16 12:38:03 +09:00
Hiroshi SHIBATA
cd7f0866e7 Bump net-imap to 0.4.25 for Ruby 3.3
Backport of the June 2026 net-imap security releases to the v0.4 line.

CVE-2026-47240
CVE-2026-47242
CVE-2026-47241

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 15:10:45 +09:00
Hiroshi SHIBATA
c51e37e8ec Disable git background maintenance in bundler specs
Since Git 2.46, commands like `git commit` spawn a detached
`git maintenance run --auto` process, which briefly creates
`.git/objects/maintenance.lock`. Specs copying a just-committed
repository with FileUtils.cp_r can hit the lock file disappearing
between readdir and lstat, causing flaky Errno::ENOENT failures on
macOS CI runners with newer Git.

https://github.com/ruby/ruby/actions/runs/28764006107/job/85284933867

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 10:26:27 +09:00
Hiroshi SHIBATA
8359d5291f Omit WEBrick test_directory_traversal on Windows
`/..%5c../` resolves the backslash as a path separator on Windows, so the
vendored FileHandler returns 404 instead of the expected 200 and logs a
nondisclosure warning, breaking the daily Windows snapshot CI. This vendored
test only remains on ruby_3_3; 3.4 and later removed it together with WEBrick.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 19:46:53 +09:00
Hiroshi SHIBATA
670a752c6a macos: Use brew openssl@3 instead of 1.1 in setup action
openssl@1.1 is no longer available on the macos-26 runner image. Build
against openssl@3, matching master (18404af9ec0), so the macos-26 check
job can install its dependencies.
2026-06-15 19:00:31 +09:00
Hiroshi SHIBATA
895604d442 macos: Use an isolated prefix on macos-15-intel
The macos-15-intel runner image ships a pre-installed Ruby under
/usr/local whose default-gem dir collides with the build's on the 3.3.0
ABI path. During `make check`, the test-tool autoloads rake and scans
default-gem stubs there, hitting a stale bundler stub and failing with
ENOENT. Build under an isolated prefix on that runner only. Backport of
master #17339.
2026-06-15 19:00:31 +09:00
Hiroshi SHIBATA
b7ce0881c7 Run macOS CI on macos-26 by default
Add macos-26 to the macOS CI matrix to align coverage with master
(5c762e786bb). Adapted to this branch's os-list matrix.
2026-06-15 19:00:31 +09:00
Hiroshi SHIBATA
b93e82c94c tarball-macos: Use an isolated prefix on macos-15-intel
The macos-15 runner image ships a pre-installed Ruby under /usr/local
whose default-gem directory shares the 3.3.0 ABI path with the snapshot
build. With the default prefix, RDoc generation scans that directory and
dies on a stale bundler default-gem stub left by the runner's RubyGems
self-update. Build, install and verify under an isolated prefix instead.

(cherry picked from commit dc24122d900c32a14db56a4f1def4f79027a24ee)
2026-06-15 19:00:31 +09:00
Hiroshi SHIBATA
b823e24509
Omit unknown DNS issue of macOS 26.1 beta
```
TestResolvDNS#test_no_server:
Test::Unit::ProxyError: Timeout::Error
    /path/to/ruby/test/resolv/test_dns.rb:531:in 'TestResolvDNS#test_no_server'
```
2026-06-10 06:17:31 +09:00
Hiroshi SHIBATA
e18bb62815 Build full path for HOME stat snapshot
Dir.each_child yields entry names, so stat/digest/children ran against
the working directory instead of HOME. Join dir and name first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
0c4799839d Inline the skip-detection run command
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
69196c9f7e Reinstall gmp via vcpkg for Windows tarball-test
Now that win32/Makefile.sub passes XINCFLAGS so the gmp headers under
--with-opt-dir are visible to cl.exe (bug #22078), the gmp build no
longer fails. Restore gmp to the vcpkg install to match master.
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
4282184625 Pass XINCFLAGS for gmp build with Windows platform
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
(cherry picked from commit 13c64a8a20592992c2f62b84a4b3c42e2da5de0c)
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
67ce71e715 Run macOS CI on macos-26 by default
Make macos-26 the default runner for the tarball build verification and
keep macos-15, macos-15-intel, and macos-14 as regression coverage.

(cherry picked from commit 5c762e786bb14ec46a15e1073e1d806fa9a39a1c)
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
41df78d598 Pass only the required secrets to tarball reusable workflows
Replace secrets: inherit with explicit Slack webhook secrets, which are
the only secrets the ubuntu/macos/windows builds use. tarball-non-development
uses no secrets, so drop inherit there entirely.

(cherry picked from commit daea48078cd029b16ef5a4a31fe7fedf72bb00f0)
2026-06-03 15:46:52 +09:00
Hiroshi SHIBATA
d21703af79 Do not persist credentials in tarball-test checkout
The subsequent git steps only fetch from the public origin and operate
on local branches, so the token does not need to be persisted.

(cherry picked from commit f00e912db0d175ffe61d7195f40c10838be1c826)
2026-06-03 15:46:52 +09:00