Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Ruby bug reading from /dev/urandom after failed require?
Mike Boone
12/22/2007 3:19:00 PM
I've been trying to track down a bug that surfaced when trying to
generate a Rails 2.0.2 app in Cygwin. Reading from /dev/urandom fails
with "No such file or directory - /dev/urandom" if a failed require
has been made previously.
The Rails code looks OK, so I thought it might be Cygwin. I came up
with a simple snippet that fails in Cygwin (see below). Corinna
Vinschen over at Cygwin ran strace on it and thought it might be a
Ruby bug...see her thoughts here:
http://cygwin.com/ml/cygwin/2007-12/msg...
I'm not well versed on the low level strace stuff, but I thought I'd
try to see this through. I'd appreciate any comments from someone
knowledgeable about the Ruby source.
Demonstration code:
----------------------------
# Test failure of reading /dev/urandom after failed require
# this method is from the Rails' source secret_key_generator.rb
def generate_secret_with_urandom
return File.read("/dev/urandom", 64).unpack("H*")[0]
end
cause_failure = true
begin
require 'nonexistent_file'
rescue LoadError
puts '' unless cause_failure
end
puts generate_secret_with_urandom
----------------------------
Thanks,
Mike Boone
http://boonedocks...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Ruby bug reading from /dev/urandom after failed require?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password