From: Daniel Berger Date: 2007-08-10T23:28:07+09:00 Subject: Re: Core dump with simple web scraper when run via cron Daniel Berger wrote: > Hi all, > > Solaris 10 > Sun Studio Compiler 12 > ruby 1.8.6 (2007-08-07 patchlevel 5000) [sparc-solaris2.10] > mechanize 0.6.10 > rubygems 0.9.4 > > $CC => cc > $CFLAGS => -g -dalign -fns -xbuiltin=%all -xlibmil -xtarget=ultra2e -xO5 > -xipo -xarch=sparc > > I'm hitting a core dump with the following program. It works fine when I > run it from the command line, but when run via cron it dumps core. > Here's the program in its entirety: > > # rf_downloads.rb > #!/usr/local/bin/ruby > require 'rubygems' > require 'mechanize' > > agent = WWW::Mechanize.new > body = > agent.get('http://rubyforge.org/top/toplist.php?type=downloads').body > > regex = /(.*?)<\/a>.*?(\d+)/ > file = "Rubyforge_Downloads_" + Time.now.strftime("%d_%b_%Y") > fh = File.open(file, 'w') > > body.split("\n").each{ |line| > if m = regex.match(line) > project = m.captures[0].ljust(40) > downloads = m.captures[1] > fh.puts "#{project} #{downloads}" > end > } > > fh.close > # end rf_downloads.rb Oh, and here's the error message: /usr/local/lib/ruby/1.8/timeout.rb:52: [BUG] Segmentation fault ruby 1.8.6 (2007-08-07) [sparc-solaris2.10] Abort - core dumped Regards, Dan