OpenSSH support in bzr

I updated my bzr openssh plugin to be a proper patch against bzr.dev, and got it merged. So if you have bzr-openssh-sftp.py in your ~/.bazaar/plugins directory, you should remove it when upgrading.

Unfortunately there was a small problem resolving a conflict when merging it, which causes the path to get mangled a little inside _sftp_connect(). Once this is resolved, the mainline bzr should fully follow settings in ~/.ssh/config, because it will be running the same ssh binary as you normally use.

One thing I learnt when adding the support code was a quirk in the SFTP URI spec‘s interpretation of paths, which differs to gnome-vfs’s interpretation. The uri sftp://remotehost/directory is interpreted as /directory on remotehost by gnome-vfs, while the spec says that it should be interpreted as ~/directory.

To refer to /directory on remotehost, the spec says you should use sftp://remotehost/%2Fdirectory. I filed this as bug 322394.

PSP

On my way to UBZ, I bought a PlayStation Portable at the airport duty free store. It was being sold as the value pack and Ridge Racer game together, which came out at roughly the retail price of the two individual items minus 10% GST.

As well as playing games it can be used as a portable audio or video player and photo viewer, using memory stick duos as storage. As the device doesn’t come with any computer software, the manual provides all the details about what formats to use for audio/video and where to put the files on the memory stick. This is quite useful for people using minority operating systems like Linux :).

I wrote a little FDI file for the PSP to expose the portable_audio_player capability via HAL, but there doesn’t seem to be any standard properties to expose the other capabilities.

One of the more annoying aspects of the PSP is text entry. It seems as if they looked at the text entry used by consoles and mobile phones and combined the worst aspects of both:

  • There is a grid of buttons, each of which corresponds to 3 or 4 letters which can be selected by pressing the button multiple times.
  • You use the direction pad to select the button to press.
  • No predictive text input or similar.

For games this isn’t that big a problem, since they don’t generally require much text entry. It is more of a problem for the web browser where it is a lot more important. Something like Dasher might have been a much more useful text entry system, but I guess they decided to go with a more conventional approach.

Using OpenSSH with bzr

One of the transports available in bzr is sftp. This is implemented using the Paramiko SSH and SFTP library. Unfortunately there are a few issues I experienced with the code:

  • Since it is an independent implementation of SSH, none of my OpenSSH settings in ~/.ssh/config were recognised. The particular options I rely on include:
    1. User: when the remote username doesn’t match my local one. One less thing to remember when connecting to a remote machine.
    2. IdentityFile: use different keys to access different machines.
    3. ProxyCommand: access work machines that are behind the firewall.
  • Paramiko does not currently support SSH compression. This is a real pain for larger trees.

The easiest way to fix all these problems would be to use OpenSSH directly, so wrote a small plugin to do so. I decided to follow the model used to do this in gnome-vfs and Bazaar 1.x: communicate with an ssh subprocess via pipes and implement the SFTP protocol internally.

Since SFTP is layered fairly cleanly on top of SSH, and the paramiko code was also quite modular, it was possible to use the paramiko SFTP implementation with openssh. The result is a small plugin that monkey-patches the existing SFTP transport:

http://people.ubuntu.com/~jamesh/bzr-openssh-plugin/

Just copy openssh-sftp.py into the ~/.bazaar/plugins directory, and use bzr as normal. The compression seems to make a noticable difference to performance, but it should be possible to improve things further with a pipelined SFTP client implementation.

Of course, the biggest performance optimisation will probably come from the smart server, when that is implemented.

Moving from Bugzilla to Launchpad

One of the things that was discussed at UBZ was moving Ubuntu’s bug tracking over to Launchpad. The current situation sees bugs in main being filed in bugzilla while bugs in universe go in Launchpad. Putting all the bugs in Launchpad is an improvement, since users only need to go to one system to file bugs.

I wrote the majority of the conversion script before the conference, but made a few important improvements at the conference after discussions with some of the developers. Since the bug tracking system is probably of interest to people who weren’t at the conf, I’ll outline some of the details of the conversion below:

  • We are only migrating the open bugs — the existing bugzilla will remain available to read those bugs though.
  • Any bugzilla user account associated with an open bug (asignee, reporter, cc, qa contact or commenter) will be imported into Launchpad. If you already have a Launchpad account but use a different email for your bugzilla account, you have the following options:
    1. Add your bugzilla email to your Launchpad account.
    2. In bugzilla, change your email to one of the addresses registered to your Launchpad account.
    3. After the migration, merge the extra account into your existing account.

    Note that passwords are not migrated, because Launchpad uses a different password hashing algorithm to Bugzilla

  • All comments and attachments are imported.
  • Bugs are filed against the appropriate package under the “Ubuntu” distribution in Launchpad.
  • A bug watch is created, pointing at the original Bugzilla bug, so you can see any information not migrated.
  • If the bug was marked UPSTREAM and a bug tracker URL is included in the bugzilla URL field, then we attempt to create a bug task against the upstream product and link it to the remote bug. This depends on the upstream product existing and being linked to the package, so doesn’t always succeed. This feature was implemented to keep Sebastien happy, 68% of the UPSTREAM bugs are assigned to him.
  • Some of the bugzilla bugs are actually imported from debbugs. For these bugs, a bug task will be filed against Debian linked to the appropriate debbugs bug.

There are a few other things that need completing on the production Launchpad server before we can do the migration, but we should have a test import done on the staging server tomorrow some time.

Avahi on Breezy followup

So after I posted some instructions for setting up Avahi on Breezy, a fair number of people at UBZ did so. For most people this worked fine, but it seems that a few people’s systems started spewing a lot of network traffic.

It turns out that the problem was actually caused by the zeroconf package (which I did not suggest installing) rather than Avahi. The zeroconf package is not needed for service discovery or .local name lookup, so if you are at UBZ you should remove the package or suffer the wrath of Elmo.

Avahi on Breezy

During conferences, it is often useful to be able to connect to connect to other people’s machines (e.g. for collaborative editing sessions with Gobby). This is a place where mDNS hostname resolution can come in handy, so you don’t need to remember IP addresses.

This is quite easy to set up on Breezy:

  • Install the avahi-daemon, avahi-utils and libnss-mdns packages from universe.
  • Restart dbus in order for the new system bus security policies to take effect with “sudo invoke-rc.d dbus restart“.
  • Start avahi-daemon with “sudo invoke-rc.d avahi-daemon start“.
  • Edit /etc/nsswitch.conf, and add “mdns” to the end of the “hosts:” line.

Now your hostname should be advertised to the local network, and you can connect to other hosts by name (of the form hostname.local). You can also get a list of the currently advertised hosts and services with the avahi-discover program.

While the hostname advertising is useful in itself, it should get a lot more useful in Dapper, as more programs are built with mDNS support.