Skip to content

Commit f6eb762

Browse files
committed
Drop support for Ruby 3.0
Primarily because it doesn't support Process._fork, but also because it's been EOL for many months.
1 parent ad5797b commit f6eb762

File tree

8 files changed

+27
-46
lines changed

8 files changed

+27
-46
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
fail-fast: false
5151
matrix:
5252
os: [ubuntu, macos, windows]
53-
ruby: ["3.3", "3.2", "3.1", "3.0"]
53+
ruby: ["3.3", "3.2", "3.1"]
5454
syslib: [enable, disable]
5555
include:
5656
# additional compilation flags for homebrew
@@ -122,7 +122,7 @@ jobs:
122122
fail-fast: false
123123
matrix:
124124
os: [ubuntu, macos, windows]
125-
ruby: ["3.3", "3.0"] # oldest and newest
125+
ruby: ["3.3", "3.1"] # oldest and newest
126126
include:
127127
- { os: windows, ruby: mingw }
128128
- { os: windows, ruby: mswin }
@@ -213,7 +213,7 @@ jobs:
213213
fail-fast: false
214214
matrix:
215215
os: [ubuntu, macos, windows]
216-
ruby: ["3.3", "3.2", "3.1", "3.0"]
216+
ruby: ["3.3", "3.2", "3.1"]
217217
syslib: [enable, disable]
218218
include:
219219
# additional compilation flags for homebrew
@@ -284,7 +284,7 @@ jobs:
284284
- x86-linux-musl
285285
- x86_64-linux-gnu
286286
- x86_64-linux-musl
287-
ruby: ["3.3", "3.2", "3.1", "3.0"]
287+
ruby: ["3.3", "3.2", "3.1"]
288288
include:
289289
# declare docker image for each platform
290290
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
@@ -322,15 +322,12 @@ jobs:
322322
fail-fast: false
323323
matrix:
324324
os: [windows-latest, macos-13, macos-14]
325-
ruby: ["3.3", "3.2", "3.1", "3.0"]
325+
ruby: ["3.3", "3.2", "3.1"]
326326
include:
327327
- os: macos-13
328328
platform: x86_64-darwin
329329
- os: macos-14
330330
platform: arm64-darwin
331-
- os: windows-latest
332-
ruby: "3.0"
333-
platform: x64-mingw32
334331
- os: windows-latest
335332
ruby: "3.1"
336333
platform: x64-mingw-ucrt
@@ -359,7 +356,6 @@ jobs:
359356
fail-fast: false
360357
matrix:
361358
include:
362-
- { ruby: "3.0", flavor: "alpine" }
363359
- { ruby: "3.1", flavor: "alpine3.18" }
364360
- { ruby: "3.1", flavor: "alpine3.19" }
365361
- { ruby: "3.2", flavor: "alpine3.18" }
@@ -376,6 +372,4 @@ jobs:
376372
name: cruby-x86_64-linux-musl-gem
377373
path: gems
378374
- run: apk add build-base
379-
- if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236
380-
run: gem update --system
381375
- run: ./bin/test-gem-install ./gems

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inherit_gem:
1313

1414
AllCops:
1515
SuggestExtensions: false
16-
TargetRubyVersion: 3.0
16+
TargetRubyVersion: 3.1
1717

1818
Naming/InclusiveLanguage:
1919
Enabled: true

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22

33
## next / unreleased
44

5-
### Changed
5+
### Ruby
6+
7+
- This release drops support for Ruby 3.0.
8+
9+
10+
### Fork safety improvements
11+
12+
Sqlite itself is [not fork-safe](https://www.sqlite.org/howtocorrupt.html#_carrying_an_open_database_connection_across_a_fork_). Specifically, writing in a child process to a database connection that was created in the parent process may corrupt the database file. To mitigate this risk, sqlite3-ruby has implemented the following changes:
13+
14+
- Open writable database connections carried across a `fork()` will immediately be closed in the child process to mitigate the risk of corrupting the database file.
15+
- These connections will be incompletely closed ("discarded") which will result in a one-time memory leak in the child process.
16+
17+
If it's at all possible, we strongly recommend that you close writable database connections in the parent before forking.
618

7-
- Any database connections carried across a `fork()` will not be fully closed to help protect database files against corruption. Using a database connection in a child process that was created in a parent process is unsafe and may corrupt the database file. If an inherited connection is closed then a warning will be emitted and some reserved memory will be lost to the child process permanently. See the README "Fork Safety" section and `adr/2024-09-fork-safety.md` for more information. [#558] @flavorjones
19+
See the README "Fork Safety" section and `adr/2024-09-fork-safety.md` for more information. [#558] @flavorjones
820

921

1022
### Improved

INSTALLATION.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ In v2.0.0 and later, native (precompiled) gems are available for recent Ruby ver
2121
- `x86_64-linux-gnu` (requires: glibc >= 2.17)
2222
- `x86_64-linux-musl`
2323

24-
⚠ Ruby 3.0 linux users must use Rubygems >= 3.3.22 in order to use these gems.
25-
2624
⚠ Musl linux users should update to Bundler >= 2.5.6 to avoid https://github.com/rubygems/rubygems/issues/7432
2725

2826
If you are using one of these Ruby versions on one of these platforms, the native gem is the recommended way to install sqlite3-ruby.

bin/test-gem-file-contents

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,7 @@ Minitest::Reporters.use!([Minitest::Reporters::SpecReporter.new])
6565

6666
puts "Testing '#{gemfile}' (#{gemspec.platform})"
6767
describe File.basename(gemfile) do
68-
let(:all_supported_ruby_versions) {
69-
["3.0", "3.1", "3.2", "3.3"]
70-
}
71-
let(:native_supported_ruby_versions) { ["3.0", "3.1", "3.2", "3.3"] }
72-
let(:ucrt_supported_ruby_versions) { ["3.1", "3.2", "3.3"] }
73-
let(:platform_supported_ruby_versions) do
74-
if gemspec.platform.to_s == "x64-mingw-ucrt"
75-
ucrt_supported_ruby_versions
76-
elsif gemspec.platform.to_s == "x64-mingw32"
77-
native_supported_ruby_versions - ucrt_supported_ruby_versions
78-
elsif gemspec.platform.cpu
79-
native_supported_ruby_versions
80-
else
81-
all_supported_ruby_versions
82-
end
83-
end
68+
let(:supported_ruby_versions) { ["3.1", "3.2", "3.3"] }
8469

8570
describe "setup" do
8671
it "gemfile contains some files" do
@@ -147,7 +132,7 @@ describe File.basename(gemfile) do
147132
end
148133

149134
it "sets required_ruby_version appropriately" do
150-
all_supported_ruby_versions.each do |v|
135+
supported_ruby_versions.each do |v|
151136
assert(
152137
gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)),
153138
"required_ruby_version='#{gemspec.required_ruby_version}' should support ruby #{v}"
@@ -181,7 +166,7 @@ describe File.basename(gemfile) do
181166
end
182167

183168
it "contains expected shared library files " do
184-
platform_supported_ruby_versions.each do |version|
169+
supported_ruby_versions.each do |version|
185170
actual = gemfile_contents.find do |p|
186171
File.fnmatch?("lib/sqlite3/#{version}/sqlite3_native.{so,bundle}", p, File::FNM_EXTGLOB)
187172
end
@@ -197,26 +182,19 @@ describe File.basename(gemfile) do
197182
File.fnmatch?("lib/sqlite3/**/*.{so,bundle}", p, File::FNM_EXTGLOB)
198183
end
199184
assert_equal(
200-
platform_supported_ruby_versions.length,
185+
supported_ruby_versions.length,
201186
actual.length,
202187
"did not expect extra shared library files"
203188
)
204189
end
205190

206191
it "sets required_ruby_version appropriately" do
207-
unsupported_versions = all_supported_ruby_versions - platform_supported_ruby_versions
208-
platform_supported_ruby_versions.each do |v|
192+
supported_ruby_versions.each do |v|
209193
assert(
210194
gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)),
211195
"required_ruby_version='#{gemspec.required_ruby_version}' should support ruby #{v}"
212196
)
213197
end
214-
unsupported_versions.each do |v|
215-
refute(
216-
gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(v)),
217-
"required_ruby_version='#{gemspec.required_ruby_version}' should not support ruby #{v}"
218-
)
219-
end
220198
end
221199

222200
it "does not set metadata for msys2" do

rakelib/native.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require "rake/extensiontask"
66
require "rake_compiler_dock"
77
require "yaml"
88

9-
cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"]
9+
cross_rubies = ["3.3.0", "3.2.0", "3.1.0"]
1010
cross_platforms = [
1111
"aarch64-linux-gnu",
1212
"aarch64-linux-musl",

sqlite3.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
1818

1919
s.licenses = ["BSD-3-Clause"]
2020

21-
s.required_ruby_version = Gem::Requirement.new(">= 3.0")
21+
s.required_ruby_version = Gem::Requirement.new(">= 3.1")
2222

2323
s.homepage = "https://github.com/sparklemotion/sqlite3-ruby"
2424
s.metadata = {

test/test_database.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ class TestDiscardDatabase < SQLite3::TestCase
727727
def test_fork_discards_an_open_readwrite_connection
728728
skip("interpreter doesn't support fork") unless Process.respond_to?(:fork)
729729
skip("valgrind doesn't handle forking") if i_am_running_in_valgrind
730-
skip("ruby 3.0 doesn't have Process._fork") if RUBY_VERSION < "3.1.0"
731730

732731
GC.start
733732
begin

0 commit comments

Comments
 (0)