From a2592702ae4c18662a162805aa06d88046742f05 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 17 Jun 2021 10:13:33 -0700 Subject: Actually ignore FNM_CASEFOLD flag in Dir.glob This was already documented as being ignored, but it wasn't being ignored, causing an issue in a particular case where a UTF-8 pattern was provided and a filename was tested that wasn't valid UTF-8. Fixes [Bug #14456] --- dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index d6a963f9d6..8ac10d2360 100644 --- a/dir.c +++ b/dir.c @@ -2955,7 +2955,7 @@ static VALUE dir_s_glob(rb_execution_context_t *ec, VALUE obj, VALUE str, VALUE rflags, VALUE base, VALUE sort) { VALUE ary = rb_check_array_type(str); - const int flags = NUM2INT(rflags) | dir_glob_option_sort(sort); + const int flags = (NUM2INT(rflags) | dir_glob_option_sort(sort)) & ~FNM_CASEFOLD; base = dir_glob_option_base(base); if (NIL_P(ary)) { ary = rb_push_glob(str, base, flags); -- cgit v1.2.1