sudo apt-add-repository ppa: results in IndexError: string index out of range
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | One Hundred Papercuts |
High
|
Unassigned | ||
| | software-properties (Ubuntu) |
High
|
Unassigned | ||
Bug Description
$ sudo apt-add-repository ppa
Error: 'ppa' invalid
Just saying ppa without a user- or ppa name fails gracefully and informs the user it doesn't work. However, if we add the ':' separator, it attempts and fails to parse the string:
$ sudo apt-add-repository ppa:
Traceback (most recent call last):
File "/usr/bin/
shortcut = shortcut_
File "/usr/lib/
ret = factory(shortcut)
File "/usr/lib/
return PPAShortcutHand
File "/usr/lib/
self.shortcut = mangle_
File "/usr/lib/
if (user[0] == "~"):
IndexError: string index out of range
This should handle the error more gracefully and display a similar error message to the user as above.
(See also bug 1405951 which is unrelated but similar)
ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: software-
ProcVersionSign
Uname: Linux 3.16.0-28-generic x86_64
ApportVersion: 2.15.1-0ubuntu1
Architecture: amd64
CurrentDesktop: Unity
Date: Sat Dec 27 15:06:46 2014
InstallationDate: Installed on 2014-12-19 (7 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Alpha amd64 (20141211)
PackageArchitec
SourcePackage: software-properties
UpgradeStatus: No upgrade log present (probably fresh install)
Related branches
| Hans Joachim Desserud (hjd) wrote : | #1 |
| description: | updated |
| incognito (prostovrn) wrote : | #2 |
| Hans Joachim Desserud (hjd) wrote : | #3 |
Thanks for testing. :) I'm marking this confirmed since you were able to trigger the same problem.
Unrelated, note that 14.10 has now reached end of life, so you probably want to upgrade to 15.04 when you have the opportunity.
| Changed in software-properties (Ubuntu): | |
| status: | New → Confirmed |
| Changed in software-properties (Ubuntu): | |
| importance: | Undecided → Medium |
| importance: | Medium → High |
| Changed in hundredpapercuts: | |
| status: | New → Confirmed |
| importance: | Undecided → High |
| ChristianEhrhardt (paelzer) wrote : | #4 |
Interesting, there must be a fix out there somewhere - but so far I find it rather unclear where it is included.
On Ubuntu 14.04.3 LTS with software-
=> sudo apt-add-repository ppa:
Cannot add PPA: 'ppa:'.
Please check that the PPA name or format is correct.
But on 15.10 beta2 with software-
Need to dig through the repositories ...
| ChristianEhrhardt (paelzer) wrote : | #5 |
This code went through several major overhauls, so I won't try to fix them all.
As I already stated the last LTS 14.04.3 is already fine.
I provide a patch just for the most recent - currently being upstream/wily which should ensure the issue doesn't come back once more.
| ChristianEhrhardt (paelzer) wrote : | #6 |
The attachment "gracefully handle empty ppa spec" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]
| tags: | added: patch |
| Launchpad Janitor (janitor) wrote : | #8 |
This bug was fixed in the package software-properties - 0.96.13
---------------
software-properties (0.96.13) wily; urgency=medium
* Properly parse a ppa which has a leading slash, something which a lot of
people seem use as an argument to add-apt-repository. (LP: #1426933)
-- Brian Murray <email address hidden> Tue, 13 Oct 2015 11:31:14 -0700
| Changed in software-properties (Ubuntu): | |
| status: | Confirmed → Fix Released |
| Changed in hundredpapercuts: | |
| status: | Confirmed → Fix Released |


On Ubuntu14.10 with latest update I have the same error
# apt-add-repository ppa: apt-add- repository" , line 119, in <module> handler( line) python3/ dist-packages/ softwarepropert ies/SoftwarePro perties. py", line 839, in shortcut_handler python3/ dist-packages/ softwarepropert ies/ppa. py", line 382, in shortcut_handler ler(shortcut) python3/ dist-packages/ softwarepropert ies/ppa. py", line 345, in __init__ ppa_shortcut( shortcut) python3/ dist-packages/ softwarepropert ies/ppa. py", line 133, in mangle_ppa_shortcut
Traceback (most recent call last):
File "/usr/bin/
shortcut = shortcut_
File "/usr/lib/
ret = factory(shortcut)
File "/usr/lib/
return PPAShortcutHand
File "/usr/lib/
self.shortcut = mangle_
File "/usr/lib/
if (user[0] == "~"):
IndexError: string index out of range