Skip to content

Commit

Permalink
Dir.glob shouldn't modify pattern strings.
Browse files Browse the repository at this point in the history
If the pattern string is frozen, `Dir.glob` would throw an exception improperly. This is a real issue in gemspecs using frozen string literals.
  • Loading branch information
nirvdrum committed May 24, 2018
1 parent 5d619db commit 909930e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/ruby/core/dir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 909930e

Please sign in to comment.