[groonga-dev,00203] Re: 末尾に:をもつ項が最初にあるクエリでSEGVする

Back to archive index

morit****@razil***** morit****@razil*****
2009年 9月 22日 (火) 14:54:35 JST


森です。

ご指摘ありがとうございます!!

最新版で修正いたしました。

なお、grn_expr_parse()関数のparse_level引数に、2〜3を指定したときに限り、

  カラム名:値

のような文字列を、カラム検索条件として解釈するようにしました。

したがって、

 "photo:"

のようなクエリは以下のように解釈されます。

parse_levelに0〜1を指定した場合:

 単なる文字列として解釈されます。

parse_levelに2〜3を指定した場合:

 "photo"という名前のカラムに対する検索条件として解釈されます。
 名前に一致するカラムが存在しない場合はエラーが返ります。

以上よろしくお願いします。

>>> SHIDARA Yoji さんは書きました:
> daraです。
> 
> "photo:"のようなクエリでSEGVが発生しました。
> 
> 再現する条件がやや複雑で、手元では、
> - 対象のレコードが1件のみの場合は再現しませんでした。
> - "photo: OR photo" や "photo: OR abc" 、 "photo: abc" でも再現します。
> - "photo OR photo:" の場合は再現しませんでした。
> 
> groonga commit 00c4049bf9712ee164b02bb9d9d72115a3f0d441、
> Ruby/groonga r668 です。
> 
> 以下のようなコードで確認しています。
> 
> #!/usr/bin/env ruby
> $KCODE='u'
> require 'groonga'
> 
> Groonga::Database.create(:path => 'db/groonga')
> Groonga::Schema.define do |schema|
>   schema.create_table("data", :type => :hash) do |table|
>     table.text("text")
>     table.time("time")
>   end
>   schema.create_table("terms",
>                       :type => :patricia_trie,
>                       :key_normalize => true,
>                       :default_tokenizer => "TokenBigram") do |table|
>     table.index("data.text")
>                       end
> end
> 
> data = Groonga::Context.default['data']
> data.add('1', :text => "photo: one two", :time => 0)
> data.add('2', :text => "photo: one two", :time => 0)
> results = data.select { |r| r['text'].match "photo:" }
> 
> 実行結果は以下の通りです。
> 
> dara @ buzztter:~/groonga_test$ gdb --args ruby -v query_with_colon.rb
> GNU gdb 6.8-debian
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu"...
> (no debugging symbols found)
> (gdb) r
> Starting program: /usr/bin/ruby -v query_with_colon.rb
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> [Thread debugging using libthread_db enabled]
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> (no debugging symbols found)
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> [New Thread 0x7ff1da72f6e0 (LWP 23219)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ff1da72f6e0 (LWP 23219)]
> 0x00007ff1d914b3d6 in grn_table_select_ (ctx=0x14f4fc0,
> table=0x1564ee0, expr=0x15c1a90,
>     v=0x15eac40, res=0x15c1260, op=GRN_OP_OR) at db.c:8025
> 8025	        if (r && (score = GRN_UINT32_VALUE(r))) {
> (gdb) bt
> #0  0x00007ff1d914b3d6 in grn_table_select_ (ctx=0x14f4fc0,
> table=0x1564ee0, expr=0x15c1a90,
>     v=0x15eac40, res=0x15c1260, op=GRN_OP_OR) at db.c:8025
> #1  0x00007ff1d914cb74 in grn_table_select (ctx=0x14f4fc0,
> table=0x1564ee0, expr=0x15c1a90,
>     res=0x15c1260, op=GRN_OP_OR) at db.c:8244
> #2  0x00007ff1d93e6235 in rb_grn_table_select (argc=<value optimized out>,
>     argv=<value optimized out>, self=140676728233320)
>     at /home/dara/local/src/ruby-groonga/ext/rb-grn-table.c:1302
> #3  0x00007ff1da25b6c2 in ?? () from /usr/lib/libruby1.8.so.1.8
> #4  0x00007ff1da25b82a in ?? () from /usr/lib/libruby1.8.so.1.8
> #5  0x00007ff1da2557e0 in ?? () from /usr/lib/libruby1.8.so.1.8
> #6  0x00007ff1da258f80 in ?? () from /usr/lib/libruby1.8.so.1.8
> #7  0x00007ff1da256c02 in ?? () from /usr/lib/libruby1.8.so.1.8
> #8  0x00007ff1da26867b in ?? () from /usr/lib/libruby1.8.so.1.8
> #9  0x00007ff1da2686c5 in ruby_exec () from /usr/lib/libruby1.8.so.1.8
> #10 0x00007ff1da2686f2 in ruby_run () from /usr/lib/libruby1.8.so.1.8
> #11 0x00000000004008b3 in main ()
> (gdb)
> 
> 
> -- 
> SHIDARA Yoji
> 本を書きました! http://www.amazon.co.jp/dp/4798119881
> 
> _______________________________________________
> groonga-dev mailing list
> groon****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/groonga-dev
> 
--
morita




groonga-dev メーリングリストの案内
Back to archive index