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/msg00502.html

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.net/mike/