Forum: Ruby ruby crashes on windows across three versions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ben (Guest)
on 2007-04-18 23:45
(Received via mailing list)
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
Leslie V. (Guest)
on 2007-04-19 00:01
(Received via mailing list)
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.
Tim P. (Guest)
on 2007-04-19 00:09
(Received via mailing list)
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
Ben (Guest)
on 2007-04-19 00:36
(Received via mailing list)
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.  :)  My qualifiers - this is my quick and dirty parser to get
something going and I'm still learning ruby.  Please be kind to
me.  :)

## 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
Ben (Guest)
on 2007-04-19 00:46
(Received via mailing list)
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.
Ben (Guest)
on 2007-04-19 01:01
(Received via mailing list)
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.  :(  So y'all were right - I should contact the p4ruby
author.  Thanks!

-Ben
This topic is locked and can not be replied to.