Your message dated Fri, 25 Feb 2011 21:51:02 +0000
with message-id <[email protected]>
and subject line Bug#598392: fixed in redland-bindings 1.0.13.1-1
has caused the Debian Bug report #598392,
regarding librdf-ruby: causes ruby to segfault from stream.rb
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
598392: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598392
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: librdf-ruby
Version: 1.0.10.1-3
Severity: normal

When I run the attached script with line 47 commented out, the script
works as expected.  When I uncomment line 47, I get:

  /usr/lib/ruby/1.8/rdf/redland/stream.rb:25: [BUG] Segmentation fault
  ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
  
  zsh: abort      ./restaurants

Simply running the script from the command line and then hitting Ctrl-D
at ruby's CGI prompt exhibits the problem.

Please note that the script uses data from my website, so in order to
see the problem, you may need to be connected to the Internet or copy
the file locally and then run it.

If you need more information, please don't hesitate to ask.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages librdf-ruby depends on:
ii  libc6                        2.11.2-6    Embedded GNU C Library: Shared lib
ii  libraptor1                   1.4.21-2    Raptor RDF parser and serializer l
ii  librasqal2                   0.9.20-1    Rasqal RDF query library
ii  librdf0                      1.0.10-3    Redland Resource Description Frame
ii  libruby1.8                   1.8.7.302-2 Libraries necessary to run Ruby 1.
ii  ruby1.8                      1.8.7.302-2 Interpreter of object-oriented scr

librdf-ruby recommends no packages.

librdf-ruby suggests no packages.

-- no debconf information

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
#!/usr/bin/ruby -T

require 'set'
require 'cgi'
require 'uri'
require 'rdf/redland'


class Query
        def initialize(limit, select="SELECT DISTINCT ?obj")
                @prefixes = {
                        "rdf"  => "http://www.w3.org/1999/02/22-rdf-syntax-ns#";,
                        "rdfs" => "http://www.w3.org/2000/01/rdf-schema#";,
                        "dc"   => "http://purl.org/dc/elements/1.1/";,
                        "food" => "http://ns.crustytoothpaste.net/rel/food/";
                }
                @select = select
                @limit = limit
        end
        def to_s
                s = ""
                @prefixes.each_pair { |k, v|
                        s += "PREFIX #{k}: <#{v}>\n"
                }
                s + @select + "\nWHERE {\n" + @limit + "}\n";
        end
        def execute(model)
                bquery = Redland::Query.new(self.to_s, "sparql")
                res = bquery.execute(model)
                if res.nil?
                        return nil
                else
                        QueryResults.new(res)
                end
        end
end

class QueryResults
        def initialize(results)
                @res = results
        end
        def values()
                if @res.nil?
                        return nil
                end
                vals = []
                print @res.as_stream
                while [email protected]?
                        vals << @res.binding_values
                        @res.next
                end
                vals.map { |x| x[0] }
        end
        def stripped_values()
                values().map { |x| strip_brackets(x) }
        end
        protected
        def strip_brackets(uri)
                x = uri.to_s
                x.sub(/^\[(.*)\]$/, '\1')
        end
end

class QueryBuilder
        def available(type)
                type = sanitize(type)
                Query.new("?x food:#{type} ?obj").to_s
        end
        # This should probably be extended to support arbitrary URIs.
        def has_cuisine(type)
                type = sanitize(type)
                Query.new("?x food:cuisine food:#{type} ; dc:title ?obj").to_s
        end
        def has_feature(type)
                type = sanitize(type)
                Query.new("?x food:features food:#{type} ; dc:title ?obj").to_s
        end
        def title(uri)
                type = sanitize_uri(uri)
                Query.new("<#{uri}> dc:title ?obj").to_s
        end
        def all_entries()
                Query.new("?x food:cuisine ?y ; dc:title ?obj").to_s
        end
        protected
        def sanitize(val)
                if val =~ /^[A-Za-z0-9-]+$/
                        return val
                else
                        raise SecurityError
                end
        end
        def sanitize_uri(uri)
                uri = URI.parse(uri)
                if not uri.absolute?()
                        raise SecurityError
                end
                return uri.normalize.to_s
        end
end

class QueryMaker
        def initialize(model)
                @model = model
                @builder = QueryBuilder.new()
        end
        def available(type)
                type = sanitize(type)
                q = Query.new("?x food:#{type} ?obj")
                to_hash(q.execute(@model).stripped_values)
        end
        def has_cuisine(type)
                type = sanitize(type)
                q = Query.new("?x food:cuisine food:#{type} ; dc:title ?obj")
                q.execute(@model).stripped_values
        end
        def has_feature(type)
                type = sanitize(type)
                q = Query.new("?x food:features food:#{type} ; dc:title ?obj")
                q.execute(@model).stripped_values
        end
        def all_entries()
                q = Query.new("?x food:cuisine ?y ; dc:title ?obj")
                q.execute(@model).stripped_values
        end
        def title(uri)
                uri = sanitize_uri(uri)
                q = Query.new("<#{uri}> dc:title ?obj")
                r = q.execute(@model).values
                if r.nil? or r.empty?
                        x = uri.sub(/^\[(.*)\]$/, '\1')
                        x.sub!(/^.*\/([^\/]+)$/, '\1')
                        x.gsub(/(^|[^-])([A-Z])/, '\1 \2').lstrip
                else
                        r[0].to_s
                end
        end
        protected
        def sanitize(val)
                if val =~ /^[A-Za-z0-9-]+$/
                        return val
                else
                        raise SecurityError
                end
        end
        def sanitize_uri(uri)
                uri = URI.parse(uri)
                if not uri.absolute?()
                        raise SecurityError
                end
                return uri.normalize.to_s
        end
        def to_hash(svals)
                h = {}
                svals.each { |x|
                        h[title(x)] = x
                }
                h
        end
end

class PageGenerator
        def prologue()
                p = <<EOP
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" 
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
        <head>
                <title>Houston Restaurants</title>
                <link href="/css/docbook-xhtml/default.css" rel="stylesheet" 
title="Default" type="text/css" />
                <link href="/css/docbook-xhtml/new.css" rel="alternate 
stylesheet" title="New (testing only)" type="text/css" />
        </head>
        <body>
                <div class="content">
                        <div class="article toplevel">
                                <div id="header" class="titlepage">
                                        <h1 class="title">Houston 
Restaurants</h1>
                                </div>
                                <div class="flow" id="main">
EOP
        end
        def epilogue()
                p = <<EOE
                                </div>
                        </div>
                </div>
                <div id="footer" class="footer">
                        <hr />
                        <div class="flow">
                                <p>
                                        This page is <span 
class="valid">valid</span> <span
                                        class="structure"><a
                                        
href="http://validator.w3.org/check/referer";>XHTML+RDFa
                                        1.0</a></span> and uses <span 
class="valid">valid</span>
                                        <span class="style-structure"><a
                                        
href="http://jigsaw.w3.org/css-validator/check/referer";>CSS</a></span>.
                                        This page is licensed under <a 
rel="license"
                                        
href="http://creativecommons.org/licenses/GPL/2.0/";>the GNU
                                        General Public License, version 2</a>.
                                </p>
                        </div>
                </div>
        </body>
        </html>
EOE
        end
        def generate()
                prologue() + build() + epilogue()
        end
end

class FormPageGenerator < PageGenerator
        def initialize(qmaker)
                @data = {}
                @data["Cuisine"] = qmaker.available("cuisine")
                @data["Features"] = qmaker.available("features")
        end
        def build()
                str = <<EOM
<p>
Select all cuisines that are acceptable to you.  Also choose all the features
you desire from the restaurant.  The returned results will find all the
restaurants that have all the features you desire and that match any of the
acceptable cuisines.
</p>
<form action="/cgi-bin/restaurants"
        method="post"><p>
EOM
                @data.keys.sort.each { |k|
                        v = @data[k]
                        v.keys.sort.each { |text|
                                uri = v[text]
                                str += "<input type='checkbox' 
name='#{k.downcase}' value='#{uri}'/>"
                                str += " #{text}<br/>\n"
                        }
                        str += "<br/>\n"
                }
                str += <<EOM
        <input type="submit" name="command" value="Start the magic!"/>
        <input type="submit" name="command" value="See all entries"/>
</p></form>
<div class="section">
        <div class="titlepage">
                <h2 class="title">About this script</h2>
        </div>
        <div class="flow">
                <p>
                        This script is written in Ruby.  It automatically 
generates the
                        labels and categories from information specified in <a 
class="link"
                        href="/~bmc/files/restaurants.rdf">an RDF file</a>.  
Upon
                        submission, the RDF file is queried using SPARQL to 
produce the set
                        of results.
                </p>
        </div>
</div>
EOM
        end
end

class ResultsPageGenerator < PageGenerator
        def initialize(qmaker, params)
                @qmaker = qmaker
                @params = params
                @cuisine = @params["cuisine"].map { |x| x.sub(/^.*\//, '') }
                @features = @params["features"].map { |x| x.sub(/^.*\//, '') }
                @listall = (@params["command"][0] == "See all entries")
        end
        def results()
                if @listall
                        @qmaker.all_entries.sort
                else
                        res = @cuisine.map { |x| @qmaker.has_cuisine(x) 
}.flatten.to_set
                        @features.each { |x|
                                res &= @qmaker.has_feature(x)
                        }
                        res.to_a.sort
                end
        end
        def embed_params()
                str = "<form action='/cgi-bin/restaurants' method='post'>"
                str += "<p style='display: none;'>"
                %w{cuisine features}.each { |x|
                        @params[x].each { |val|
                                str += "<input type='hidden' name='#{x}' 
value='#{val}' />"
                        }
                }
                str += "</p></form>"
                str
        end
        def build()
                res = results()
                if res.empty?
                        str = "<p>No results match your query.  Sorry.</p>"
                else
                        str = <<EOM
<p>
The following results match your query:
</p>
<ul>
EOM
                        res.each { |item|
                                str += "<li>#{item}</li>\n"
                        }
                        str += <<EOM
</ul>
EOM
                end
                str += embed_params()
        end
end

class SimpleInterface
        attr :model
        attr :qmaker
        def initialize(uri)
                @model = Redland::Model.new()
                parser = Redland::Parser.new("rdfxml", "application/rdf+xml")
                parser.parse_into_model(@model, uri)
                @qmaker = QueryMaker.new(@model)
        end
end

if __FILE__ == $PROGRAM_NAME
        iface = 
SimpleInterface.new("http://www.crustytoothpaste.net/~bmc/files/restaurants.rdf";)
        qmaker = iface.qmaker
        
        cgi = CGI.new
        cgi.out("text/html") {
                if cgi.has_key?('cuisine') or cgi.has_key?('command')
                        gen = ResultsPageGenerator.new(qmaker, cgi.params)
                        gen.generate()
                else
                        gen = FormPageGenerator.new(qmaker)
                        gen.generate()
                end
        }
end

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Source: redland-bindings
Source-Version: 1.0.13.1-1

We believe that the bug you reported is fixed in the latest version of
redland-bindings, which is due to be installed in the Debian FTP archive:

librdf-perl_1.0.13.1-1_i386.deb
  to main/r/redland-bindings/librdf-perl_1.0.13.1-1_i386.deb
librdf-ruby_1.0.13.1-1_i386.deb
  to main/r/redland-bindings/librdf-ruby_1.0.13.1-1_i386.deb
php5-librdf_1.0.13.1-1_i386.deb
  to main/r/redland-bindings/php5-librdf_1.0.13.1-1_i386.deb
python-librdf_1.0.13.1-1_i386.deb
  to main/r/redland-bindings/python-librdf_1.0.13.1-1_i386.deb
redland-bindings_1.0.13.1-1.debian.tar.gz
  to main/r/redland-bindings/redland-bindings_1.0.13.1-1.debian.tar.gz
redland-bindings_1.0.13.1-1.dsc
  to main/r/redland-bindings/redland-bindings_1.0.13.1-1.dsc
redland-bindings_1.0.13.1.orig.tar.gz
  to main/r/redland-bindings/redland-bindings_1.0.13.1.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Dave Beckett <[email protected]> (supplier of updated redland-bindings package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Fri, 25 Feb 2011 12:53:33 -0800
Source: redland-bindings
Binary: librdf-perl python-librdf librdf-ruby php5-librdf
Architecture: source i386
Version: 1.0.13.1-1
Distribution: unstable
Urgency: low
Maintainer: Dave Beckett <[email protected]>
Changed-By: Dave Beckett <[email protected]>
Description: 
 librdf-perl - Perl language bindings for the Redland RDF library
 librdf-ruby - Ruby 1.8 language bindings for the Redland RDF library
 php5-librdf - PHP5 language bindings for the Redland RDF library
 python-librdf - Python language bindings for the Redland RDF library
Closes: 598392 613496 613659 613893 614672 614983
Changes: 
 redland-bindings (1.0.13.1-1) unstable; urgency=low
 .
   * New upstream release (Closes: #614983, #598392, #614672, #613496,
     #613659, #613893)
   * debian/rules: Use new --with-perl-makemaker-args to set install dest
     rather than undocumented MAKE_PL_OPTS var
Checksums-Sha1: 
 1062dbb058ed020072055e39b862264c5c9da573 1324 redland-bindings_1.0.13.1-1.dsc
 2ffda14cb0bbae5cc42c213db873fc36d5d76997 774677 
redland-bindings_1.0.13.1.orig.tar.gz
 0286a71fa961e9e2d5b2ea40cbac3beaabf65751 6787 
redland-bindings_1.0.13.1-1.debian.tar.gz
 30a68f6025056aa0efaff8dc1441439b7a19137d 153186 librdf-perl_1.0.13.1-1_i386.deb
 4f46cf8f224c06e7a6617109d9d8b2e43e493a14 117970 
python-librdf_1.0.13.1-1_i386.deb
 e564ebdcc56803b4009ed68153850351c2f92e0a 61240 librdf-ruby_1.0.13.1-1_i386.deb
 53535ed7e3ccf60c41e9e665c9ae98b2bffbb155 51370 php5-librdf_1.0.13.1-1_i386.deb
Checksums-Sha256: 
 6e15bfa5e4ec6b88ac6377e4bbd661e80263b4e89c9f7a5d29a27a29910dd2fb 1324 
redland-bindings_1.0.13.1-1.dsc
 59fb256119842bdd6fc0af02e0e08ea1f868d121c9f16331f93fe11ad332c446 774677 
redland-bindings_1.0.13.1.orig.tar.gz
 4bdd4dd0013b911211528353b2d257deb679777a26484b11d1849fefbf8412f9 6787 
redland-bindings_1.0.13.1-1.debian.tar.gz
 d3bd61211b944a250d2f67c5ac47947c5b873dca9d74ddbe77da028a51e2cd09 153186 
librdf-perl_1.0.13.1-1_i386.deb
 577fd103ec422e13fac2bf64d88119f7d6d8da81ba2257d12f0a2fef13483d5e 117970 
python-librdf_1.0.13.1-1_i386.deb
 7fb194253fb314929a0413a5ee2d5b6835a2b90ee300b50316a7f3d2e8948c88 61240 
librdf-ruby_1.0.13.1-1_i386.deb
 8193385b6e1704dfd052e04bcee297eef137476f6b51f0f08a05bfbe0807ff1b 51370 
php5-librdf_1.0.13.1-1_i386.deb
Files: 
 88d2daee752813804c5c3b369a84a971 1324 devel optional 
redland-bindings_1.0.13.1-1.dsc
 377f273521ec3f3732abba2202fc5e01 774677 devel optional 
redland-bindings_1.0.13.1.orig.tar.gz
 db35521aabc6f7de54795e8e4ff3c1f6 6787 devel optional 
redland-bindings_1.0.13.1-1.debian.tar.gz
 449d85c2c9510cb2d2f671a682b9e5f1 153186 perl optional 
librdf-perl_1.0.13.1-1_i386.deb
 d08e7992843a5638f06f5dfe3b07bd4f 117970 python optional 
python-librdf_1.0.13.1-1_i386.deb
 2c37eab2e007b363ee5ccaedfda21360 61240 ruby optional 
librdf-ruby_1.0.13.1-1_i386.deb
 5ad84eafe0f45f01a38923af00612e96 51370 php optional 
php5-librdf_1.0.13.1-1_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iD8DBQFNaBdeQ+ySUE9xlVoRAm7mAJ48F6Pb+oYltBrDCTa3ggmSkGWjnQCgqEQy
70TQ3wnZhJTLcS2h46wK+sI=
=yJSR
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to