add-apt-repository returns unexpected length error

Solution 1:

It appears this is a known issue/bug, you could try this workaround:

To install PPA's, add them to /etc/apt/sources.list in the form:

Before:

ppa:<user>/<repo>

Add to sources.list:

deb http://ppa.launchpad.net/<user>/<repo>/ubuntu oneiric main

Then sudo apt-get update and download whatever packages you want.

Solution 2:

In my case,and that worked, that's what I did in Ubuntu 12.04:

sudo apt-get clean
sudo apt-get update

And then I tried to add my ppa as usual :

sudo add-apt-repository ppa:.../...

Hopes it works for everyone !