Syck 0.35 + YAML.rb 0.60 -- the 1st stable release

Pleased to announce:

        > syck 0.35 |
              \o
              </\
            /  \

Work on YAML/Syck in Ruby 1.8.0 has gone great, with many helpful bug
reports from pure denizens of the ruby-core list. I feel the major bugs
(bugs as big as pugs) have been slaughtered. We can finally put to rest
old versions of YAML.rb and move forward with new versions.

If you’re using Ruby 1.8.0, don’t bother installing Syck or YAML.rb.
They both come with Ruby now.

If you’re using Ruby 1.6.x, please use the download link and
installation procedure in the attached release notes.

As always, my love is unwavering.

_why

syck-0.35.yml (3.15 KB)

why the lucky stiff wrote:

If you’re using Ruby 1.8.0, don’t bother installing Syck or YAML.rb.
They both come with Ruby now.

Just did a cvs update (for Ruby 1.8) and a clean build. For some reason
it didn’t build syck automatically (although the code’s definitely there
in ext/syck). Had to change directories into ext/syck and do:

 ruby extconf.rb
 make
 sudo make install

Lyle

I had a problem on RedHat 8.0 with ruby-1.6.7:

ruby: relocation error: /usr/lib/site_ruby/1.6/i386-linux/syck.so: undefined symbol: LONG2NUM

/usr/lib/ruby/1.6/i386-linux/ruby.h has:

ruby.h:#define INT2NUM(v) rb_int2inum(v)
ruby.h:#define UINT2NUM(v) rb_uint2inum(v)

but not LONG2NUM

Building instructions in README don´t work, those in RELEASE worked.

Richard

···

On Fri, Jun 06, 2003 at 06:15:58AM +0900, why the lucky stiff wrote:

If you’re using Ruby 1.6.x, please use the download link and
installation procedure in the attached release notes.

Perhaps I’m doing this wrong?

I get

12345 - no cell tags.

def doResult()
row = [ 1, 2, 3, 4, 5 ]
@cgi.out{
@cgi.head{ “\n”+@cgi.title{“Test”} } +
@cgi.body{
@cgi.h1 { “Test” } +
@cgi.table (‘BORDER’ => ‘1’) {
@cgi.tr { row.each { |cell| @cgi.td {"#{cell}"} } }
} # table
} # body
}
end

/usr/lib/ruby/1.6/i386-linux/ruby.h has:

ruby.h:#define INT2NUM(v) rb_int2inum(v)
ruby.h:#define UINT2NUM(v) rb_uint2inum(v)

but not LONG2NUM

If you’re comfortable editing the source, then you can just replace with
INT2NUM and it will work.

Building instructions in README don?t work, those in RELEASE worked.

Noted. Thank you. Both of the above will be checked into CVS shortly.

_why

···

Richard Zidlicky (rz@linux-m68k.org) wrote:

Perhaps I’m doing this wrong?

I get 12345 - no cell tags.

def doResult()
row = [ 1, 2, 3, 4, 5 ]
@cgi.out{
@cgi.head{ “\n”+@cgi.title{“Test”} } +
@cgi.body{
@cgi.h1 { “Test” } +
@cgi.table (‘BORDER’ => ‘1’) {
@cgi.tr { row.each { |cell| @cgi.td {“#{cell}”} } }
} # table
} # body
}
end

You are not 'plus’ing the elements.

try this:

cat xxx.rb
require “cgi”
cgi = CGI.new(“html3”) # add HTML generation methods
cgi.out() do
cgi.html() do
cgi.head{ cgi.title{“TITLE”} } +
cgi.body() do
cgi.table do
cgi.tr do
res = “”
[1, 2, 3, 4].each { |col| res += cgi.td {“#{col}”} }
res
end
end
end
end
end
ruby xxx.rb x
Content-Type: text/html
Content-Length: 178

TITLE
1234
···

On Sat, 07 Jun 2003 04:27:32 +0900, Steven Ketcham wrote:


Simon Strandgaard

Try ‘join’ the elements … :slight_smile:

def doResult()
row = [ 1, 2, 3, 4, 5 ]
@cgi.out{
@cgi.head{ “\n”+@cgi.title{“Test”} } +
@cgi.body{
@cgi.h1 { “Test” } +
@cgi.table (‘BORDER’ => ‘1’) {
@cgi.tr { row.each { |cell| @cgi.td {“#{cell}”} }.join }
} # table
} # body
}
end

···

On Sat, 07 Jun 2003 04:27:32 +0900, Steven Ketcham wrote:

Perhaps I’m doing this wrong?

I get 12345 - no cell tags.

def doResult()
row = [ 1, 2, 3, 4, 5 ]
@cgi.out{
@cgi.head{ “\n”+@cgi.title{“Test”} } +
@cgi.body{
@cgi.h1 { “Test” } +
@cgi.table (‘BORDER’ => ‘1’) {
@cgi.tr { row.each { |cell| @cgi.td {“#{cell}”} } }
} # table
} # body
}
end


Simon Strandgaard

done that already :slight_smile:

got a new problem though, this time it is happening randomly and
pretty rare in a threaded program so could not get gdb backtrace
yet:

/usr/lib/site_ruby/1.6/yaml/emitter.rb:285: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-19) [i386-linux]
Aborted

Any idea?

Richard

···

On Sat, Jul 05, 2003 at 09:17:18AM +0900, why the lucky stiff wrote:

Richard Zidlicky (rz@linux-m68k.org) wrote:

/usr/lib/ruby/1.6/i386-linux/ruby.h has:

ruby.h:#define INT2NUM(v) rb_int2inum(v)
ruby.h:#define UINT2NUM(v) rb_uint2inum(v)

but not LONG2NUM

If you’re comfortable editing the source, then you can just replace with
INT2NUM and it will work.

Sorry I was too quick… you need to do “collect & join”, like this:

@cgi.tr { row.collect { |cell| @cgi.td {"#{cell}"} }.join }
···

On Fri, 06 Jun 2003 22:07:55 +0200, Simon Strandgaard wrote:

On Sat, 07 Jun 2003 04:27:32 +0900, Steven Ketcham wrote:

Perhaps I’m doing this wrong?

I get 12345 - no cell tags.

Try ‘join’ the elements … :slight_smile:


Simon Strandgaard

Ok that worked but the code below gives garbage with objects.

class TestObject
attr_reader :data

def initialize(val1, val2)
@data = [val1, val2]
end
end

class Test
def initialize
createObjects
doHTML
end

def createObjects
@data = Array.new
for num in 1…10 do
@data << TestObject.new (num, num * 10)
end
end

def doHTML
cgi = CGI.new(“html3”)
cgi.out{
cgi.head{ “\n”+ cgi.title{“Test”} } +
cgi.body{
cgi.h1 { “Test” } +
cgi.table do
@data.each do |testObject|
cgi.tr do
testObject.data.each do |value|
# output is: 10 100 20 200…
# puts “#{value}”
res = “”

                        # output is: <TestObject:0x2b20588>#<TestObject:0x2b20570>... 
                        res += cgi.td {"#{value}"} 
                        res
                     end
                 end # tr
              end # @data
          end # table
      } # body
    }

end
end

Perhaps I’m doing this wrong?

…snip…

You are not 'plus’ing the elements.

try this:

cat xxx.rb
require “cgi”
cgi = CGI.new(“html3”) # add HTML generation methods
cgi.out() do
cgi.html() do
cgi.head{ cgi.title{“TITLE”} } +
cgi.body() do
cgi.table do
cgi.tr do
res = “”
[1, 2, 3, 4].each { |col| res += cgi.td {“#{col}”} }
res
end
end
end
end
end
ruby xxx.rb x
Content-Type: text/html
Content-Length: 178

TITLE
1234
···

6/6/2003 3:06:24 PM, “Simon Strandgaard” 0bz63fz3m1qt3001@sneakemail.com wrote:

On Sat, 07 Jun 2003 04:27:32 +0900, Steven Ketcham wrote:


Simon Strandgaard

Hard to say. What’s the data like that you’re dumping (calling
to_yaml)?

Incidentally, I’m nearing completion on a C emitter. I don’t think I’ll
try to merge anything new before 1.8.0, but in CVS and thereafter it
will appear.

_why

···

Richard Zidlicky (rz@linux-m68k.org) wrote:

/usr/lib/site_ruby/1.6/yaml/emitter.rb:285: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-19) [i386-linux]
Aborted

Any idea?

Could your segmentation fault be due to the same problem as in the
following?

···

From: Mauricio Fernández batsman.geo@yahoo.com
Date: Sat Jul 5, 2003 7:20:38 PM Europe/London
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Re: Tracking down a seg fault
Reply-To: ruby-talk@ruby-lang.org

On Sun, Jul 06, 2003 at 02:29:23AM +0900, Nigel Gilbert wrote:

I am getting

webcount.rb:818: [BUG] Segmentation fault
ruby 1.6.8 (2002-12-24) [powerpc-darwin6.6]
Abort

from my program. It happens after running the program for some tens of
minutes, and the location identified varies apparently randomly. (The
program essentially downloads web pages in order to measure their size
in terms of pages, links, images etc. for some work I am doing on
devising new indicators of the ‘digital economy’).

I need advice on the best strategy to use to identify what is going
wrong. The program uses threads (obtained through the Resource Pooling
code to be found at
http://www.rubygarden.org/ruby?ObjectPoolingAndThreading), and
net/http, both of which could, I suppose, complicate matters, and the
program is about 900 lines of code, so a strategy is rather important!

I had a similar problem, with the same code (I wrote
ObjectPoolingAndThreading :slight_smile:

I was getting random segfaults with a heavily threaded script that was
doing 200 connections to a dictd server. After some time, I found out
that the problem seemed to be associated to GCC, as the segfault would
only happen when targeting i386 and using gcc 3.2…

Your advice would be much appreciated.

You could check if the problem persists w/ a different GCC (although
I don’t know if you are limited to gcc 3.1 in OSX). Other than that,
I guess there’s not much to do :frowning: In my case, it was impossible to
isolate the bug, as any attempt to remove code would make it impossible
to reproduce it.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

damn my office is cold.
need a hot secretary to warm it up.
– Seen on #Linux

On Sunday, July 6, 2003, at 11:27 AM, Richard Zidlicky wrote:

On Sat, Jul 05, 2003 at 09:17:18AM +0900, why the lucky stiff wrote:

Richard Zidlicky (rz@linux-m68k.org) wrote:

/usr/lib/ruby/1.6/i386-linux/ruby.h has:

ruby.h:#define INT2NUM(v) rb_int2inum(v)
ruby.h:#define UINT2NUM(v) rb_uint2inum(v)

but not LONG2NUM

If you’re comfortable editing the source, then you can just replace
with
INT2NUM and it will work.

done that already :slight_smile:

got a new problem though, this time it is happening randomly and
pretty rare in a threaded program so could not get gdb backtrace
yet:

/usr/lib/site_ruby/1.6/yaml/emitter.rb:285: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-19) [i386-linux]
Aborted

Any idea?

Richard


__
Professor Nigel Gilbert, FREng, AcSS, Pro Vice-Chancellor and Professor
of
Sociology, University of Surrey, Guildford GU2 7XH, UK. +44 (0)1483
689173

If you think that “collect & join” is anoying… then try this:

class Array
# block-join
def bjoin(sep=$,)
return join(sep) if not block_given?
collect { |y| yield(y) }.join(sep)
end
end

#puts [1, 2, 3].bjoin
#puts [1, 2, 3].bjoin(“-”)
#puts [1, 2, 3].bjoin { |v| “#{v-1}” }
#puts [1, 2, 3].bjoin(" ") { |v| “#{v-1}” }

It enables you to do like this:

@cgi.tr { row.bjoin { |cell| @cgi.td {"#{cell}"} } }

OK… I don’t think I have anymore spam for today :slight_smile:

···

On Fri, 06 Jun 2003 22:13:30 +0200, Simon Strandgaard wrote:

Sorry I was too quick… you need to do “collect & join”, like this:

@cgi.tr { row.collect { |cell| @cgi.td {"#{cell}"} }.join }


Simon Strandgaard

Try this:

       cgi.table do
              @data.collect do |testObject|
                 cgi.tr do                           
                     testObject.data.collect do |value|
                        # output is: 10 100 20 200...
                        # puts "#{value}" 
                                                       
                        # output is: <TestObject:0x2b20588>#<TestObject:0x2b20570>... 
                        cgi.td {"#{value}"} 
                     end.join
                 end # tr
              end.join # @data
          end # table
···

On Sat, 07 Jun 2003 06:35:26 +0900, Steven Ketcham wrote:

Ok that worked but the code below gives garbage with objects.


Simon Strandgaard

Nothing special, I have inserted Marshal.dump to get the exact
crash data but that might take a while. Data structure is like

— !ruby/object:FeedList
feeds:

Because it is so hard to reproduce I am guessing it could be
either gc or thread related.

Richard

···

On Mon, Jul 07, 2003 at 07:59:01AM +0900, why the lucky stiff wrote:

Richard Zidlicky (rz@linux-m68k.org) wrote:

/usr/lib/site_ruby/1.6/yaml/emitter.rb:285: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-19) [i386-linux]
Aborted

Any idea?

Hard to say. What’s the data like that you’re dumping (calling
to_yaml)?

it could be the same or related, but so far all symptoms
described seem much to random to be debugged.
Does anyone have a truly repeatable testcase?

BTW does ruby have an option to dump cure instead of
catching the segfault?

Richard

···

On Mon, Jul 07, 2003 at 08:07:21AM +0900, Nigel Gilbert wrote:

Could your segmentation fault be due to the same problem as in the
following?

I did the following:

  • comment the following lines in signal.c (around line 736)
    #ifdef SIGSEGV
    install_sighandler(SIGSEGV, sigsegv);
    #endif
  • compile and rename the binary to gruby, then put it in my path

This way I can get core dumps when debugging rjni.

···

On Tue, Jul 08, 2003 at 06:50:53PM +0900, Richard Zidlicky wrote:

On Mon, Jul 07, 2003 at 08:07:21AM +0900, Nigel Gilbert wrote:

Could your segmentation fault be due to the same problem as in the
following?

it could be the same or related, but so far all symptoms
described seem much to random to be debugged.
Does anyone have a truly repeatable testcase?

BTW does ruby have an option to dump cure instead of
catching the segfault?


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Turns out that grep returns error code 1 when there are no matches.
I KNEW that. Why did it take me half an hour?
– Seen on #Debian

I tested thousands of operations loading/dumping the sample file you gave me.
I’m trying to get some random data in there to test as well, but so far
things seem fine.

What version of Syck are you using? If you’re using 0.35, then I would
upgrade to the CVS version. You can find cases of dump segfaults on
ruby-core that have been fixed since 0.35.

Don’t worry. We’ll beat this thing.

_why

···

On Tuesday 08 July 2003 03:50 am, Richard Zidlicky wrote:

it could be the same or related, but so far all symptoms
described seem much to random to be debugged.
Does anyone have a truly repeatable testcase?