Public bug reported: apt-add-repository --remove -S deb http://us.archive.ubuntu.com/ubuntu hirsute xyzzx wrongly disables *every* component, not just xyzzx.
This happens because the entire existing line is commented out in /etc/apt/sources.list rather than just editing out the deleted component. When *adding* a component, and existing line is edited IN to an existing line for that repository; the reverse should probably be done when removing a component if there are other components which should remain enabled. In other words, commenting out the whole line should be done only if the LINE specified in the remove command specifies all the currently-enabled components. STEPS TO REPRODUCE: 1. sudo cp /etc/apt /tmp/apt.BAK 2. Remove all references to "multiverse" in /etc/apt/sources.list 3. sudo apt-add-repository -y --no-update -S deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse 4. diff -r /etc/apt.BAK /etc/apt (Should show 'multiverse' added to an existing line in /etc/apt/sources.list) diff -r /tmp/apt.BAK/sources.list /etc/apt/sources.list 4,5c4,5 < deb http://us.archive.ubuntu.com/ubuntu hirsute main restricted < # deb-src http://us.archive.ubuntu.com/ubuntu hirsute main restricted --- > deb http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse > # deb-src http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse 5. sudo apt-add-repository --remove -y --no-update -S deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse 6. diff -r /etc/apt.BAK /etc/apt (Should show 'multiverse' removed from existing line in /etc/apt/sources.list, but...) diff -r /tmp/apt.BAK/sources.list /etc/apt/sources.list 4,5c4,5 < deb http://us.archive.ubuntu.com/ubuntu hirsute main restricted < # deb-src http://us.archive.ubuntu.com/ubuntu hirsute main restricted --- > # deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse restricted main > # deb-src http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse (7. sudo rm -rf /etc/apt; sudo cp -a /tmp/apt.BAK /etc/apt) # restore RESULTS: *every* component (including 'main') is disabled EXPECTED RESULTS: Only the specified component is disabled. In other words, --remove should un-do whatever the effect of an 'add' with the same LINE argument ProblemType: Bug DistroRelease: Ubuntu 21.04 Package: software-properties-common 0.99.10 ProcVersionSignature: Ubuntu 5.11.0-25.27-generic 5.11.22 Uname: Linux 5.11.0-25-generic x86_64 ApportVersion: 2.20.11-0ubuntu65.1 Architecture: amd64 CasperMD5CheckResult: pass CurrentDesktop: GNOME Date: Wed Jul 21 18:02:20 2021 InstallationDate: Installed on 2021-07-20 (0 days ago) InstallationMedia: Ubuntu-Server 21.04 "Hirsute Hippo" - Release amd64 (20210421) PackageArchitecture: all SourcePackage: software-properties UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: software-properties (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug hirsute uec-images -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to software-properties in Ubuntu. https://bugs.launchpad.net/bugs/1937119 Title: apt-add-repository --remove -S ... also deletes other components Status in software-properties package in Ubuntu: New Bug description: apt-add-repository --remove -S deb http://us.archive.ubuntu.com/ubuntu hirsute xyzzx wrongly disables *every* component, not just xyzzx. This happens because the entire existing line is commented out in /etc/apt/sources.list rather than just editing out the deleted component. When *adding* a component, and existing line is edited IN to an existing line for that repository; the reverse should probably be done when removing a component if there are other components which should remain enabled. In other words, commenting out the whole line should be done only if the LINE specified in the remove command specifies all the currently- enabled components. STEPS TO REPRODUCE: 1. sudo cp /etc/apt /tmp/apt.BAK 2. Remove all references to "multiverse" in /etc/apt/sources.list 3. sudo apt-add-repository -y --no-update -S deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse 4. diff -r /etc/apt.BAK /etc/apt (Should show 'multiverse' added to an existing line in /etc/apt/sources.list) diff -r /tmp/apt.BAK/sources.list /etc/apt/sources.list 4,5c4,5 < deb http://us.archive.ubuntu.com/ubuntu hirsute main restricted < # deb-src http://us.archive.ubuntu.com/ubuntu hirsute main restricted --- > deb http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse > # deb-src http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse 5. sudo apt-add-repository --remove -y --no-update -S deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse 6. diff -r /etc/apt.BAK /etc/apt (Should show 'multiverse' removed from existing line in /etc/apt/sources.list, but...) diff -r /tmp/apt.BAK/sources.list /etc/apt/sources.list 4,5c4,5 < deb http://us.archive.ubuntu.com/ubuntu hirsute main restricted < # deb-src http://us.archive.ubuntu.com/ubuntu hirsute main restricted --- > # deb http://us.archive.ubuntu.com/ubuntu hirsute multiverse restricted main > # deb-src http://us.archive.ubuntu.com/ubuntu hirsute restricted main multiverse (7. sudo rm -rf /etc/apt; sudo cp -a /tmp/apt.BAK /etc/apt) # restore RESULTS: *every* component (including 'main') is disabled EXPECTED RESULTS: Only the specified component is disabled. In other words, --remove should un-do whatever the effect of an 'add' with the same LINE argument ProblemType: Bug DistroRelease: Ubuntu 21.04 Package: software-properties-common 0.99.10 ProcVersionSignature: Ubuntu 5.11.0-25.27-generic 5.11.22 Uname: Linux 5.11.0-25-generic x86_64 ApportVersion: 2.20.11-0ubuntu65.1 Architecture: amd64 CasperMD5CheckResult: pass CurrentDesktop: GNOME Date: Wed Jul 21 18:02:20 2021 InstallationDate: Installed on 2021-07-20 (0 days ago) InstallationMedia: Ubuntu-Server 21.04 "Hirsute Hippo" - Release amd64 (20210421) PackageArchitecture: all SourcePackage: software-properties UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1937119/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp