Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112015-12-17T16:59:38ZRuby Issue Tracking System
Redmine Ruby master - Bug #11833 (Closed): 2.2.4 syntax error when naked percent notation touches keyword...https://redmine.ruby-lang.org/issues/118332015-12-17T16:59:38Zcjcsuhta (Corey Csuhta)corey@cjcsuhta.com
<p>Possible regression:</p>
<p>In Ruby 2.2.3, naked percent-notation was allowed in keyword arguments without spacing, like this:</p>
<pre><code>$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
$ ruby -e "def foo(x:%i[a b c]); puts x end; foo"
a
b
c
</code></pre>
<p>In Ruby 2.2.4 this is a syntax error:</p>
<pre><code>$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
$ ruby -e "def foo(x:%i[a b c]); puts x end; foo"
-e:1: syntax error, unexpected '%', expecting ')'
def foo(x:%i[a b c]); puts x end; foo
^
-e:1: syntax error, unexpected ')', expecting end-of-input
def foo(x:%i[a b c]); puts x end; foo
</code></pre>
<p>This however works:</p>
<pre><code>$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
$ ruby -e "def foo(x: %i[a b c]); puts x end; foo"
a
b
c
</code></pre>
<p>Notice the extra space after <code>x:</code></p> Ruby master - Bug #9569 (Closed): SecureRandom should try /dev/urandom firsthttps://redmine.ruby-lang.org/issues/95692014-02-26T00:48:26Zcjcsuhta (Corey Csuhta)corey@cjcsuhta.com
<p>Right now, <code>SecureRandom.random_bytes</code> tries to detect an OpenSSL to use before it tries to detect <code>/dev/urandom</code>. I think it should be the other way around. In both cases, you just need random bytes to unpack, so SecureRandom could skip the middleman (and <a href="http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/" class="external">second point of failure</a>) and just talk to <code>/dev/urandom</code> directly if it's available.</p>
<p>Is this a case of just re-ordering the two code chunks so that <code>/dev/urandom</code> is tried first?</p>
<p>Relevant lines: <a href="https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L59-L90" class="external">https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb#L59-L90</a></p>