[#22195] IO::for_io and TCPServer#bind — GOTOU Yuuzou <gotoyuzo@...>

test_drb が IPv4 射影アドレスが有効な環境でないと動かないこ

16 messages 2003/12/09
[#22198] Re: IO::for_io and TCPServer#bind — matz@... (Yukihiro Matsumoto) 2003/12/09

まつもと ゆきひろです

[#22205] yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org>

StringIO の

24 messages 2003/12/10
[#22206] Re: yet another inconsistency about EOF between StringIO and IO — nobu.nakada@... 2003/12/10

なかだです。

[#22214] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/10

In article <200312100725.hBA7P8Ac011112@sharui.nakada.kanuma.tochigi.jp>,

[#22222] Re: yet another inconsistency about EOF between StringIO and IO — nobu.nakada@... 2003/12/10

なかだです。

[#22234] Re: yet another inconsistency about EOF between StringIO and IO — Masahiro Sakai (酒井政裕) <sakai@...> 2003/12/11

さかいといいます。

[#22262] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/13

In article <20031211.214041.71090239.sakai@tom.sfc.keio.ac.jp>,

[#22328] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/23

In article <87k751dzyf.fsf@serein.a02.aist.go.jp>,

[#22331] Re: yet another inconsistency about EOF between StringIO and IO — matz@... (Yukihiro Matsumoto) 2003/12/23

まつもと ゆきひろです

[#22334] Re: yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org> 2003/12/23

In article <1072167374.096702.13473.nullmailer@picachu.netlab.jp>,

[#22343] Re: yet another inconsistency about EOF between StringIO and IO — matz@... (Yukihiro Matsumoto) 2003/12/23

まつもと ゆきひろです

[#22330] core dump with ungetc — Tanaka Akira <akr@...17n.org>

次のように ungetc を使うと core を吐く場合があります。

14 messages 2003/12/23
[#22332] Re: core dump with ungetc — nobu.nakada@... 2003/12/23

なかだです。

[#22366] `to_s': method `to_s' overridden (TypeError) — Tanaka Akira <akr@...17n.org>

そういえば、次の `to_s': method `to_s' overridden (TypeError) というの

12 messages 2003/12/24

[#22385] Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...>

永井@知能.九工大です.

19 messages 2003/12/24
[#22387] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22393] Re: Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...> 2003/12/24

永井@知能.九工大です.

[#22395] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22396] Re: Tk.callback_break causes seg-fault or hang-up — matz@... (Yukihiro Matsumoto) 2003/12/24

まつもと ゆきひろです

[#22397] Re: Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...> 2003/12/24

永井@知能.九工大です.

[#22418] ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...>

みやむこです。

29 messages 2003/12/25
[#22419] Re: ruby-1.8.1 build failed on HP-UX 11.11 — matz@... (Yukihiro Matsumoto) 2003/12/25

まつもと ゆきひろです

[#22420] Re: ruby-1.8.1 build failed on HP-UX 11.11 — matz@... (Yukihiro Matsumoto) 2003/12/25

まつもと ゆきひろです

[#22424] Re: ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...> 2003/12/25

みやむこです。

[#22491] Re: ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...> 2004/01/05

みやむこです。

[ruby-dev:22206] Re: yet another inconsistency about EOF between StringIO and IO

From: nobu.nakada@...
Date: 2003-12-10 07:25:09 UTC
List: ruby-dev #22206
なかだです。

At Wed, 10 Dec 2003 15:49:51 +0900,
Tanaka Akira wrote:
> どちらをどちらに合わせるべきかという点に関しては、StringIO のような挙
> 動を IO にさせるには read(2) だけではできないので、StringIO を IO にあ
> わせるほうが良いと思います。

確かに。


Index: ext/stringio/stringio.c
===================================================================
RCS file: /cvs/ruby/src/ruby/ext/stringio/stringio.c,v
retrieving revision 1.21
diff -u -2 -p -d -r1.21 stringio.c
--- ext/stringio/stringio.c	5 Dec 2003 02:54:48 -0000	1.21
+++ ext/stringio/stringio.c	10 Dec 2003 07:24:24 -0000
@@ -868,4 +868,5 @@ strio_read(argc, argv, self)
     str = rb_str_substr(ptr->string, ptr->pos, len);
     if (NIL_P(str)) {
+	if (!(ptr->flags & STRIO_EOF)) str = rb_str_new(0, 0);
 	ptr->flags |= STRIO_EOF;
     }
Index: test/ruby/test_file.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/ruby/test_file.rb,v
retrieving revision 1.4
diff -u -2 -p -d -r1.4 test_file.rb
--- test/ruby/test_file.rb	9 Dec 2003 05:33:32 -0000	1.4
+++ test/ruby/test_file.rb	10 Dec 2003 07:15:57 -0000
@@ -42,3 +42,5 @@ class TestFile < Test::Unit::TestCase
   end
   alias open_file_rw open_file
+
+  include TestEOF::Seek
 end
Index: test/ruby/ut_eof.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/ruby/ut_eof.rb,v
retrieving revision 1.2
diff -u -2 -p -d -r1.2 ut_eof.rb
--- test/ruby/ut_eof.rb	9 Dec 2003 05:33:32 -0000	1.2
+++ test/ruby/ut_eof.rb	10 Dec 2003 07:22:51 -0000
@@ -54,3 +54,30 @@ module TestEOF
     }
   end
+
+  module Seek
+    def open_file_seek(content, pos)
+      open_file(content) do |f|
+        f.seek(pos)
+        yield f
+      end
+    end
+
+    def test_eof_0_seek
+      open_file_seek("", 10) {|f|
+        assert_equal("", f.read)
+        assert_equal(nil, f.read)
+      }
+    end
+
+    def test_eof_1_seek
+      open_file_seek("a", 10) {|f|
+        assert_equal("", f.read)
+        assert_equal(nil, f.read)
+      }
+      open_file_seek("a", 1) {|f|
+        assert_equal("", f.read)
+        assert_equal(nil, f.read)
+      }
+    end
+  end
 end
Index: test/stringio/test_stringio.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/stringio/test_stringio.rb,v
retrieving revision 1.3
diff -u -2 -p -d -r1.3 test_stringio.rb
--- test/stringio/test_stringio.rb	9 Dec 2003 05:35:16 -0000	1.3
+++ test/stringio/test_stringio.rb	10 Dec 2003 07:16:14 -0000
@@ -13,3 +13,5 @@ class TestStringIO < Test::Unit::TestCas
   end
   alias open_file_rw open_file
+
+  include TestEOF::Seek
 end


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread