From: Daniel Kaminski Date: 2008-07-20T06:01:12+09:00 Subject: Re: execve syscall in ruby Rolando Abarca wrote: > On 19-07-2008, at 15:36, Daniel Kaminski wrote: > >> That's me again, now i know that i have to terminate an array with >> null >> pointer, is this possible in ruby? > > NULL is just a 0 (zero): > > $ ruby -e "syscall(11, '/home/rolando/test.rb', ['true', 'lala', > 0].pack('ppi'), ['X=1', 0].pack('pi'))" > ["lala"] > {"X"=>"1"} > > $ cat test.rb > #!/usr/local/bin/ruby > > p ARGV > p ENV -e:1:in `syscall': string contains null byte (ArgumentError) from -e:1 It's the same error when tried ['true', nil].pack('p*'), result is the same too, it adds '000\000\000\000'. Do you have patched ruby build or something? i managed to make it work by commenting few lines from string.c responsible for above exception. regards:-) -- Posted via http://www.ruby-forum.com/.