From: Akinori MUSHA Date: 2007-01-07T18:59:17+09:00 Subject: [ruby-dev:30106] Re: StringScanner#scan BUG? --pgp-sign-Multipart_Sun_Jan__7_18:59:16_2007-1 Content-Type: text/plain; charset=ISO-2022-JP  問題ありません。お願いします。 At Sun, 7 Jan 2007 10:34:15 +0900, Minero Aoki wrote: > > 青木です。すみません、すっかり見落としてました。 > > In mail "[ruby-dev:29914] StringScanner#scan BUG?" > とみたまさひろ wrote: > > > とみたです。 > > > > Ruby 1.8.5 で次のコードを実行すると、$KCODE="NONE" かつ正規表現のフラ > > グが e, s, u の場合に、"a:b" を返します。 > > > > require "strscan" > > str = "a:b" > > ["NONE", "EUC", "SJIS", "UTF8"].each do |code| > > p code > > $KCODE = code > > p StringScanner.new(str).scan(/[^\x01\:]+/n) > > p StringScanner.new(str).scan(/[^\x01\:]+/e) > > p StringScanner.new(str).scan(/[^\x01\:]+/s) > > p StringScanner.new(str).scan(/[^\x01\:]+/u) > > end > > > > [^\x01\:] を [^\:\x01] にすると発生しません。期待どおり "a" を返します。 > > > > はじめは Ruby 本体の正規表現のバグかと思ったのですが、StringScanner 以 > > 外では発生しないようです。 > > strscan.c で kcode_set_option を呼んでなかったのが原因でした。 > > 以下のパッチで修正できるのですが、1.8 ブランチにコミットしてよいでしょうか? > extern 関数が 2 つ増えます。 -- / /__ __ Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org / Ruby-lang.org Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp "Different eyes see different things, Different hearts beat on different strings -- But there are times for you and me when all such things agree" --pgp-sign-Multipart_Sun_Jan__7_18:59:16_2007-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQBFoMR0kgvvx5/Z4e4RAjYfAKCZAYaaECeYR4OhQdJO/OpquXi4LgCgoghA DhYpaW7VrB3mAAQKaZAeFhA= =lDM6 -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sun_Jan__7_18:59:16_2007-1--