Ticket #106 (new defect)
Hpricot can't handle some files that are multiples of 16384 bytes
| Reported by: | bien | Owned by: | why |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | ext/hpricot_scan | Version: | |
| Keywords: | Cc: |
Description
I tried to parse an xml file of exactly 65535 bytes with this code:
$ cat bug.rb require 'rubygems' require 'hpricot' File.open(ARGV[0]) do |f| Hpricot(f) end
And I get this error:
$ ruby bug.rb text4.txt
Oh no: read returned Qnil!
/p/lib/gems/hpricot-0.6.155/lib/hpricot/parse.rb:52:in `scan': can't convert nil into String (TypeError)
from /p/lib/gems/hpricot-0.6.155/lib/hpricot/parse.rb:52:in `make'
from /p/lib/gems/hpricot-0.6.155/lib/hpricot/parse.rb:15:in `parse'
from /p/lib/gems/hpricot-0.6.155/lib/hpricot/parse.rb:4:in `Hpricot'
from bug.rb:5
from bug.rb:4:in `open'
from bug.rb:4
Actually, I hacked hpricot_scan.rl by checking in hpricot_scan() if the funcall to s_read returns Qnil, and outputting the Oh no message.
Change History
Note: See
TracTickets for help on using
tickets.
