Segmentation fault in hpricot executin from Apache-PHP

Hello,

I'm really new in ruby but I need to use the premailer ruby
library/binary. I'd like excuting this binary for PHP.

I have installed latest ruby version in debian and then I have installed
libraries through gem. When I execute command in console with user root
or user www-data it's fine.

The problem is that when I call to ruby binary from PHP-Apache (exec,
system, shell_exec) ruby throws a segmentation fault in hpricot library.

Ruby version 1.9.2p0
Rubygems version 1.3.7
Hpricot version is 0.8.3
Premailer version 1.6.2

This is the error:

/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:33:
[BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

-- control frame ----------
c:0010 p:---- s:0046 b:0046 l:000045 d:000045 CFUNC :scan
c:0009 p:0074 s:0041 b:0041 l:000040 d:000040 METHOD
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:33
c:0008 p:0030 s:0034 b:0034 l:000033 d:000033 METHOD
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:4
c:0007 p:0123 s:0028 b:0028 l:000027 d:000027 METHOD
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/lib/premailer/premailer.rb:292
c:0006 p:0264 s:0023 b:0023 l:000022 d:000022 METHOD
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/lib/premailer/premailer.rb:142
c:0005 p:---- s:0018 b:0018 l:000017 d:000017 FINISH
c:0004 p:---- s:0016 b:0016 l:000015 d:000015 CFUNC :new
c:0003 p:0263 s:0011 b:0011 l:000698 d:0000d0 EVAL
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/bin/premailer:87
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000698 d:000698 TOP

···

---------------------------
-- Ruby level backtrace information
----------------------------------------
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/bin/premailer:87:in
`<main>'
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/bin/premailer:87:in
`new'
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/lib/premailer/premailer.rb:142:in
`initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/premailer-1.6.2/lib/premailer/premailer.rb:292:in
`load_html'
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:4:in
`Hpricot'
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:33:in
`make'
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot/parse.rb:33:in
`scan'

-- C level backtrace information
-------------------------------------------
ruby(rb_vm_bugreport+0xa9) [0x52b1a9]
ruby [0x56ea56]
ruby(rb_bug+0xb1) [0x56ebd1]
ruby [0x4b93ff]
/lib/libpthread.so.0 [0x7f9e39b6ba80]
/usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.3/lib/hpricot_scan.so(hpricot_scan+0x240)
[0x7f9e382fdd70]
ruby [0x51e007]
ruby [0x51f5a9]
ruby [0x524858]
ruby [0x51ad5a]
ruby(rb_class_new_instance+0x32) [0x455302]
ruby [0x51e007]
ruby [0x51f5a9]
ruby [0x524858]
ruby(rb_iseq_eval_main+0x288) [0x524bd8]
ruby [0x41a753]
ruby(ruby_run_node+0x36) [0x41c446]
ruby(main+0x4d) [0x41999d]
/lib/libc.so.6(__libc_start_main+0xe6) [0x7f9e38f601a6]
ruby [0x419889]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Thanks in advance.

--
Posted via http://www.ruby-forum.com/.

Hi,
I am facing the same. Did you get the solution?

No, and I'm really lost :frowning:

If you find any workaround let me know please.

Thanks.

···

--
Posted via http://www.ruby-forum.com/.