Project

General

Profile

Actions

Bug #1740

closed

ruby regexp 100% usage cpu.

Added by paranormal (paranormal dev) almost 15 years ago. Updated about 13 years ago.

Status:
Rejected
Assignee:
-
ruby -v:
ruby 1.8.7 (2009-04-08 patchlevel 160) [i386-freebsd6]
[ruby-core:24188]

Description

=begin
On freebsd i'm test ruby
ruby 1.8.7 (2009-04-08 patchlevel 160) [i386-freebsd6]

And my linux notebook
ruby -v ruby 1.8.7 (2009-06-08 patchlevel 173) [x86_64-linux]

For this code
#######################################
require 'open-uri'
$KCODE = 'u'

reg = %r{<.?div\sclass\s*=\s*.entry.?>[^<]<.?img\ssrc\s*=\s*.([^"|']).?>[^<]<.?p\sclass\s=\s*.date.?>}im
#del = %r{<(?!p|div|img)[^>]
>}i

doc = open('http://www.radiokvit.com.ua/?p=1895').read

#doc.gsub!(del, ' ')
a = doc.match(reg)
p a
######################################

My ruby process use 100% cpu for long time and on linux exit normaly, on freebsd no exit %-(.
I'm submited another bug for freebsd http://www.freebsd.org/cgi/query-pr.cgi?pr=136384 but this is for freebsd only.

This templates writes another man for perl and i'm must use here.
=end


Files

testfile.html (23.3 KB) testfile.html doc for test regexp. if url is not valid. paranormal (paranormal dev), 07/07/2009 11:38 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0