From ba6a36e653c40d10b9dc9d5b102c2a8b5885de90 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 7 Nov 2024 11:00:25 +0900 Subject: [PATCH] [ruby/digest] Fix `--without-common-digest` option In `digest_conf`, "no implicit conversion of false into String" TypeError is raised. https://github.com/ruby/digest/commit/89e5e5fe3a --- ext/digest/digest_conf.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ext/digest/digest_conf.rb b/ext/digest/digest_conf.rb index 36a7d75289..099d20fcbe 100644 --- a/ext/digest/digest_conf.rb +++ b/ext/digest/digest_conf.rb @@ -2,14 +2,16 @@ def digest_conf(name) unless with_config("bundled-#{name}") - cc = with_config("common-digest") - if cc != false or /\b#{name}\b/ =~ cc - if File.exist?("#$srcdir/#{name}cc.h") and - have_header("CommonCrypto/CommonDigest.h") - $defs << "-D#{name.upcase}_USE_COMMONDIGEST" - $headers << "#{name}cc.h" - return :commondigest - end + case cc = with_config("common-digest", true) + when true, false + else + cc = cc.split(/[\s,]++/).any? {|pat| File.fnmatch?(pat, name)} + end + if cc and File.exist?("#$srcdir/#{name}cc.h") and + have_header("CommonCrypto/CommonDigest.h") + $defs << "-D#{name.upcase}_USE_COMMONDIGEST" + $headers << "#{name}cc.h" + return :commondigest end end $objs << "#{name}.#{$OBJEXT}"