Creates sources.list.d file with illegal character in name

Bug #579669 reported by Adam Guthrie
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Software Properties
Confirmed
Undecided
Unassigned
software-properties (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

For example:

apt-add-repository ppa:sevenmachines/release+1

creates a file /etc/apt/sources.list.d/sevenmachines-release+1-lucid.list.

However, man sources.list says

File names need to end with .list and may only contain letters (a-z and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) characters. Otherwise they will be silently ignored.

So therefore this newly created list file is silently ignored (verify by apt-get update and looking in /var/lib/apt/lists)

Ubuntu 10.04
python-software-properties 0.75.10

Related branches

Revision history for this message
Mark Jones (linuxguy2009-deactivatedaccount-deactivatedaccount-deactivatedaccount) wrote :

(+) may be seen as an invalid character for a sources.list entry.
You have already pointed out valid characters and (+) is not one of those.

Changed in software-properties (Ubuntu):
status: New → Incomplete
Adam Guthrie (therigu)
description: updated
Adam Guthrie (therigu)
summary: - Creates sources.list.d file will illegal character in name
+ Creates sources.list.d file with illegal character in name
Changed in software-properties:
status: New → Incomplete
Revision history for this message
Adam Guthrie (therigu) wrote :

Here's a patch to fix this issue.

Revision history for this message
Adam Guthrie (therigu) wrote :

Marking as confirmed due to the duplicate bug

Changed in software-properties:
status: Incomplete → Confirmed
Changed in software-properties (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
mac9416 (mac9416) wrote :

Hi, Adam,

What does your patch change the + in sources.list.d lists to? For me, "sevenmachines-release+1-lucid.list" became "sevenmachines-release-2B1-lucid.list". Is this what should happen?

Revision history for this message
mac9416 (mac9416) wrote :

I went ahead and submitted a merge request for the patch. It seems to do what its supposed to do. If there's anything wrong, the software-properties folks will catch it.

Here's the request:
https://code.launchpad.net/~mac9416/software-properties/illegalcharfix/+merge/30334

tags: added: patch-forwarded-upstream
Revision history for this message
Adam Guthrie (therigu) wrote :

That's correct. The patch uses percent encoding (http://en.wikipedia.org/wiki/Percent-encoding), except '%' is also a reserved character here, so we escape '-' and then use '-' and the escape character by replacing '%' with '-'.

The patch can be tidied slightly by using urllib2.quote rather than urllib.quote, thus removing the need to import urllib (I didn't realise urllib2 exposed urlib's quote at the time I wrote the patch)

Revision history for this message
Adam Guthrie (therigu) wrote :

* as the escape character

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.76

---------------
software-properties (0.76) maverick; urgency=low

  [ Jonathan Harker ]
  * Improve documentation for apt-add-repository (LP: #586790)

  [ mac9416 ]
  * Fixed bug LP: #446216: added --remove option to add-apt-reporitory.
  * Fixed Bug LP: #579669 which points out that add-apt-repository will
    create a sources.list.d file with illegal characters
    if there are illegal characters in a PPA name

  [ Andrea Corbellini ]
  * Automatically create a deb-src line when adding a new repository
    (LP: 399711)

  [ Michael Vogt ]
  * add test for LP: #579669 and use re.sub() instead of urllib.quote()
  * merged lp:~alexzak/software-properties/fixes, many thanks

  [ Erik B. Andersen ]
  * Fixed depreciation warnings

  [ Brandon Tomlinson ]
  * Altered data/glade/main.glade Put the bottom buttons in a button box
    to make the buttons assume the correct width (LP: #515990)
 -- Michael Vogt <email address hidden> Fri, 13 Aug 2010 17:38:45 +0200

Changed in software-properties (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.