bzr-upload-pack: 'builtin_function_or_method' object is unsubscriptable

Bug #681193 reported by Matt Giuca
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar Git Plugin
Fix Released
Medium
Jelmer Vernooij

Bug Description

I am getting a TypeError using the git SSH wrapper, for all git commands (clone, pull, push).

Here's what I have done (on Ubuntu 10.10):

1. Install trunk versions of bzr-git (trunk r1056) and dulwich (trunk r705), with standard bzr (2.2.1) and git (1.7.1).
2. Added symlinks 'git-receive-pack -> /usr/bin/bzr-receive-pack' and 'git-upload-pack -> /usr/bin/bzr-upload-pack' in my PATH, to fool a git client connecting over ssh into using the bzr-git versions of these programs.
3. Create a bzr repo at /home/matt/Desktop/gittest/bzrbranch.
4. git clone ssh://localhost/home/matt/Desktop/gittest/bzrbranch/ gitrepo2
Initialized empty Git repository in /home/matt/Desktop/gittest/gitrepo2/.git/
matt@localhost's password: <password>
Traceback (most recent call last):
  File "/home/matt/bin/git-upload-pack", line 24, in <module>
    server = UploadPackHandler(backend, sys.stdin.read, write_fn)
  File "/usr/local/lib/python2.6/dist-packages/dulwich/server.py", line 210, in __init__
    self.repo = backend.open_repository(args[0])
TypeError: 'builtin_function_or_method' object is unsubscriptable
fatal: The remote end hung up unexpectedly

I'm not sure if there is a version mismatch between bzr-git and dulwich, but there's an obvious bug. Line 24 passes sys.stdin.read (note: no parens; this is a method not a string). dulwich's UploadPackHandler is clearly expecting a list of strings (args). I have tried calling sys.stdin.read(), but it hangs forever, as git doesn't seem to be sending any stdin.

I also tried passing 'args' (as parsed by optparse), which tried to open the Bzr repo but crashed with the error "bzrlib.errors.NotBranchError: Not a branch: "/home/matt/Desktop/gittest/bzrbranch/home/matt/Desktop/gittest/bzrbranch/"" -- it duplicated the string because the BzrBackend transport has already been initialised with "/home/matt/Desktop/gittest/bzrbranch", and now it is appending that same string as a path, so 'args' isn't right.

So I tried passing [""] as 'args' which opens the correct repository, but then it crashes with:
Traceback (most recent call last):
  File "/home/matt/bin/git-upload-pack", line 26, in <module>
    server.handle()
  File "/usr/local/lib/python2.6/dist-packages/dulwich/server.py", line 268, in handle
    get_tagged=self.get_tagged)
  File "/home/matt/.bazaar/plugins/git/server.py", line 74, in fetch_objects
    wants = determine_wants(self.get_refs())
  File "/usr/local/lib/python2.6/dist-packages/dulwich/server.py", line 364, in determine_wants
    self.proto.write_pkt_line("%s\n" % line)
AttributeError: 'function' object has no attribute 'write_pkt_line'

It's trying to get the method write_pkt_line in the function object write_fn. I tried fixing that by turning it into a class and then, some more things happened, and then ... I think I'll stop here. It's starting to feel like bzr-upload-pack is completely out-of-date with the current version of dulwich since they don't seem to be talking on the same interface at all.

Is this tool actually maintained at all, or is it obsolete? If so, is there another way to serve a bzr repo to a git client via ssh? I know about bzr serve --git, but that doesn't give any authentication.

Related branches

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

It's still maintained but unfortunately not covered by our unit test suite at the moment, which is why it regressed. It should work around now; I plan on adding tests later.

Changed in bzr-git:
status: New → Fix Committed
assignee: nobody → Jelmer Vernooij (jelmer)
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in bzr-git:
status: Fix Committed → Fix Released
milestone: none → 0.5.3
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.