TypeError: utf_8_encode() argument 1 must be str, not bytes

Bug #1873705 reported by Juan Francisco Cantero Hurtado
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Breezy
Fix Released
Medium
Unassigned

Bug Description

Steps to reproduce the bug:

$ mkdir test
$ cd test
$ brz init --bzr
Created a standalone tree (format: 2a)
$ brz pull https://github.com/ziglang/zig.git,branch=master
Fetching from Git to Bazaar repository. For better performance, fetch into a Git repository.
Total 85760 (delta 0), reused 2 (delta 0), pack-reused 85756
brz: ERROR: TypeError: utf_8_encode() argument 1 must be str, not bytes

Traceback (most recent call last):
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/commands.py", line 1017, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/commands.py", line 1203, in run_bzr
    ret = run(*run_argv)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/commands.py", line 757, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/commands.py", line 782, in run
    return class_run(*args, **kwargs)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/builtins.py", line 1263, in run
    result = tree_to.pull(
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/workingtree.py", line 826, in pull
    count = self.branch.pull(source, overwrite, stop_revision,
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/branch.py", line 1043, in pull
    return InterBranch.get(source, self).pull(
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/branch.py", line 1119, in pull
    return self._basic_pull(stop_revision, overwrite, run_hooks,
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/branch.py", line 1058, in _basic_pull
    result.new_git_head, remote_refs = self._update_revisions(
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/branch.py", line 1017, in _update_revisions
    head, refs = self.fetch_objects(stop_revision, fetch_tags=None, tag_selector=tag_selector)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/branch.py", line 1008, in fetch_objects
    pack_hint, head, refs = interrepo.fetch_objects(
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/interrepo.py", line 580, in fetch_objects
    (pack_hint, last_rev) = import_git_objects(
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/fetch.py", line 519, in import_git_objects
    import_git_commit(repo, mapping, head, lookup_object,
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/git/fetch.py", line 446, in import_git_commit
    repo.add_revision(rev.revision_id, rev)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/bzr/vf_repository.py", line 771, in add_revision
    self._add_revision(rev)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/bzr/vf_repository.py", line 774, in _add_revision
    lines = self._serializer.write_revision_to_lines(revision)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/bzr/chk_serializer.py", line 104, in write_revision_to_lines
    return self.write_revision_to_string(rev).splitlines(True)
  File "/home/juanfra/temporal/venv-breezy/lib/python3.8/site-packages/breezy/bzr/chk_serializer.py", line 92, in write_revision_to_string
    revprops[encode_utf8(key)[0]] = encode_utf8(value)[0]
TypeError: utf_8_encode() argument 1 must be str, not bytes

brz 3.2.0dev on python 3.8.2 (Linux-5.6.4.a-1-hardened-x86_64-with-glibc2.2.5)
arguments: ['/home/juanfra/temporal/venv-breezy/bin/brz', 'pull',
    'https://github.com/ziglang/zig.git,branch=master']
plugins: bash_completion[3.2.0dev], changelog_merge[3.2.0dev],
    commitfromnews[3.2.0dev], cvs[3.2.0dev], darcs[3.2.0dev], email[3.2.0dev],
    fastimport[3.2.0dev], flake8[unknown], fossil[3.2.0dev], hg[3.2.0dev],
    launchpad[3.2.0dev], mtn[3.2.0dev], netrc_credential_store[3.2.0dev],
    news_merge[3.2.0dev], po_merge[3.2.0dev], propose[3.2.0dev],
    quilt[unknown], repodebug[3.2.0dev], rewrite[unknown], stats[3.2.0dev],
    svn[3.2.0dev], upload[3.2.0dev], weave_fmt[3.2.0dev],
    zsh_completion[3.2.0dev]
encoding: 'utf-8', fsenc: 'utf-8', lang: 'en_US.UTF-8'

*** 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/brz/+filebug
    including this traceback and a description of the problem.

Related branches

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Reproduced in trunk.

Changed in brz:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> /breezy/bzr/chk_serializer.py(92)write_revision_to_string()
-> revprops[encode_utf8(key)[0]] = encode_utf8(value)[0]
(Pdb) p key
'git-extra'
(Pdb) p value
b'HG:rename-source hg\n'

Jelmer Vernooij (jelmer)
Changed in brz:
status: Triaged → Fix Committed
milestone: none → 3.2.1
Jelmer Vernooij (jelmer)
Changed in brz:
status: Fix Committed → Fix Released
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.