Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112018-12-25T10:22:38ZRuby Issue Tracking System
Redmine Ruby master - Bug #15460 (Closed): Behaviour of String#setbyte changedhttps://redmine.ruby-lang.org/issues/154602018-12-25T10:22:38Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>I just installed Ruby 2.6.0 for benchmarking reasons and found that the change <a href="https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/65804" class="external">string.c: setbyte silently ignores upper bits</a> broke my library/application HexaPDF.</p>
<p>Before using String#setbyte I tested how it would respond to values lower than 0 or greater than 255 and found that it automatically performed the needed modulo 256 operation (at least up to Ruby 2.5.3). Therefore I left out the explicit modulo operation for performance reasons.</p>
<p>Would it make sense to change the String#setbyte implementation to perform the modulo operation? This would restore compatibility with prior Ruby versions and may be what people would expect.</p> Ruby master - Bug #11132 (Closed): String#sub and character sequence \' in replacement stringhttps://redmine.ruby-lang.org/issues/111322015-05-11T08:48:38Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>Hi,</p>
<p>I don't know if this is intentional but substitution of <code>\'</code> and <code>\`</code> in the replacement string was rather unexpected for me:</p>
<pre><code>2.2.2 :001 > "this is a test".sub(/this/, "some text \\'")
=> "some text is a test is a test"
</code></pre>
<p>I would have expected the following result:</p>
<pre><code> => "some text \\' is a test"
</code></pre>
<p>The documentation says nothing about this, just that back-references can be used (i.e. <code>\\d</code> or <code>\\k<n></code>).</p>
<p>A work-around is escaping the escape character:</p>
<pre><code>2.2.2 :001 > "this is a test".sub(/this/, "some text \\\\'")
=> "some text \\' is a test"
</code></pre>
<p>Thanks!</p> Ruby master - Bug #10928 (Closed): optparse Switch#summarize code doesn't reflect its documentationhttps://redmine.ruby-lang.org/issues/109282015-03-02T17:25:40Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>The documentation for <code>Switch#summarize</code> says "+sdone+:: Already summarized short style options keyed hash." for the <code>sdone</code> argument (similar problem with <code>ldone</code>). I.e. it mentions it should be a Hash.</p>
<p>However, the actual method definition line shows otherwise, namely an Array.</p>
<pre><code>def summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "")
</code></pre>
<p>The <code>OptionParser#summarize</code> command does actually invoke it with Hashes as arguments (line 566): <code>visit(:summarize, {}, {}, width, max, indent, &blk)</code>.</p>
<p>So the method definition for <code>Switch#summarize</code> is probably false.</p> Ruby master - Bug #8006 (Closed): Dir.glob behaves differently on 1.9.3 and 2.0https://redmine.ruby-lang.org/issues/80062013-03-03T00:11:30Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>=begin<br>
While testing an application of mine with Ruby 2.0 I came across the following problem with Dir.glob where the pattern <code>FOO/BAR/**/*</code> does not match the directory <code>FOO/BAR</code> anymore because the implicit directories '.' and '..' don't get matched anymore.</p>
<p>Used files:</p>
<p>$ find data/webgen/basic_website_template/<br>
data/webgen/basic_website_template/<br>
data/webgen/basic_website_template/ext<br>
data/webgen/basic_website_template/ext/init.rb<br>
data/webgen/basic_website_template/webgen.config<br>
data/webgen/basic_website_template/src<br>
data/webgen/basic_website_template/src/.gitignore</p>
<p>With Ruby 1.9.3-p327:</p>
<p>1.9.3-p327 :001 > Dir.glob('data/webgen/basic_website_template/**/*', File::FNM_PATHNAME|File::FNM_DOTMATCH|File::FNM_CASEFOLD)<br>
=> ["data/webgen/basic_website_template/.", "data/webgen/basic_website_template/ext", "data/webgen/basic_website_template/ext/.", "data/webgen/basic_website_template/ext/..", "data/webgen/basic_website_template/ext/init.rb", "data/webgen/basic_website_template/..", "data/webgen/basic_website_template/webgen.config", "data/webgen/basic_website_template/src", "data/webgen/basic_website_template/src/.", "data/webgen/basic_website_template/src/..", "data/webgen/basic_website_template/src/.gitignore"]<br>
1.9.3-p327 :003 ></p>
<p>With Ruby 2.0.0-p0:</p>
<p>2.0.0-p0 :001 > Dir.glob('data/webgen/basic_website_template/**/*', File::FNM_PATHNAME|File::FNM_DOTMATCH|File::FNM_CASEFOLD)<br>
=> ["data/webgen/basic_website_template/ext", "data/webgen/basic_website_template/ext/init.rb", "data/webgen/basic_website_template/webgen.config", "data/webgen/basic_website_template/src", "data/webgen/basic_website_template/src/.gitignore"]</p>
<p>=end</p> Ruby master - Bug #5752 (Closed): Array#delete_if side effects due to changeset r32360https://redmine.ruby-lang.org/issues/57522011-12-13T05:12:02Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>It seems that the changeset r32360 introduced another side effect. Here are two IRB sessions, one in ruby-1.9.2-p136 and the other in ruby-1.9.3-p0:</p>
<p>ruby-1.9.2-p136 :001 > x = [1,2,3,4,5,6,7,8,9]<br>
=> [1, 2, 3, 4, 5, 6, 7, 8, 9]<br>
ruby-1.9.2-p136 :002 > x.delete_if {|i| i == x[i-1]}<br>
=> []</p>
<p>ruby-1.9.3-p0 :001 > x = [1,2,3,4,5,6,7,8,9]<br>
=> [1, 2, 3, 4, 5, 6, 7, 8, 9]<br>
ruby-1.9.3-p0 :002 > x.delete_if {|i| i == x[i-1]}<br>
=> [2, 3, 4, 5, 6, 7, 8, 9]</p>
<p>If this is indeed the intended behaviour, it should probably be documented clearly that the array is changed instantly every time the block is called and not after the iteration is over.</p> Backport191 - Bug #3181 (Rejected): Possible regexp regression in 1.9.1-p378https://redmine.ruby-lang.org/issues/31812010-04-20T22:37:36Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>=begin<br>
Hi,</p>
<p>there seems to be some sort of regression in 1.9.1-p378 regarding regular expressions and I18N support.</p>
<p>Example program:</p>
<a name="---coding-utf-8-"></a>
<h1 >-<em>- coding: utf-8 -</em>-<a href="#---coding-utf-8-" class="wiki-anchor">¶</a></h1>
<p>puts "Should match"<br>
md = /\w/u.match("üäß")<br>
p md.to_a</p>
<p>Example output:</p>
<p>jruby 1.5.0.RC1 (ruby 1.8.7 patchlevel 249) (2010-04-14 0b08bc7) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]<br>
Should match at index 0<br>
["\303\274"]<br>
rubinius 1.0.0-rc4 (1.8.7 release 2010-03-31 JI) [x86_64-apple-darwin10.2.0]<br>
Should match at index 0<br>
["\303\274"]<br>
ruby 1.8.6 (2010-02-05 patchlevel 399) [i686-darwin10.2.0]<br>
Should match at index 0<br>
["\303\274"]<br>
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0]<br>
Should match at index 0<br>
["\303\274"]<br>
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.2.0]<br>
Should match at index 0<br>
["ü"]<br>
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]<br>
Should match at index 0<br>
[]<br>
ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-darwin10.2.0]<br>
Should match at index 0<br>
["ü"]</p>
<p>Best regards,<br>
Thomas<br>
=end</p> Backport187 - Backport #1182 (Closed): REXML::Source#position badly implemented and other related...https://redmine.ruby-lang.org/issues/11822009-02-20T16:35:27Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>=begin<br>
The implementation of REXML::Source#position works sometimes but most of the time it doesn't. Here is the source for the method:</p>
<pre><code> 119 def position
120 @orig.index( @buffer )
121 end
</code></pre>
<p>The @buffer holds everything after the current position and @orig is the original string. It often occurs that @buffer is so short that multiple matches in @orig are possible and therefore a correct position cannot be obtained.</p>
<p>The easiest way to remedy the situation (I think) is to introduce an instance variable @pos that holds the current position (I have attached a fixed version of the REXML::Source class based on the 1.9.1 file rexml/source.rb).</p>
<p>This bug applies to Ruby 1.8 and 1.9 altough it seems that the REXML::Source class isn't used there anymore (the SourceFactory uses a StringIO object when presented a string and therefore uses REXML::SourceIO instead of REXML::Source) - so maybe in 1.9 the REXML::Source class can be removed?<br>
=end</p> Backport187 - Backport #718 (Closed): Emacs ruby-mode does not show comment #@var correctlyhttps://redmine.ruby-lang.org/issues/7182008-11-07T15:49:31Zgettalong (Thomas Leitner)t_leitner@gmx.at
<p>=begin<br>
Normal comments are shown correctly, ie. correctly colored. However, when commenting an instance variable without a<br>
leading space, the color of the comment is the same as the color of an uncommented instance variable.</p>
<p>To reproduce, type the following in Emacs in a buffer with ruby-mode:</p>
<a name="this-does-work"></a>
<h1 >this does work<a href="#this-does-work" class="wiki-anchor">¶</a></h1>
<a name="var-this-does-also-work-shown-in-comment-color"></a>
<h1 >@var this does also work (shown in comment color)<a href="#var-this-does-also-work-shown-in-comment-color" class="wiki-anchor">¶</a></h1>
<p>#@var this does not work (shown in instance variable color)<br>
=end</p>