cygwin bzr branch crashes with IOError: [Errno 0] Error

Bug #181855 reported by Edi Hance
14
This bug affects 1 person
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://bazaar.launchpad.net/~bialix/bzr-gzipped-bundle/trunk bzr-gzipped-bundle
bzr: ERROR: exceptions.IOError: [Errno 0] Error

Traceback (most recent call last):
  File "commands.py", line 802, in run_bzr_catch_errors
  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_factories
  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/python2.5/site-packages/Crypto/Util/randpool.py", line 87, in __init__
    self._randomize()
  File "/usr/lib/python2.5/site-packages/Crypto/Util/randpool.py", line 126, in _randomize
    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://bazaar.launchpad.net/~bialix/bzr-gzipped-bundle/trunk', 'bzr-gzipped-bundle']
encoding: 'US-ASCII', fsenc: 'US-ASCII', lang: None
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad
 [unknown]
  multiparent /usr/lib/python2.5/site-packages/bzrlib/plugins/multiparent.pyc [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    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:
                f=open(devname)
                data=f.read(nbytes)
                f.close()
            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/python2.5/site-packages/Crypto/Util/randpool.py to read:

                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.

Tags: cygwin
Revision history for this message
Martin Pool (mbp) wrote :

Thankyou for the report.

It looks like this is really a cygwin bug that can be worked-around in pycrypto?

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Martin Pool (mbp) wrote :

Could you please report this to the cygwin or pycrypto developers? I don't think we can feasibly do anything about it in Bazaar.

Revision history for this message
Christian Reis (kiko) wrote :
Revision history for this message
alan ezust (alan-ezust) wrote :

thanks for that workaround. I'm learning bzr now and trying things out, and this saved me a lot of frustration!

Here's hoping that either bzr or randpool.py can be fixed soon so that others won't run into this frustrating bug.

Revision history for this message
yogsototh (yann-esposito-2nd) wrote :

Thanks, it saved me a long search.

I just add some keyword for other people searching (it was not at all the first post I've founded)

keywords: bzr, sftp, IOError
bzr: ERROR: [Errno 0] Error

Revision history for this message
whycrying (sour2001) wrote :

Is it fixed?
But bzr 1.10 also has this bug in cygwin?

Revision history for this message
vinit mahedia (shortempered) wrote :

Thanks for the work around it works , pretty easy as well.

Revision history for this message
Edi Hance (edi-hance) wrote : Re: [Bug 181855] Re: cygwin bzr branch crashes with IOError: [Errno 0] Error

Glad to help. I hope it gets fixed sometime.

On Mon, Jul 6, 2009 at 3:31 PM, vinit mahedia <email address hidden>wrote:

> Thanks for the work around it works , pretty easy as well.
>
> --
> cygwin bzr branch crashes with IOError: [Errno 0] Error
> https://bugs.launchpad.net/bugs/181855
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.