From: Mathieu Boespflug Date: 2004-11-14T04:23:11+09:00 Subject: Re: [ANN] RedCloth 3.0.0 -- Textile and Markdown Elope! Hi _why, I'm having stack overflows in the regexp engine as well. I applied the patch below but it hasn't solved the problem. On my box (x86-netbsd) tests/images.yml fails with ./redcloth.rb:566:in `gsub!': Stack overflow in regexp matcher: /((?:\n*[\# ](?:[^\n]|\n+[\# ]|\n(?!\n|\Z))+)|(?:\n*[\* ](?:[^\n]|\n+[\* ]|\n(?!\n|\Z))+)|(?:\n*[> ](?:[^\n]|\n+[> ]|\n(?!\n|\Z))+))|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m (RegexpError) from ./redcloth.rb:566:in `blocks' from ./redcloth.rb:276:in `to_html' from ../bin/redcloth:3 This is with RedCloth 3.0 and ruby ruby 1.8.1. Regards, Mathieu On Wed, Nov 10, 2004 at 08:30:12AM +0900, why the lucky stiff wrote: > Stephan K?mper wrote: > > >C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:566:in > >`gsub!': Stack overflow in regexp matcher: /((?:\n*[\# > >](?:[^\n]|\n+[\# ]|\n(?!\n|\Z))+)|(?:\n*[\* ](?:[^\n]|\n+[\* > >]|\n(?!\n|\Z))+)|(?:\n*[> ](?:[^\n]|\n+[> > >]|\n(?!\n|\Z))+))|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m (RegexpError) > > from > >C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:566:in > >`blocks' > > from > >C:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.0/lib/redcloth.rb:276:in > >`to_html' > > from E:/stephan/source/zz_delete-me/rc_3.rb:6 > > Try the patch below. Also, for simple transformations like the one > you're doing, you might try the new `redcloth' command line tool, which > simply runs a transformation on a provided text file. > > stungun$ redcloth test.rdcl > > Thanks for reporting this right away. The new RedCloth 3.0 needs > testing and beating up. Some Markdown stuff just simply doesn't work, > other things work wrong, and still other things are just sordid and I > won't discuss them here in the presence of professionals. > > _why > > =================================================================== > RCS file: /var/cvs/redcloth/redcloth/lib/redcloth.rb,v > retrieving revision 1.46 > diff -r1.46 redcloth.rb > 558,563c558 > < BLOCKS_GROUP_RE = /(#{ > < ['#', '*', '>'].collect do |sym| > < sym = Regexp::quote( sym ) > < '(?:\n*[' + sym + ' ](?:[^\n]|\n+[' + sym + ' > ]|\n(?!\n|\Z))+)' > < end.join '|' > < })|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m > --- > > BLOCKS_GROUP_RE = /((?:\n*([#*> > ])(?:[^\n]|\n+\2|\n(?!\n|\Z))+))|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m > 567c562 > < plain = $2 ? true : false > --- > > plain = $3 ? true : false >