From: Nobuyoshi Nakada Date: 2007-01-05T14:15:47+09:00 Subject: [ruby-dev:30081] Re: IO#lineno always returns 0 なかだです。 At Wed, 3 Jan 2007 10:25:19 +0900, Minero Aoki wrote in [ruby-dev:30065]: > HEAD で IO#lineno が常に 0 を返すようになっています。 ちょうど一行の長さと同じlimitを指定したときにlinenoが進んでいません。 $ yes hello | ./miniruby.exe -e '3.times{gets(6);p STDIN.lineno}' 0 0 0 $ ./miniruby.exe -e 'open(ARGV[0]){|f|3.times{s = f.gets(39); p [f.lineno, s]}}' ../src/version.h [1, "#define RUBY_VERSION \"1.9.0\"\n"] [1, "#define RUBY_RELEASE_DATE \"2007-01-04\"\n"] [2, "#define RUBY_VERSION_CODE 190\n"] Index: io.c =================================================================== --- io.c (revision 11475) +++ io.c (working copy) @@ -1644,7 +1644,7 @@ } if (!NIL_P(str)) { - if (limit != 0) { + if (c == EOF || c == delim) { fptr->lineno++; lineno = INT2FIX(fptr->lineno); } @@ -1740,7 +1740,7 @@ } if (!NIL_P(str)) { - if (limit != 0) { + if (c == EOF || c == delim) { fptr->lineno++; lineno = INT2FIX(fptr->lineno); } -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦