summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-10-12 15:07:58 +0900
committerNobuyoshi Nakada <[email protected]>2023-10-12 17:46:01 +0900
commit1cef5f597d24c55af3454ca652a06d7fa651d6b0 (patch)
treecc1203e26d1959b8b63a5166ee2b82106be69e02 /lib/mkmf.rb
parent2cd9aae4b75b89e9dd0a820ff48d2edea89203c7 (diff)
Include default values in `dir_config` cache keys
The extconf.rb in mysql2 gem repeats `dir_config('mysql')`, without and with the default path. The third call returns the former results even with the default path. Since it does not check the results of the third call, that `nil` is passed to `find_library` as a path, and fails with `NoMethodError`.
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 2acff0ddc0..ec869c812a 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1792,7 +1792,8 @@ SRC
# application.
#
def dir_config(target, idefault=nil, ldefault=nil)
- if conf = $config_dirs[target]
+ key = [target, idefault, ldefault].compact.join("\0")
+ if conf = $config_dirs[key]
return conf
end
@@ -1826,7 +1827,7 @@ SRC
end
$LIBPATH = ldirs | $LIBPATH
- $config_dirs[target] = [idir, ldir]
+ $config_dirs[key] = [idir, ldir]
end
# Returns compile/link information about an installed library in a tuple of <code>[cflags,