Re: python 2.4: os.urandom() hangs if /dev/random, /dev/urandom are not reconnected to a translator
olafBuddenhagen@gmx.net ha scritto:
>> At first I tried showtrans on the /dev/random, /dev/urandom devices
>> and I found they were attached to the unofficial translator
>> (http://hurd.gnufans.org/bin/view/Hurd/RandomDevice). Resetting
>> /dev/random, /dev/urandom by detaching (settrans -fg /dev/urandom) and
>> then reattaching the translator fixed the bug. If I release the
>> translator the bug comes out again.
> Does it also hang if you don't have a translator there at all?
If I settrans -fg /dev/urandom yes, it hangs.
I haven't tried with a clean reinstall.
>>From the above description, it sounds like this is indeed a bug in the
> urandom translator: The read() operation never returns.
Maybe. I don't know how does the random translator work.
Anyway now the translator is attached and I checked it works perfectly,
so it's quite erratic.
I'll dig it ASAP.
> There is no simple way to protect against such misbehaviour in a
> translator, so I don't think there is anything to fix on the Python
I thought that for os.urandom():
- a timeout could be useful on any platform without a reliable random
device (I don't think Hurd is alone in this). I'll ask to the python
- hurd-specifically, the module could maybe also check if a translator
is attached to /dev/urandom and at least spit a warning if there is none.