https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112009-12-04T13:54:58ZRuby Issue Tracking SystemRuby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=71562009-12-04T13:54:58Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Assignee</strong> set to <i>mame (Yusuke Endoh)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72152009-12-07T06:43:28Zvvs (Vladimir Sizikov)vsizikov@gmail.com
<ul></ul><p>=begin<br>
So, is the current 1.8.6-1.8.7 behavior considered a bug or feature?</p>
<p>Once I fixed the behavior in JRuby to match the latest MRI behavior, I'm getting 6 RubySpec failures, where all those tests expect that in paragraph mode only one \n is returned, not two.</p>
<p>I can change the specs, but I need to know the official position here.<br>
=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72182009-12-07T07:37:44Znahi (Hiroshi Nakamura)nakahiro@gmail.com
<ul></ul><p>=begin<br>
2009/12/7 Vladimir Sizikov <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a>:</p>
<blockquote>
<p>Once I fixed the behavior in JRuby to match the latest MRI behavior, I'm getting 6 RubySpec failures, where all those tests expect that in paragraph mode only one \n is returned, not two.</p>
</blockquote>
<p>Would you please point the 6 tests? It must be helpful to discuss this issue.</p>
<p>// NaHi</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72262009-12-07T17:47:51Zvvs (Vladimir Sizikov)vsizikov@gmail.com
<ul></ul><p>=begin<br>
Hi,</p>
<p>On Sun, Dec 6, 2009 at 11:37 PM, NAKAMURA, Hiroshi <a href="mailto:nakahiro@gmail.com" class="email">nakahiro@gmail.com</a> wrote:</p>
<blockquote>
<p>Would you please point the 6 tests? It must be helpful to discuss this issue.</p>
</blockquote>
<p>Sure thing. Here you go (today's latest RubySpecs used):</p>
<p>#> mspec -t j library/stringio<br>
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2009-12-06 6fd3279) (Java<br>
HotSpot(TM) Client VM 1.6.0_17) [x86-java]<br>
............FF.......F.....F...........FF...............</p>
<ol>
<li>
</ol>
<p>StringIO#each_line when passed a separator yields each paragraph when<br>
passed an empty String as separator FAILED<br>
Expected ["para1\n\n", "para2\n\n", "para3"]<br>
to equal ["para1\n", "para2\n", "para3"]</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/shared/each.rb:43<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/each_line_spec.rb:5<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/each_line_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<ol start="2">
<li>
</ol>
<p>StringIO#each when passed a separator yields each paragraph when<br>
passed an empty String as separator FAILED<br>
Expected ["para1\n\n", "para2\n\n", "para3"]<br>
to equal ["para1\n", "para2\n", "para3"]</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/shared/each.rb:43<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/each_spec.rb:5<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/each_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<ol start="3">
<li>
</ol>
<p>StringIO#gets when passed [separator] returns the next paragraph when<br>
the passed separator is an empty String FAILED<br>
Expected "this is\n\n"<br>
to equal "this is\n"</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/gets_spec.rb:42<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/gets_spec.rb:4<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/gets_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<ol start="4">
<li>
</ol>
<p>StringIO#lines when passed a separator yields each paragraph when<br>
passed an empty String as separator FAILED<br>
Expected ["para1\n\n", "para2\n\n", "para3"]<br>
to equal ["para1\n", "para2\n", "para3"]</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/shared/each.rb:43<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/lines_spec.rb:6<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/lines_spec.rb:5<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/lines_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<ol start="5">
<li>
</ol>
<p>StringIO#readline when passed [separator] returns the next paragraph<br>
when the passed separator is an empty String FAILED<br>
Expected "this is\n\n"<br>
to equal "this is\n"</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/readline_spec.rb:43<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/readline_spec.rb:5<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/readline_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<ol start="6">
<li>
</ol>
<p>StringIO#readlines when passed [separator] returns an Array containing<br>
all paragraphs when the passed separator is an empty String FAILED<br>
Expected ["this is\n\n", "an example"]<br>
to equal ["this is\n", "an example"]</p>
<p>D:/work/jruby-dev/rubyspec.git/library/stringio/readlines_spec.rb:31<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/readlines_spec.rb:4<br>
D:/work/jruby-dev/rubyspec.git/library/stringio/readlines_spec.rb:55:in `load'<br>
D:/work/jruby-dev/mspec.git/bin/mspec-run:8</p>
<p>Finished in 0.810000 seconds</p>
<p>56 files, 381 examples, 699 expectations, 6 failures, 0 errors</p>
<p>Thanks,<br>
--Vladimir</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72272009-12-07T18:54:33Znahi (Hiroshi Nakamura)nakahiro@gmail.com
<ul></ul><p>=begin<br>
Hi Vladimir,</p>
<p>2009/12/7 Vladimir Sizikov <a href="mailto:vsizikov@gmail.com" class="email">vsizikov@gmail.com</a>:</p>
<blockquote>
<p>#> mspec -t j library/stringio</p>
</blockquote>
<p>All the failed tests are for StringIO, right? Then we are free to fix<br>
StringIO behavior as well as 1.9 which is consistent with generic IO.</p>
<p>FYI: No tests for JRuby failed by my fix at<br>
<a href="http://github.com/nahi/jruby/commit/a5ffa1bba2e644ef056eb9efc37900c9d86b8a47" class="external">http://github.com/nahi/jruby/commit/a5ffa1bba2e644ef056eb9efc37900c9d86b8a47</a></p>
<p>// NaHi</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72682009-12-10T07:32:22Zvvs (Vladimir Sizikov)vsizikov@gmail.com
<ul></ul><p>=begin<br>
On Mon, Dec 7, 2009 at 10:54 AM, NAKAMURA, Hiroshi <a href="mailto:nakahiro@gmail.com" class="email">nakahiro@gmail.com</a> wrote:</p>
<blockquote>
<p>All the failed tests are for StringIO, right?</p>
</blockquote>
<p>Yes.</p>
<blockquote>
<p>Then we are free to fix<br>
StringIO behavior as well as 1.9 which is consistent with generic IO.</p>
</blockquote>
<p>Yeah, fixing the specs is not a problem. But we need the clear<br>
statement from ruby-core, is the current MRI 1.8.* behavior for<br>
StringIO considered a bug and needs to be fixed, or is it considered a<br>
feature (albeit a bit inconsistent with the standard IO behavior).</p>
<p>Thanks,<br>
--Vladimir</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=72722009-12-10T11:16:37Znahi (Hiroshi Nakamura)nakahiro@gmail.com
<ul></ul><p>=begin<br>
Hi Vladimir,</p>
<blockquote>
<p>Yeah, fixing the specs is not a problem. But we need the clear<br>
statement from ruby-core, is the current MRI 1.8.* behavior for<br>
StringIO considered a bug and needs to be fixed, or is it considered a<br>
feature (albeit a bit inconsistent with the standard IO behavior).</p>
</blockquote>
<p>Author(nobu) assigned this ticket to mame so it's a bug to be fixed in<br>
ruby_1_8 (1.8.8dev). Branch mgmt policy allow to fix a bug by<br>
committer.</p>
<p>Aside from this, 1.8.7 may not incorporate this fix even if it's a<br>
bug. I strongly recommend to apply this fix to 1.8.7 as well (to<br>
resolve StringIO-IO interface mismatch as you said) but it's<br>
shyouhei's job.</p>
<p>// NaHi</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=73792009-12-21T14:22:07Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Assignee</strong> changed from <i>mame (Yusuke Endoh)</i> to <i>nahi (Hiroshi Nakamura)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby 1.8 - Backport #2431: StringIO#{gets,readlines} with "" (paragraph mode) trims last "\n"https://redmine.ruby-lang.org/issues/2431?journal_id=73812009-12-21T15:37:07Znahi (Hiroshi Nakamura)nakahiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>=begin<br>
Applied r17739 at r26140 for 1.8.8dev with Author's confirmation.<br>
=end</p>