add-apt-repository adds same repository multiple times

Bug #1509702 reported by moma
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
New
Low
Unassigned

Bug Description

Hello,
I am running Ubuntu 15.10 and noticed that add-apt-repository adds the same source-repository multiple times.
I have accidentally run the add-apt command several times.

$ sudo add-apt-repository ppa:audio-recorder/ppa

A screenshot.
[url=http://bildr.no/view/ZktOZDRI][img]http://bildr.no/thumb/ZktOZDRI.jpeg[/img][/url]

I have one `audio-recorder-ubuntu-ppa-wily.list` file in /the etc/apt/sources.list.d/ folder:

$ cat /etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-wily.list

deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
-----

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10 Codename: wily

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: software-properties-gtk 0.96.13
ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3
Uname: Linux 4.2.0-16-generic x86_64
ApportVersion: 2.19.1-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Sat Oct 24 19:43:44 2015
InstallationDate: Installed on 2015-10-19 (4 days ago)
InstallationMedia: Ubuntu 15.10 "Wily Werewolf" - Alpha amd64 (20151017)
PackageArchitecture: all
SourcePackage: software-properties
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
moma (osmoma) wrote :
Revision history for this message
moma (osmoma) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, so the issue is not that it adds it several time but that it adds it when you use the command even if the source is already active? Is that correct? (your title suggests it does it by itself if you use it correct, which you description seems to suggest is not the case)

Changed in software-properties (Ubuntu):
importance: Undecided → Low
Revision history for this message
moma (osmoma) wrote :

The add-apt-repository command adds always a new "deb-src" line no matter if the source is enabled or disabled.

Example:
$ cat /etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-wily.list

deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
------
$ sudo add-apt-repository ppa:audio-recorder/ppa

$ cat /etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-wily.list

deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
------

$ sudo add-apt-repository ppa:audio-recorder/ppa

$ cat /etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-wily.list

deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
# deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
------
It seems like the "deb" lines are treated correctly while "deb-src" lines are duplicated.

The [Remove]-button in the GUI (software-properties-gtk) works fine. It removes all extra lines.

Revision history for this message
moma (osmoma) wrote :

BTW:
The --remove option empties both the repository file and its backup copy.
But the empty files remains in /etc/apt/sources.list.d/ folder. Is this correct?

# Our repository files.
$ ls -l /etc/apt/sources.list.d/
-rw-r--r-- 1 root root 207 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list
-rw-r--r-- 1 root root 136 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list.save
-------

# Remove a repository. The empty files remain in the system.
$ sudo add-apt-repository --remove ppa:audio-recorder/ppa

$ ls -l /etc/apt/sources.list.d/
-rw-r--r-- 1 root root 0 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list
-rw-r--r-- 1 root root 0 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list.save

Revision history for this message
moma (osmoma) wrote : Re: [Bug 1509702] Re: add-apt-repository adds same repository multiple times
Download full text (3.3 KiB)

Re-hi,
I made a small fix to the aptsources module (locally on my laptop).
Aptsources comes from the python-apt package.

$ apt-get source python-apt
$ cd python-apt-1.0.1build1/
$ cd aptsources/

# Edit sourceslist.py file.

# Add a make_unique(self, l) function to the SourcesList class.
# Then call make_unique from the refresh() function.
# This will remove duplicate lines while maintaining sort order of the list.

Please see: http://paste.ubuntu.com/12973347/

On Mon, Oct 26, 2015 at 3:43 PM, moma <email address hidden> wrote:

> BTW:
> The --remove option empties both the repository file and its backup copy.
> But the empty files remains in /etc/apt/sources.list.d/ folder. Is this
> correct?
>
> # Our repository files.
> $ ls -l /etc/apt/sources.list.d/
> -rw-r--r-- 1 root root 207 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list
> -rw-r--r-- 1 root root 136 Out 26 15:41
> audio-recorder-ubuntu-ppa-wily.list.save
> -------
>
> # Remove a repository. The empty files remain in the system.
> $ sudo add-apt-repository --remove ppa:audio-recorder/ppa
>
> $ ls -l /etc/apt/sources.list.d/
> -rw-r--r-- 1 root root 0 Out 26 15:41 audio-recorder-ubuntu-ppa-wily.list
> -rw-r--r-- 1 root root 0 Out 26 15:41
> audio-recorder-ubuntu-ppa-wily.list.save
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1509702
>
> Title:
> add-apt-repository adds same repository multiple times
>
> Status in software-properties package in Ubuntu:
> New
>
> Bug description:
> Hello,
> I am running Ubuntu 15.10 and noticed that add-apt-repository adds the
> same source-repository multiple times.
> I have accidentally run the add-apt command several times.
>
> $ sudo add-apt-repository ppa:audio-recorder/ppa
>
> A screenshot.
> [url=
> http://bildr.no/view/ZktOZDRI][img]http://bildr.no/thumb/ZktOZDRI.jpeg[/img][/url
> ]
>
> I have one `audio-recorder-ubuntu-ppa-wily.list` file in /the
> etc/apt/sources.list.d/ folder:
>
> $ cat /etc/apt/sources.list.d/audio-recorder-ubuntu-ppa-wily.list
>
> deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
> # deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
> # deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
> # deb-src http://ppa.launchpad.net/audio-recorder/ppa/ubuntu wily main
> -----
>
> $ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 15.10
> Release: 15.10 Codename: wily
>
> ProblemType: Bug
> DistroRelease: Ubuntu 15.10
> Package: software-properties-gtk 0.96.13
> ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3
> Uname: Linux 4.2.0-16-generic x86_64
> ApportVersion: 2.19.1-0ubuntu3
> Architecture: amd64
> CurrentDesktop: Unity
> Date: Sat Oct 24 19:43:44 2015
> InstallationDate: Installed on 2015-10-19 (4 days ago)
> InstallationMedia: Ubuntu 15.10 "Wily Werewolf" - Alpha amd64 (20151017)
> PackageArchitecture: all
> SourcePackage: software-properties
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug...

Read more...

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.