Help: [BUG] Bus Error when 'splitting' a String

D

Diego Virasoro

Hello,
I'm currently trying to run a little script but I am stuck with this
error... which I can't decipher.

The error message says just: [BUG] Bus Error
and with a few puts statements here and there I could work out it is
caused by the line with the split method in the following code:

jobs.each {|job|
outputFile = File.new(SCRIPT_NAME+".o"+job.id.to_s,"r")
outputStr = outputFile.read
if(outputStr =~
/#{STRING_BEFORE_RESULTS}((.|\n)*)#{STRING_AFTER_RESULTS}/)
job.results = $1.split(/\n+/)
puts "Data gathered successfully from file
"+SCRIPT_NAME+".o"+job.id.to_s
else
puts "Program has failed to gather the data from file
"+SCRIPT_NAME+".o"+job.id.to_s
end
outputFile.close
}

One of the reason why I am having so much difficult with this bug is
that if jobs.size is 1 then it runs alright. The problem arises if
jobs.size is 2 (or more): then it would run fine in the first iteration
and fail in the second one.

I have also checked by adding a "puts $1" after the if(outputStr...
line, that for both iterations $1 is actually the correct string.

Any idea???

Thanks in advance

Diego Virsaoro
 
N

Nobuyoshi Nakada

Hi,

At Wed, 18 Oct 2006 23:25:13 +0900,
Diego Virasoro wrote in [ruby-talk:220421]:
The error message says just: [BUG] Bus Error
and with a few puts statements here and there I could work out it is
caused by the line with the split method in the following code:

What's the version and the platform? And debugger available?
 
D

Diego Virasoro

The error message says just: [BUG] Bus Error
What's the version and the platform? And debugger available?
I think (I don't have access now) it is ruby 1.6.2 on Solaris 9.

Diego
 
D

Diego Virasoro

At Wed, 18 Oct 2006 23:25:13 +0900,
Diego Virasoro wrote in [ruby-talk:220421]:
The error message says just: [BUG] Bus Error
and with a few puts statements here and there I could work out it is
caused by the line with the split method in the following code:

What's the version and the platform? And debugger available?

Hi, I got more information now.

ruby -v give this: ruby 1.6.4 (2001-06-04) [sparc-solaris2.9]

Also, I have narrowed down the bug a little further, I think. It seems
that the splitting is actually fine, but it's the subsequent assignment
to job.results which is the problem.

Oh, and using the debbuger there seem to be no problem. In fact from
time to time it crashes on a different iteration of the loop (but
predominantly it crashes in the second one).

Any idea? Any info you can give would be very appreciated. In fact, I
apologize for the newbie question, but what is a bus error? Is it a
memory problem?

Diego
 
N

Nobuyoshi Nakada

Hi,

At Thu, 19 Oct 2006 20:30:07 +0900,
Diego Virasoro wrote in [ruby-talk:220608]:
Any idea? Any info you can give would be very appreciated. In fact, I
apologize for the newbie question, but what is a bus error? Is it a
memory problem?

Upgrade to 1.8.5, or 1.6.8 at least.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top