Skip to content

Commit

Permalink
[rubygems/rubygems] Do not use IO#flock on Solaris
Browse files Browse the repository at this point in the history
`io.flock(File::LOCK_EX)` fails on Solaris when the io is opened as
read-only. Due to this issue, `make install` of the ruby package failed
on Solaris.

rubygems/rubygems@5905d17ab2
  • Loading branch information
mame authored and hsbt committed Dec 24, 2021
1 parent 424800f commit 71e85ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/rubygems.rb
Expand Up @@ -788,7 +788,7 @@ def self.write_binary(path, data)

def self.open_with_flock(path, flags, &block)
File.open(path, flags) do |io|
unless java_platform?
if !java_platform? && !solaris_platform?
begin
io.flock(File::LOCK_EX)
rescue Errno::ENOSYS, Errno::ENOTSUP
Expand Down Expand Up @@ -1015,6 +1015,13 @@ def self.java_platform?
RUBY_PLATFORM == "java"
end

##
# Is this platform Solaris?

def self.solaris_platform?
RUBY_PLATFORM =~ /solaris/
end

##
# Load +plugins+ as Ruby files

Expand Down

0 comments on commit 71e85ec

Please sign in to comment.