Unable to get a copy of private bzr repositories using 'bzr branch' on mantic & noble

Bug #2038613 reported by Guruprasad
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
breezy (Ubuntu)
Confirmed
Undecided
Unassigned
Mantic
Confirmed
Undecided
Unassigned
Noble
Confirmed
Undecided
Unassigned

Bug Description

When trying to get a copy of a branch of a private bzr repository using a command like `bzr branch lp:<private bzr repository name>`, it errors out with an exception that looks like.

<snip>
❯ bzr branch lp:<private bzr repository>
Ignoring insteadOf lp: in git config, because the Launchpad plugin is loaded.
brz: ERROR: lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 2336
content-type: text/plain;charset=utf-8
date: Fri, 06 Oct 2023 08:20:32 GMT
server: gunicorn
status: 500
vary: Accept-Encoding
x-lazr-oopsid: OOPS-ed564e31c31cb77087ac3e21adc82c40
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 06077fe8-3016-427d-8ffb-1ce704a883b9
x-vcs-revision: bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596
---
Response body:
---
b'Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n\nTraceback (most recent call last):\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 146, in publish\n result = publication.callObject(request, obj)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/publisher.py", line 221, in callObject\n value = super().callObject(request, object)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/services/webapp/publication.py", line 446, in callObject\n return mapply(ob, request.getPositionalArguments(), request)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 119, in mapply\n return debug_call(obj, args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 126, in debug_call\n return obj(*args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 954, in __call__\n result = self.do_GET()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 1621, in do_GET\n result = self.handleCustomGET(operation_name)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 749, in handleCustomGET\n return operation()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_operation.py", line 94, in __call__\n response = self.call(**values)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/declarations.py", line 1655, in call\n result = self._getMethod()(**params)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/code/model/branch.py", line 854, in composePublicURL\n assert not (self.private and scheme in public_schemes), (\nAssertionError: Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n'
---

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1032, in exception_to_return_code
    return the_callable(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1224, in run_bzr
    ret = run(*run_argv)
          ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 774, in run_argv_aliases
    return self.run(**all_cmd_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/commands.py", line 799, in run
    return class_run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/builtins.py", line 1456, in run
    accelerator_tree, br_from = controldir.ControlDir.open_tree_or_branch(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 885, in open_tree_or_branch
    controldir = klass.open(location)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 789, in open
    t = _mod_transport.get_transport(base, possible_transports)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/transport/__init__.py", line 1594, in get_transport
    location_to_url(base, purpose=purpose),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/location.py", line 141, in location_to_url
    location = directories.dereference(location, purpose)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/directory_service.py", line 87, in dereference
    return directory.look_up(name, url, purpose=purpose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 137, in look_up
    return _resolve(url)
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 106, in _resolve
    result = _resolve_via_api(path, url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/breezy/plugins/launchpad/lp_directory.py", line 91, in _resolve_via_api
    join(lp_branch.composePublicURL(scheme='http'), *subpaths)]}
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 642, in __call__
    response, content = self.root._browser._request(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 484, in _request
    raise error
lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 2336
content-type: text/plain;charset=utf-8
date: Fri, 06 Oct 2023 08:20:32 GMT
server: gunicorn
status: 500
vary: Accept-Encoding
x-lazr-oopsid: OOPS-ed564e31c31cb77087ac3e21adc82c40
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 06077fe8-3016-427d-8ffb-1ce704a883b9
x-vcs-revision: bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596
---
Response body:
---
b'Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n\nTraceback (most recent call last):\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 146, in publish\n result = publication.callObject(request, obj)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/publisher.py", line 221, in callObject\n value = super().callObject(request, object)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/services/webapp/publication.py", line 446, in callObject\n return mapply(ob, request.getPositionalArguments(), request)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 119, in mapply\n return debug_call(obj, args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/zope/publisher/publish.py", line 126, in debug_call\n return obj(*args)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 954, in __call__\n result = self.do_GET()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 1621, in do_GET\n result = self.handleCustomGET(operation_name)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_resource.py", line 749, in handleCustomGET\n return operation()\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/_operation.py", line 94, in __call__\n response = self.call(**values)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/env/lib/python3.8/site-packages/lazr/restful/declarations.py", line 1655, in call\n result = self._getMethod()(**params)\n File "/srv/launchpad/payloads/bd6cfd0cfc024dbe1dcd7d5d91165fb4f6a6c596/lib/lp/code/model/branch.py", line 854, in composePublicURL\n assert not (self.private and scheme in public_schemes), (\nAssertionError: Private branch ~<user>/<private bzr repository>/trunk has no public URL.\n'
---

You can report this problem to Breezy's developers by running
    apport-bug /var/crash/brz.1000.2023-10-06T08:20.crash
if a bug-reporting window does not automatically appear.
</snip>

This issue _could_ be related to the issue(s) discussed in https://code.launchpad.net/~jelmer/launchpad/+git/launchpad/+merge/435608

Guruprasad (lgp171188)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in breezy (Ubuntu):
status: New → Confirmed
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

Workaround - from an internal discussion (https://chat.canonical.com/canonical/pl/wmbztgw7ifrufpyx77zgqzeacc)

> if you are on mantic, bzr is broken when using lp:// short form URLs for private repositories.

> lp+bzr: works in that case

> eg bzr branch lp+bzr:canonical-sshebang

Revision history for this message
Haw Loeung (hloeung) wrote :

The workaround doesn't work for me?

| [hloeung@dharkan tmp]$ bzr branch lp+bzr:canonical-sshebang
| ...
|
| lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
| Response headers:
| ---
| connection: close
| content-length: 14
| content-type: text/plain;charset=utf-8
| date: Thu, 29 Feb 2024 01:47:10 GMT
| server: gunicorn
| status: 500
| x-lazr-oopsid: OOPS-5b2b04c2eb781d9c86031e2a31b56739
| x-powered-by: Zope (www.zope.org), Python (www.python.org)
| x-request-id: d23d8481-48de-495f-a8ff-520577cedfe0
| x-vcs-revision: 9643586c585856148a18782148972ae9c1179d06
| ---
| Response body:
| ---
| b'AssertionError'
| ---
|
|
| brz 3.3.5 on python 3.12.2 (Linux-6.6.0-14-generic-x86_64-with-glibc2.39)
| arguments: ['bzr', 'branch', 'lp+bzr:canonical-sshebang']
| plugins: bash_completion[3.3.5], changelog_merge[3.3.5],
| commitfromnews[3.3.5], cvs[3.3.5], darcs[3.3.5], email[3.3.5],
| etckeeper[unknown], fastimport[3.3.5], flake8[unknown], fossil[3.3.5],
| github[3.3.5], gitlab[3.3.5], hg[3.3.5], launchpad[3.3.5], mtn[3.3.5],
| netrc_credential_store[3.3.5], news_merge[3.3.5], po_merge[3.3.5],
| propose[3.3.5], pypi[3.3.5], quilt[unknown], repodebug[3.3.5],
| rewrite[unknown], stats[3.3.5], svn[3.3.5], upload[3.3.5],
| weave_fmt[3.3.5], webdav[3.3.5], zsh_completion[3.3.5]
| encoding: 'utf-8', fsenc: 'utf-8', lang: 'en_US.utf8'
|
| *** 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.

Haw Loeung (hloeung)
summary: Unable to get a copy of private bzr repositories using 'bzr branch' on
- mantic
+ mantic & noble
Changed in breezy (Ubuntu Mantic):
status: New → Confirmed
Revision history for this message
Guruprasad (lgp171188) wrote :

I can confirm that I see the same issue as Haw with the workaround. What works is

bzr branch bzr+ssh://<email address hidden>/~canonical-sshebang/canonical-sshebang/trunk canonical-sshebang

Revision history for this message
Bin Li (binli) wrote :

I met this issue too.

$ bzr branch lp:~binli/oem-archive-projects/support-noble
brz: ERROR: lazr.restfulclient.errors.ServerError: HTTP Error 500: Internal Server Error
Response headers:
---
connection: close
content-length: 14
content-type: text/plain;charset=utf-8
date: Mon, 11 Mar 2024 08:16:19 GMT
server: gunicorn
status: 500
x-lazr-oopsid: OOPS-e803fd818b75a535a7d1928da8607589
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-request-id: 9ddf4fc3-c188-49c1-953b-effdb3a5d9ef
x-vcs-revision: 2e4955e3d556e61e2eb54acf7a827d17e9e46822
---
Response body:
---
b'AssertionError'

Revision history for this message
Bin Li (binli) wrote :

The workaround works fine in my side.

bzr branch bzr+ssh://bazaar.launchpad.net/~binli/oem-archive-projects/support-noble

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.