From 909930eb64b80db45075cd721bb288a108125655 Mon Sep 17 00:00:00 2001 From: Kevin Menard Date: Thu, 24 May 2018 11:57:26 -0400 Subject: [PATCH] `Dir.glob` shouldn't modify pattern strings. If the pattern string is frozen, `Dir.glob` would throw an exception improperly. This is a real issue in gemspecs using frozen string literals. --- src/main/ruby/core/dir.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/ruby/core/dir.rb b/src/main/ruby/core/dir.rb index fb5ce837a7a9..177e48087086 100644 --- a/src/main/ruby/core/dir.rb +++ b/src/main/ruby/core/dir.rb @@ -216,7 +216,7 @@ def glob(pattern, flags=0, &block) total = matches.size while index < total - Truffle::Type.encode_string matches[index], enc + matches[index] = matches[index].encode(enc) unless matches[index].encoding == enc index += 1 end end