Ruby crashes on windows across three versions


#1

I’m working on some scripts for work to manage some build releases,
and I’m using ruby and the p4ruby libraries on Windows XP. When I
run my script from the command line or by loading it into IRB, I get:


./SourceControl.rb:63: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-mswin32]

This application has requested the Runtime to terminate it in an
unusual way.
Please contact the application’s support team for more information.

I’ve tried with ruby 1.8.2, 1.8.5, 1.8.6 (all installed w/ the One-
click installer), and I get the exact same thing with each of them.
Just to see if I could get a better error message, I downloaded
ArachnoRuby and ran w/ that. My script runs successfully when I run
it from the IDE. While that has suddenly sold me on ArachnoRuby, it
doesn’t clear up my problem. Any thoughts?

Thanks,
Ben


#2

On 4/18/07, Ben removed_email_address@domain.invalid wrote:

unusual way.
Please contact the application’s support team for more information.

I’ve tried with ruby 1.8.2, 1.8.5, 1.8.6 (all installed w/ the One-
click installer), and I get the exact same thing with each of them.
Just to see if I could get a better error message, I downloaded
ArachnoRuby and ran w/ that. My script runs successfully when I run
it from the IDE. While that has suddenly sold me on ArachnoRuby, it
doesn’t clear up my problem. Any thoughts?

I’m sure it would help if you posted the code causing the error. The
first guess would be that there’s a bug or incompatibility in the
p4ruby extension.


#3

On 4/18/07, Ben removed_email_address@domain.invalid wrote:

unusual way.
Please contact the application’s support team for more information.

Is line 63 of SourceControl.rb a call into the p4ruby API’s? If so,
then you need to open a bug with the p4ruby developer(s). Since
p4ruby is a ruby C extension, the error most likely lies there.

Blessings,
TwP


#4

On Apr 18, 4:09 pm, “Tim P.” removed_email_address@domain.invalid wrote:

Is line 63 of SourceControl.rb a call into the p4ruby API’s? If so,
then you need to open a bug with the p4ruby developer(s). Since
p4ruby is a ruby C extension, the error most likely lies there.

Unfortunately no. I’ll post the code (to my eternal
embarrassment). I hate posting code to usenet groups. You get
everything questioned from your variable names to your personal
lineage. :slight_smile: My qualifiers - this is my quick and dirty parser to get
something going and I’m still learning ruby. Please be kind to
me. :slight_smile:

The parameter passed in is a string containing the depot location

followed by whitespace, followed by a local location

e.g:

“//Development/Product/Branch/… //workspace/Path/Name/Here…”

Returns the Depot path and the local path for the provided

viewspec line
def SourceControl.parseViewSpecLine(line)
depot = []
local = []
state = :findDepot
line.each_byte do |b|
ch = b.chr # convert to ascii
case state
when :findDepot
depot << ch if ch !~ /\s/
state = :findDepotQuoted if ch == “”" ## <-- Ln 63 HERE!!
state = :findPath if ch =~ /\s/
when :findDepotQuoted
depot << ch
state = :findDepot if ch == “”"
when :findPath
local << ch
end
end
# Join the character arrays in a string and return an array of the
two
[depot.join, local.join]
end


#5

On Apr 18, 4:40 pm, Ben removed_email_address@domain.invalid wrote:

On Apr 18, 4:33 pm, Ben removed_email_address@domain.invalid wrote:

I’ll post the code

I should mention that this is called once for each line in the
Perforce view, and it is not crashing on the first call.

Because I love monologuing . . .

On a hunch I added a GC.start right after the first call, and it
crashes there now, so I guess p4ruby doesn’t care for garbage
collection. :frowning: So y’all were right - I should contact the p4ruby
author. Thanks!

-Ben


#6

On Apr 18, 4:33 pm, Ben removed_email_address@domain.invalid wrote:

I’ll post the code

I should mention that this is called once for each line in the
Perforce view, and it is not crashing on the first call.