Skip to content

Socket.sockaddr_in doesn't seem to work with integers. #3361

@tenderlove

Description

@tenderlove

This code works on CRuby but not TruffleRuby:

$ ruby -v -rsocket -e'p Socket.sockaddr_in(0, Socket::INADDR_ANY)'
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
"\x10\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
$ ruby -v -rsocket -e'p Socket.sockaddr_in(0, Socket::INADDR_ANY)'
truffleruby 23.1.1, like ruby 3.2.2, Oracle GraalVM Native [aarch64-darwin]
/Users/aaron/.rubies/arm64/truffleruby-23.1.1/lib/truffle/socket/truffle/foreign.rb:280:in `pack_sockaddr_in': undefined method `empty?' for 0:Integer (NoMethodError)
	from /Users/aaron/.rubies/arm64/truffleruby-23.1.1/lib/truffle/socket/socket.rb:237:in `pack_sockaddr_in'
	from -e:1:in `<main>'

I haven't tried investigating the problem yet, just wanted to file the issue so it doesn't get lost. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions