TypeError: '<' not supported between instances of 'bytes' and 'tuple' on upgrade

Bug #2016003 reported by Valentin Lorentz
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Breezy
New
Undecided
Unassigned

Bug Description

With breezy 3.3.2 installed from pip:

$ python3 -m breezy branch https://code.launchpad.net/\~igraph/igraph/0.6-Rquery
$ cd 0.6-Rquery
$ python3 -m breezy upgrade
conversion error: '<' not supported between instances of 'bytes' and 'tuple'
brz: ERROR: TypeError: '<' not supported between instances of 'bytes' and 'tuple'

Traceback (most recent call last):
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 1036, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 1228, in run_bzr
    ret = run(*run_argv)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 779, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 804, in run
    return class_run(*args, **kwargs)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/builtins.py", line 3915, in run
    raise exceptions[0]
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/upgrade.py", line 285, in _convert_items
    cv = Convert(control_dir=control_dir, format=format)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/upgrade.py", line 65, in __init__
    self.convert()
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/upgrade.py", line 107, in convert
    self.controldir = converter.convert(self.controldir, None)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/bzrdir.py", line 1788, in convert
    converter.convert(repo, pb)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/repository.py", line 1679, in convert
    self.source_repo.copy_content_into(converted)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/repository.py", line 649, in copy_content_into
    return InterRepository.get(self, destination).copy_content(revision_id)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/repository.py", line 1573, in copy_content
    self.target.fetch(self.source, revision_id=revision_id)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/vf_repository.py", line 982, in fetch
    return inter.fetch(revision_id=revision_id,
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/vf_repository.py", line 2763, in fetch
    self._fetch_all_revisions(revision_ids, pb)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/vf_repository.py", line 2706, in _fetch_all_revisions
    basis_id = self._fetch_batch(batch, basis_id, cache)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/vf_repository.py", line 2573, in _fetch_batch
    self._fetch_parent_invs_for_stacking(parent_map, cache)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/vf_repository.py", line 2539, in _fetch_parent_invs_for_stacking
    parent_invs_keys_for_stacking = self.source.inventories.get_parent_map(
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/knit.py", line 1321, in get_parent_map
    return self._get_parent_map_with_sources(keys)[0]
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/knit.py", line 1340, in _get_parent_map_with_sources
    new_result = source.get_parent_map(missing)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/knit.py", line 3194, in get_parent_map
    for node in nodes:
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/knit.py", line 3137, in _get_entries
    for node in self._graph_index.iter_entries(keys):
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/index.py", line 1399, in iter_entries
    for node in index.iter_entries(keys):
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/index.py", line 752, in iter_entries
    return (result[1] for result in bisect_multi.bisect_multi_bytes(
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bisect_multi.py", line 50, in bisect_multi_bytes
    search_results = content_lookup(search_keys)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/index.py", line 850, in _lookup_keys_via_location
    index = self._parsed_key_index(key)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/index.py", line 702, in _parsed_key_index
    return self._find_index(self._parsed_key_map, search_key)
  File "/home/dev/.local/lib/python3.9/site-packages/breezy/bzr/index.py", line 670, in _find_index
    result = bisect_right(range_map, key) - 1
TypeError: '<' not supported between instances of 'bytes' and 'tuple'

brz 3.3.2 on python 3.9.2 (Linux-5.10.0-21-amd64-x86_64-with-glibc2.31)
arguments: ['/home/dev/.local/lib/python3.9/site-packages/breezy/__main__.py',
    'upgrade']
plugins: bash_completion[3.3.2], changelog_merge[3.3.2],
    commitfromnews[3.3.2], cvs[3.3.2], darcs[3.3.2], email[3.3.2],
    fastimport[3.3.2], flake8[unknown], fossil[3.3.2], github[3.3.2],
    gitlab[3.3.2], hg[3.3.2], launchpad[3.3.2], mtn[3.3.2],
    netrc_credential_store[3.3.2], news_merge[3.3.2], po_merge[3.3.2],
    propose[3.3.2], pypi[3.3.2], quilt[unknown], repodebug[3.3.2],
    rewrite[unknown], stats[3.3.2], svn[3.3.2], upload[3.3.2],
    weave_fmt[3.3.2], webdav[3.3.2], zsh_completion[3.3.2]
encoding: 'utf-8', fsenc: 'utf-8', lang: 'C.UTF-8'

*** Breezy has encountered an internal error. This probably indicates a
    bug in Breezy. 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.
Upgrading branch /tmp/0.6-Rquery/ ...
starting upgrade of /tmp/0.6-Rquery/
making backup of /tmp/0.6-Rquery/.bzr
  to /tmp/0.6-Rquery/backup.bzr.~1~
starting repository conversion

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Any ideas, anyone?

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Just tried uninstalling 3.3.2 (pacman on Manjaro) and installing 3.3.3 (pip). Same error.

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Python 3.11.3

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

In my case the command is different: `bzr commit --message "Latest." .bzrignore`

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Here's the full output:

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

This looks like a type issue that happens because Python 3 is stricter than Python 2 was:

> /home/jelmer/src/breezy/brz-3.3.2/breezy/bzr/index.py(670)_find_index()
-> result = bisect_right(range_map, key) - 1
(Pdb) p range_map
[((), (b'Arch-1:csardi@guzu%igraph--main--0.4--patch-164',)), ((b'Arch-1:csardi@guzu%igraph--main--0.4--patch-63',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-109',)), ((b'Arch-1:<email address hidden>%igraph--main--0.2--patch-130',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-165',)), ((b'Arch-1:<email address hidden>%igraph--main--0.2--patch-212',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-37',)), ((b'Arch-1:<email address hidden>%igraph--main--0.4--patch-172',), (b'Arch-1:<email address hidden>%igraph--main--0.4--patch-207',)), ((b'Arch-1:<email address hidden>%igraph--main--0.6--patch-125',), (b'Arch-1:<email address hidden>%igraph--main--0.6--patch-160',)), ((b'Arch-1:<email address hidden>%igraph--main--0.6--patch-60',), (b'Arch-1:<email address hidden>%igraph--main--0.6--patch-96',)), ((b'Arch-1:csardi@shanna%igraph--main--0.2--patch-3',), (b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-130',)), ((b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-147',), (b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-227',)), ((b'Arch-1:csardi@szaffi2%igraph--main--0.5--patch-257',), (b'Arch-1:csardi@szaffi2%igraph--main--0.5--patch-81',)), ((b'csardi@csardi-desktop-20100617141041-nndb4vxuix76wmbk',), (b'csardi@strider-20100618143323-ry24wclpgs1wcffy',))]
(Pdb) p key
((b'Arch-1:csardi@shanna%igraph--main--0.2--patch-3',), b'')

It looks like the () is inserted for the header of the index, but it's not clear to me why this works in other situations.

Revision history for this message
Phil Hudson (phil-hudson-8) wrote : Re: [Bug 2016003] Re: TypeError: '<' not supported between instances of 'bytes' and 'tuple' on upgrade
Download full text (8.3 KiB)

So glad you're looking into it, Jelmer, thanks. Wish I could offer
some useful thoughts. I'm cheering you on to victory.

On Sun, 11 Jun 2023 at 21:45, Jelmer Vernooij
<email address hidden> wrote:
>
> This looks like a type issue that happens because Python 3 is stricter
> than Python 2 was:
>
> > /home/jelmer/src/breezy/brz-3.3.2/breezy/bzr/index.py(670)_find_index()
> -> result = bisect_right(range_map, key) - 1
> (Pdb) p range_map
> [((), (b'Arch-1:csardi@guzu%igraph--main--0.4--patch-164',)), ((b'Arch-1:csardi@guzu%igraph--main--0.4--patch-63',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-109',)), ((b'Arch-1:<email address hidden>%igraph--main--0.2--patch-130',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-165',)), ((b'Arch-1:<email address hidden>%igraph--main--0.2--patch-212',), (b'Arch-1:<email address hidden>%igraph--main--0.2--patch-37',)), ((b'Arch-1:<email address hidden>%igraph--main--0.4--patch-172',), (b'Arch-1:<email address hidden>%igraph--main--0.4--patch-207',)), ((b'Arch-1:<email address hidden>%igraph--main--0.6--patch-125',), (b'Arch-1:<email address hidden>%igraph--main--0.6--patch-160',)), ((b'Arch-1:<email address hidden>%igraph--main--0.6--patch-60',), (b'Arch-1:<email address hidden>%igraph--main--0.6--patch-96',)), ((b'Arch-1:csardi@shanna%igraph--main--0.2--patch-3',), (b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-130',)), ((b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-147',), (b'Arch-1:csardi@szaffi%igraph--main--0.2--patch-227',)), ((b'Arch-1:csardi@szaffi2%igraph--main--0.5--patch-257',), (b'Arch-1:csardi@szaffi2%igraph--main--0.5--patch-81',)), ((b'csardi@csardi-desktop-20100617141041-nndb4vxuix76wmbk',), (b'csardi@strider-20100618143323-ry24wclpgs1wcffy',))]
> (Pdb) p key
> ((b'Arch-1:csardi@shanna%igraph--main--0.2--patch-3',), b'')
>
> It looks like the () is inserted for the header of the index, but it's
> not clear to me why this works in other situations.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2016003
>
> Title:
> TypeError: '<' not supported between instances of 'bytes' and 'tuple'
> on upgrade
>
> Status in Breezy:
> New
>
> Bug description:
> With breezy 3.3.2 installed from pip:
>
>
> $ python3 -m breezy branch https://code.launchpad.net/\~igraph/igraph/0.6-Rquery
> $ cd 0.6-Rquery
> $ python3 -m breezy upgrade
> conversion error: '<' not supported between instances of 'bytes' and 'tuple'
> brz: ERROR: TypeError: '<' not supported between instances of 'bytes' and 'tuple'
>
> Traceback (most recent call last):
> File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 1036, in exception_to_return_code
> return the_callable(*args, **kwargs)
> File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 1228, in run_bzr
> ret = run(*run_argv)
> File "/home/dev/.local/lib/python3.9/site-packages/breezy/commands.py", line 779, in run_argv_aliases
> return self.run(**all_cmd_args)
> F...

Read more...

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Just to note that breezy is not quite completely unusable for me with this bug: some files I can commit, some I can't. I haven't noticed any particular pattern yet.

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

This is still affecting me. The only workaround is to rely on the fact that I have one old machine on a distro that no longer provides updates which runs a very outdated version (). I have to manually copy my modified files to that host, then commit those changes *there*, and then remote-merge and commit them back here. That gives me a more-or-less stable local repo until the next time I do something completely normal (adding an entry to ~/.bzrignore, for instance, which I track) that sets off this frustrating and potentially crippling bug.

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

As a workaround while we wait, is there a way to tell current Breezy to use Python 2.x?

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

Unfortunately the current codebase won't work with Python 2 anymore, the syntax will be incompatible and we're using a lot of features that are only available in python 3.6 and later.

Your best bet for using breezy with python 2 is probably to use Breezy 3.0, which was still Python 2 compatible.

Revision history for this message
Phil Hudson (phil-hudson-8) wrote :

Could you please point me to where/how precisely to locate Breezy 3.0. I have tried and failed.

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

On Mon, Oct 09, 2023 at 03:58:08PM -0000, Phil Hudson wrote:
> Could you please point me to where/how precisely to locate Breezy 3.0. I
> have tried and failed.

You can find the release here: https://launchpad.net/brz/3.0/3.0.0

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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