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

Bug #181855 reported by Edi Hance on 2008-01-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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 bzr-gzipped-bundle
bzr: ERROR: exceptions.IOError: [Errno 0] Error

Traceback (most recent call last):
  File "", line 802, in run_bzr_catch_errors
  File "", line 758, in run_bzr
  File "", line 492, in run_argv_aliases
  File "", line 877, in run
  File "", line 128, in open
  File "", line 571, in open
  File "", line 125, in __call__
  File "", line 1607, in get_transport
  File "", line 1629, in _try_transport_factories
  File "", line 61, in get_obj
  File "", line 66, in _do_import
  File "", line 34, in <module>
    except IOError, msg:
  File "", line 40, in <module>
  File "", line 36, in <module>
  File "", line 68, in <module>
    content =
  File "", line 32, in <module>
  File "", line 31, in <module>
  File "", line 106, in <module>
  File "/usr/lib/python2.5/site-packages/Crypto/Util/", line 87, in __init__
  File "/usr/lib/python2.5/site-packages/Crypto/Util/", line 126, in _randomize
    if num!=2 : raise IOError, (num, msg)
IOError: [Errno 0] Error

bzr 1.0.0 on python (cygwin)
arguments: ['/usr/bin/bzr', '-Derror', 'branch', '', 'bzr-gzipped-bundle']
encoding: 'US-ASCII', fsenc: 'US-ASCII', lang: None
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad
  multiparent /usr/lib/python2.5/site-packages/bzrlib/plugins/multiparent.pyc [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at
    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 file, which is part of the python-crypto cygwin package. The 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

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

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
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.

Christian Reis (kiko) wrote :
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 can be fixed soon so that others won't run into this frustrating bug.

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

whycrying (sour2001) wrote :

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

vinit mahedia (shortempered) wrote :

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

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
> You received this bug notification because you are a direct subscriber
> of the bug.

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

Other bug subscribers