oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.02k stars 185 forks source link

Dir.mkdir should raise TypeError if 2nd argument is not numeric #2781

Closed djberg96 closed 1 year ago

djberg96 commented 1 year ago

truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [x86_64-darwin]

Spotted this in berger_spec: Dir.mkdir("foo", true)

Expected: 'mkdir': no implicit conversion of true into Integer (TypeError) Actual: method returned 0 and a directory that appears to have defaulted to 001 perms:

ls -al => d--------x 2 dberger staff 64 Nov 12 09:23 foo

It doesn't look like my shell's default umask:

>umask => 022

andrykonchin commented 1 year ago

Thank you for reporting!

I can reproduce the issue with Boolean (true, false).

If the second argument is String, Symbol, Array, nil etc an exception is raised:

Dir.mkdir("foo", :sym)
# <internal:core> core/truffle/polyglot.rb:334:in `execute': unsupported type [:sym] (TypeError)
andrykonchin commented 1 year ago

Fixed in ddaa0759a460fd2a23655c3f5fa5d03bdcd05207