Skip to content

Commit 83345b2

Browse files
hsbtclaude
authored andcommitted
IO::Buffer.map is not shareable across processes on OpenBSD
Restore the OpenBSD exclusion dropped when the windows guard was replaced with a fork guard in the spec sync. OpenBSD has fork but MAP_SHARED writes are not reflected through read(2). https://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20260604T223004Z.fail.html.gz Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9dbd781 commit 83345b2

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

core/io/buffer/map_spec.rb

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,34 @@ def open_big_file_fixture
7373
@buffer.should.valid?
7474
end
7575

76-
guard -> { Process.respond_to?(:fork) } do
77-
it "is shareable across processes" do
78-
file_name = tmp("shared_buffer")
79-
@file = File.open(file_name, "w+")
80-
@file << "I'm private"
81-
@file.rewind
82-
@buffer = IO::Buffer.map(@file)
83-
84-
IO.popen("-") do |child_pipe|
85-
if child_pipe
86-
# Synchronize on child's output.
87-
child_pipe.readlines.first.chomp.should == @buffer.to_s
88-
@buffer.get_string.should == "I'm shared!"
89-
90-
@file.read.should == "I'm shared!"
91-
else
92-
@buffer.set_string("I'm shared!")
93-
puts @buffer
76+
# IO::Buffer.map seems not shareable across processes on OpenBSD.
77+
# See https://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20260129T163005Z.fail.html.gz
78+
platform_is_not :openbsd do
79+
guard -> { Process.respond_to?(:fork) } do
80+
it "is shareable across processes" do
81+
file_name = tmp("shared_buffer")
82+
@file = File.open(file_name, "w+")
83+
@file << "I'm private"
84+
@file.rewind
85+
@buffer = IO::Buffer.map(@file)
86+
87+
IO.popen("-") do |child_pipe|
88+
if child_pipe
89+
# Synchronize on child's output.
90+
child_pipe.readlines.first.chomp.should == @buffer.to_s
91+
@buffer.get_string.should == "I'm shared!"
92+
93+
@file.read.should == "I'm shared!"
94+
else
95+
@buffer.set_string("I'm shared!")
96+
puts @buffer
97+
end
98+
ensure
99+
child_pipe&.close
94100
end
95101
ensure
96-
child_pipe&.close
102+
File.unlink(file_name)
97103
end
98-
ensure
99-
File.unlink(file_name)
100104
end
101105
end
102106

0 commit comments

Comments
 (0)