cygwin bzr branch crashes with IOError: [Errno 0] Error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Medium
|
Unassigned | ||
Cygwin |
New
|
Undecided
|
Unassigned |
Bug Description
When using the Cygwin version of bzr, the 'branch' and 'checkout' commands both crash with the following error:
IOError: [Errno 0] Error
Here is a full error traceback:
-------
$ bzr -Derror branch http://
bzr: ERROR: exceptions.IOError: [Errno 0] Error
Traceback (most recent call last):
File "commands.py", line 802, in run_bzr_
File "commands.py", line 758, in run_bzr
File "commands.py", line 492, in run_argv_aliases
File "builtins.py", line 877, in run
File "branch.py", line 128, in open
File "bzrdir.py", line 571, in open
File "lazy_import.py", line 125, in __call__
File "__init__.py", line 1607, in get_transport
File "__init__.py", line 1629, in _try_transport_
File "registry.py", line 61, in get_obj
File "registry.py", line 66, in _do_import
File "__init__.py", line 34, in <module>
except IOError, msg:
File "medium.py", line 40, in <module>
File "ssh.py", line 36, in <module>
File "__init__.py", line 68, in <module>
content = f.read()
File "transport.py", line 32, in <module>
File "util.py", line 31, in <module>
File "common.py", line 106, in <module>
File "/usr/lib/
self.
File "/usr/lib/
if num!=2 : raise IOError, (num, msg)
IOError: [Errno 0] Error
bzr 1.0.0 on python 2.5.1.final.0 (cygwin)
arguments: ['/usr/bin/bzr', '-Derror', 'branch', 'http://
encoding: 'US-ASCII', fsenc: 'US-ASCII', lang: None
plugins:
launchpad /usr/lib/
[unknown]
multiparent /usr/lib/
*** Bazaar has encountered an internal error.
Please report a bug at https:/
including this traceback, and a description of what you
were doing when the error occurred.
-------
This bug does not occur on all cygwin installations. Some work just fine, but others show this bug.
This bug occurs in the randpool.py file, which is part of the python-crypto cygwin package. The randpool.py file opens /dev/urandom file, reads data from /dev/urandom, but attempting to close /dev/urandom causes the IOError exception with the num code of zero. Below is the relevant source code from randpool.py:
try:
except IOError, (num, msg):
if num!=2 : raise IOError, (num, msg)
# If the file wasn't found, ignore the error
A workaround is to ignore any error with a code of zero. This seems reasonable, because the current code will ignore the fact that the file was not found. Do this by changing line 120 in /usr/lib/
if num!=2 and num!=0 : raise IOError, (num, msg)
Using this workaround, bzr seems to function normally.
Caution: this workaround involves modifying the source of randomness for ssh connections, so it may represent a security risk. Good randomness is hard to find, but I would be cautious until the python-crypto people can review this change.
Thankyou for the report.
It looks like this is really a cygwin bug that can be worked-around in pycrypto?