Tweak to urandom opening
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
John A Meinel |
Bug Description
The FreeBSD port of bzr contains a patch to setting up the random device due to the possibility that opening /dev/urandom could throw an exception. Per discussion on IRC, some variant is probably called for:
<lifeless> actually his fix is ok
<lifeless> but it would be better to catch an explicit exception
Patch in question (against 0.9):
--- bzrlib/
+++ bzrlib/osutils.py Fri Aug 18 03:04:58 2006
@@ -593,10 +593,10 @@
except (NotImplemented
# If python doesn't have os.urandom, or it doesn't work,
# then try to first pull random data from /dev/urandom
- if os.path.
+ try:
rand_bytes = file('/
# Otherwise, use this hack as a last resort
- else:
+ except:
# not well seeded, but better than nothing
def rand_bytes(n):
import random
Medium severity because freebsd already has a patch for this which should be in core.
The associated branch has a fix which I'm hoping to integrate into 0.12.