In article <200312261234.hBQCYQj00954 / moulon.inra.fr>,
  ts <decoux / moulon.inra.fr> writes:

> svg% time ./ruby -ve 'p IO.readlines("aa", nil)'
> ruby 1.8.1 (2003-12-25) [i686-linux]
> -e:1:in `readlines': Interrupt  from -e:1
>
> real    0m9.949s
> user    0m9.611s
> sys     0m0.338s
> svg% 

Because {IO,StringIO,Zlib::GzipReader}#read(nil) is modified to return
a string regardless of its EOF flag.

Index: io.c
===================================================================
RCS file: /src/ruby/io.c,v
retrieving revision 1.248
diff -u -p -r1.248 io.c
--- io.c	26 Dec 2003 01:59:42 -0000	1.248
+++ io.c	26 Dec 2003 13:13:14 -0000
@@ -1028,6 +1028,8 @@ rb_io_getline(rs, fptr)
     rb_io_check_readable(fptr);
     if (NIL_P(rs)) {
 	str = read_all(fptr, 0, Qnil);
+        if (RSTRING(str)->len == 0)
+            str = Qnil;
     }
     else if (rs == rb_default_rs) {
 	return rb_io_getline_fast(fptr, '\n');
@@ -3226,7 +3228,6 @@ rb_f_backquote(obj, str)
 
     rb_io_close(port);
 
-    if (NIL_P(result)) return rb_str_new(0,0);
     return result;
 }
 
Index: ext/stringio/stringio.c
===================================================================
RCS file: /src/ruby/ext/stringio/stringio.c,v
retrieving revision 1.26
diff -u -p -r1.26 stringio.c
--- ext/stringio/stringio.c	24 Dec 2003 05:23:31 -0000	1.26
+++ ext/stringio/stringio.c	26 Dec 2003 13:13:15 -0000
@@ -908,7 +908,7 @@ strio_sysread(argc, argv, self)
     VALUE self;
 {
     VALUE val = strio_read(argc, argv, self);
-    if (NIL_P(val)) {
+    if (NIL_P(val) || RSTRING(val)->len == 0) {
 	rb_eof_error();
     }
     return val;
Index: ext/zlib/zlib.c
===================================================================
RCS file: /src/ruby/ext/zlib/zlib.c,v
retrieving revision 1.7
diff -u -p -r1.7 zlib.c
--- ext/zlib/zlib.c	24 Dec 2003 15:19:11 -0000	1.7
+++ ext/zlib/zlib.c	26 Dec 2003 13:13:17 -0000
@@ -2486,7 +2486,7 @@ gzreader_gets(argc, argv, obj)
 
     if (NIL_P(rs)) {
 	dst = gzfile_read_all(gz);
-	if (!NIL_P(dst)) gz->lineno++;
+	if (RSTRING(dst)->len != 0) gz->lineno++;
 	return dst;
     }
 
-- 
Tanaka Akira