Thanks to visit codestin.com
Credit goes to github.com

Skip to content

File.realpath("a", nil) gives TypeError but should be Errno::ENOENT #8972

@eregon

Description

@eregon

Found in https://github.com/ruby/pathname/actions/runs/17175492171/job/48730815399 (from ruby/pathname#60)

Environment Information

Provide at least:

  • JRuby version (jruby -v): latest release and master

Expected Behavior

irb(main):001> File.realpath("a", nil)
(irb):1:in `realpath': No such file or directory @ rb_check_realpath_internal - a (Errno::ENOENT)
	from (irb):1:in `<main>'
	from <internal:kernel>:187:in `loop'
	from /home/eregon/.rubies/ruby-3.3.5/lib/ruby/gems/3.3.0/gems/irb-1.13.1/exe/irb:9:in `<top (required)>'
	from /home/eregon/.rubies/ruby-3.3.5/bin/irb:25:in `load'
	from /home/eregon/.rubies/ruby-3.3.5/bin/irb:25:in `<main>'

Actual Behavior

irb(main):003:0> File.realpath("a", nil)
org/jruby/RubyFile.java:997:in `realpath': no implicit conversion of nil into String (TypeError)
	from (irb):3:in `evaluate'
	from org/jruby/RubyKernel.java:1277:in `eval'
	from org/jruby/RubyKernel.java:1725:in `loop'
	from org/jruby/RubyKernel.java:1426:in `catch'
	from org/jruby/RubyKernel.java:1426:in `catch'
	from /home/eregon/.rubies/jruby-9.4.12.0/lib/ruby/gems/shared/gems/irb-1.4.2/exe/irb:11:in `<main>'
	from org/jruby/RubyKernel.java:1223:in `load'
	from /home/eregon/.rubies/jruby-9.4.12.0/bin/irb:25:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions