Expected unicode or bytes, got <read-only buffer for 0x10fb7e120, size 5242880, offset 0 at 0x10fb79eb0>

Bug #1293257 reported by Bob Tanner
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Undecided
Unassigned
paramiko
New
Undecided
Unassigned
bzr (Debian)
Fix Released
Unknown

Bug Description

Attempted to push a repository. I'm guessing it's the pycrypto changes I had to make in order to get pycrypto to compile with
clang-5.1

That bug report is here:
https://bugs.launchpad.net/pycrypto/+bug/1292783

Merged this change:
https://github.com/dlitz/pycrypto/pull/63

bzr: ERROR: exceptions.TypeError: Expected unicode or bytes, got <read-only buffer for 0x10fb7e120, size 5242880, offset 0 at 0x10fb79eb0>

Traceback (most recent call last):
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 1121, in run_bzr
    ret = run(*run_argv)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/builtins.py", line 1393, in run
    use_existing_dir=use_existing_dir, no_tree=no_tree)
  File "/Users/tanner/projects/bzr.dev/bzrlib/push.py", line 94, in _show_push_branch
    no_tree=no_tree)
  File "/Users/tanner/projects/bzr.dev/bzrlib/branch.py", line 1415, in create_clone_on_transport
    no_tree=no_tree)
  File "/Users/tanner/projects/bzr.dev/bzrlib/bzrdir.py", line 209, in clone_on_transport
    result_repo.fetch(local_repo, fetch_spec=fetch_spec)
  File "/Users/tanner/projects/bzr.dev/bzrlib/vf_repository.py", line 1268, in fetch
    find_ghosts=find_ghosts, fetch_spec=fetch_spec)
  File "/Users/tanner/projects/bzr.dev/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/vf_repository.py", line 2585, in fetch
    find_ghosts=find_ghosts)
  File "/Users/tanner/projects/bzr.dev/bzrlib/fetch.py", line 77, in __init__
    self.__fetch()
  File "/Users/tanner/projects/bzr.dev/bzrlib/fetch.py", line 104, in __fetch
    self._fetch_everything_for_search(search_result)
  File "/Users/tanner/projects/bzr.dev/bzrlib/fetch.py", line 132, in _fetch_everything_for_search
    stream, from_format, [])
  File "/Users/tanner/projects/bzr.dev/bzrlib/vf_repository.py", line 2038, in insert_stream
    self.target_repo.start_write_group()
  File "/Users/tanner/projects/bzr.dev/bzrlib/repository.py", line 782, in start_write_group
    self._start_write_group()
  File "/Users/tanner/projects/bzr.dev/bzrlib/repofmt/pack_repo.py", line 1724, in _start_write_group
    self._pack_collection._start_write_group()
  File "/Users/tanner/projects/bzr.dev/bzrlib/repofmt/pack_repo.py", line 1531, in _start_write_group
    file_mode=self.repo.bzrdir._get_file_mode())
  File "/Users/tanner/projects/bzr.dev/bzrlib/repofmt/groupcompress_repo.py", line 160, in __init__
    self._writer.begin()
  File "/Users/tanner/projects/bzr.dev/bzrlib/pack.py", line 132, in begin
    self.write_func(self._serialiser.begin())
  File "/Users/tanner/projects/bzr.dev/bzrlib/pack.py", line 135, in write_func
    self._write_func(bytes)
  File "/Users/tanner/projects/bzr.dev/bzrlib/repofmt/groupcompress_repo.py", line 153, in _write_data
    _write(bytes)
  File "/Users/tanner/projects/bzr.dev/bzrlib/transport/__init__.py", line 277, in write
    osutils.pump_string_file(bytes, self.file_handle)
  File "/Users/tanner/projects/bzr.dev/bzrlib/osutils.py", line 743, in pump_string_file
    write(segment)
  File "/Users/tanner/projects/clients/linvill.com/scripts/lib/python2.7/site-packages/paramiko/file.py", line 313, in write
    data = b(data)
  File "/Users/tanner/projects/clients/linvill.com/scripts/lib/python2.7/site-packages/paramiko/py3compat.py", line 43, in b
    raise TypeError("Expected unicode or bytes, got %r" % s)
TypeError: Expected unicode or bytes, got <read-only buffer for 0x10fb7e120, size 5242880, offset 0 at 0x10fb79eb0>

bzr 2.7.0dev1 on python 2.7.5 (Darwin-13.1.0-x86_64-i386-64bit)
arguments: ['/Users/tanner/bin/bzr', 'push',
    'sftp://rte@192.168.252.127/home/rte/projects/bzr/']
plugins: bash_completion[2.7.0dev1], bzrtools[2.6.0],
    changelog_merge[2.7.0dev1], cvsps[unknown], email[unknown],
    explorer[1.3.0dev], fastimport[0.14.0dev], grep[2.7.0dev1],
    launchpad[2.7.0dev1], netrc_credential_store[2.7.0dev1],
    news_merge[2.7.0dev1], po_merge[2.7.0dev1], pqm[1.4.0dev],
    weave_fmt[2.7.0dev1]
encoding: 'utf-8', fsenc: 'utf-8', lang: 'en_US.US-ASCII'

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Revision history for this message
Bob Tanner (tanner) wrote :
Revision history for this message
Bob Tanner (tanner) wrote :

On Mar 21, 2014, at 1:57 PM, Jeff Forcier <email address hidden> wrote:

N.B. full traceback was posted in the above links (is required to figure out what's going on...)

Replicating the useful parts here:

  File "/Users/tanner/projects/bzr.dev/bzrlib/osutils.py", line 743, in pump_string_file
    write(segment)
  File "/Users/tanner/projects/clients/linvill.com/scripts/lib/python2.7/site-packages/paramiko/file.py", line 313, in write
    data = b(data)
  File "/Users/tanner/projects/clients/linvill.com/scripts/lib/python2.7/site-packages/paramiko/py3compat.py", line 43, in b
    raise TypeError("Expected unicode or bytes, got %r" % s)
TypeError: Expected unicode or bytes, got <read-only buffer for 0x10fb7e120, size 5242880, offset 0 at 0x10fb79eb0>
The relevant part of bzrlib/osutils.py seems to be http://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev/view/head:/bzrlib/osutils.py#L739 where it's creating a buffer() object (which seems pretty old, it's in the deprecated section of the 2.6 docs and is not in the Python 3 docs at all).

The processing via b(data) was a straight up addition in the Python 3 compat work, so hopefully all that needs doing is telling b that buffer objects are OK and to be passed through without modifications (and that only under Python 2 since we can't even really see/use them under Python 3 if the above is correct.)


Reply to this email directly or view it on GitHub.

Revision history for this message
vince (lapcchan) wrote :
Download full text (7.9 KiB)

bzr: ERROR: exceptions.TypeError: Expected unicode or bytes, got <read-only buffer for 0x107a08580, size 5242880, offset 0 at 0x107a14e30>

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commands.py", line 1121, in run_bzr
    ret = run(*run_argv)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/builtins.py", line 3687, in run
    lossy=lossy)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/workingtree_4.py", line 218, in commit
    result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/mutabletree.py", line 211, in commit
    *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commit.py", line 290, in commit
    lossy=lossy)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/cleanup.py", line 132, in run
    self.cleanups, self.func, self, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commit.py", line 455, in _commit
    self._update_branches(old_revno, old_revid, new_revno)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bzrlib/commit.py", line 489, in _update_branches
    self.branch, new_revno, self.rev_id, lossy=self._lossy)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/b...

Read more...

Revision history for this message
vince (lapcchan) wrote :

any quick workaround for now?

Revision history for this message
Atushi Tanaka (tnkatsu) wrote :

> any quick workaround for now?

Downgrade to paramiko 1.12 (or older) from 1.13, as suggesed in https://github.com/paramiko/paramiko/issues/285
This works for me.

affects: debian → bzr (Debian)
Changed in bzr (Debian):
status: Unknown → Confirmed
Changed in bzr (Debian):
status: Confirmed → Fix Released
Jelmer Vernooij (jelmer)
Changed in bzr:
status: New → Invalid
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.