Issue #8627 has been updated by xinjin (Sujin Phil).

File strace.txt added

Seems like this behaviour only happens while running irb
$ uname -a
Linux localhost 3.4.0-sabayon #1 SMP Wed Jul 18 23:06:31 UTC 2012 x86_64 Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz GenuineIntel GNU/Linux

$ cat test.rb 
 require 'socket'
 Socket.pack_sockaddr_in(500, "fdgfdgd")
$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
$ ruby test.rb 
test.rb:2:in `pack_sockaddr_in': No such file or directory - getaddrinfo (Errno::ENOENT)
	from test.rb:2:in `<main>'


Attaching the strace as attachment.


----------------------------------------
Bug #8627: Socket.pack_sockaddr_in crashes ruby
https://bugs.ruby-lang.org/issues/8627#change-40480

Author: xinjin (Sujin Phil)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 
ruby -v:  2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


(({
2.0.0p247 :001 > require 'socket'
 => true 
2.0.0p247 :002 > Socket.pack_sockaddr_in(500, "fdgfdgd")
(irb):2: [BUG] rb_sys_fail(getaddrinfo) - errno == 0
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0019 p:---- s:0077 e:000076 CFUNC  :pack_sockaddr_in
c:0018 p:0015 s:0072 e:000071 EVAL   (irb):2 [FINISH]
c:0017 p:---- s:0070 e:000069 CFUNC  :eval
c:0016 p:0024 s:0063 e:000062 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/workspace.rb:86
c:0015 p:0025 s:0056 e:000054 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/context.rb:380
c:0014 p:0022 s:0050 e:000049 BLOCK  /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:492
c:0013 p:0040 s:0042 e:000041 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:624
c:0012 p:0009 s:0037 e:000036 BLOCK  /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:489
c:0011 p:0118 s:0033 e:000032 BLOCK  /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/ruby-lex.rb:247 [FINISH]
c:0010 p:---- s:0030 e:000029 CFUNC  :loop
c:0009 p:0007 s:0027 e:000026 BLOCK  /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/ruby-lex.rb:233 [FINISH]
c:0008 p:---- s:0025 e:000024 CFUNC  :catch
c:0007 p:0015 s:0021 e:000020 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/ruby-lex.rb:232
c:0006 p:0030 s:0018 E:0020f8 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:488
c:0005 p:0008 s:0015 e:000014 BLOCK  /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:397 [FINISH]
c:0004 p:---- s:0013 e:000012 CFUNC  :catch
c:0003 p:0143 s:0009 E:0004b8 METHOD /home/developer/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb.rb:396
c:0002 p:0122 s:0004 E:001048 EVAL   /home/developer/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16 [FINISH]
c:0001 p:0000 s:0002 E:002308 TOP    [FINISH]


corresponding jruby behaviour
jruby-1.7.4 :001 > require 'socket'
 => true 
jruby-1.7.4 :002 > Socket.pack_sockaddr_in(500, "fdgfdgd")
SocketError: getaddrinfo: No address associated with nodename
	from org/jruby/ext/socket/RubySocket.java:266:in `pack_sockaddr_in'
	from (irb):2:in `evaluate'
	from org/jruby/RubyKernel.java:1093:in `eval'
	from org/jruby/RubyKernel.java:1489:in `loop'
	from org/jruby/RubyKernel.java:1254:in `catch'
	from org/jruby/RubyKernel.java:1254:in `catch'
	from /home/developer/.rvm/rubies/jruby-1.7.4/bin/irb:13:in `(root)'
}))


-- 
http://bugs.ruby-lang.org/