Other Software > Remove button doesn't work

Bug #2059796 reported by Jeremy Bícha
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
Undecided
Nathan Teodosio

Bug Description

Test Case
---------
- Add a PPA with apt-add-repository, not with software-properties (we want a deb822 format for the test).
- Open the Software & Updates tab
- Switch to the Other Software tab
- Select the PPA line and click Remove
- After Authentication, nothing happens.

No error is emitted to the command line. The repo line still shows. The repo is still in /etc/apt/sources.list.d/

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: software-properties-gtk 0.99.44
ProcVersionSignature: Ubuntu 6.8.0-20.20-generic 6.8.1
Uname: Linux 6.8.0-20-generic x86_64
NonfreeKernelModules: zfs
ApportVersion: 2.28.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Fri Mar 29 12:06:07 2024
InstallationDate: Installed on 2022-04-06 (723 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Daily amd64 (20220405)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: software-properties
UpgradeStatus: Upgraded to noble on 2023-12-09 (111 days ago)

Related branches

Revision history for this message
Jeremy Bícha (jbicha) wrote :
Changed in software-properties (Ubuntu):
status: New → Triaged
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

After racking my brains thinking this had to do with deb822, I found that a Dbus exception was being suppressed by only logging one particular exception. Disabling the catch with

--->
    def on_remove_clicked(self, widget):
        """Remove the selected source"""
        model = self.treeview_sources.get_model()
        (path, column) = self.treeview_sources.get_cursor()
        iter = model.get_iter(path)
        if iter:
            source_entry = model.get_value(iter, LIST_ENTRY_OBJ)
            #try:
            self.backend.RemoveSource(str(source_entry))
            #except dbus.DBusException as e:
            # maybe_log_authentication_canceled_error(e)
<---

reveals the issue:

--->
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 1159, in on_remove_clicked
    self.backend.RemoveSource(str(source_entry))
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 634, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dbus.exceptions.DBusException: com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges
<---

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I had killed the authentication agent and forgot to bring it back, so my last comment conclusion is wrong.

The incorrect behavior does seem to be tied to deb822; for .source files the exception being suppressed is

--->
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 1158, in on_remove_clicked
    self.backend.RemoveSource(str(source_entry))
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 634, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
  File "/lib/python3/dist-packages/dbus/service.py", line 712, in _message_cb
    retval = candidate_method(self, *args, **keywords)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3/dist-packages/softwareproperties/dbus/SoftwarePropertiesDBus.py", line 285, in RemoveSource
    self.remove_source(_to_unicode(source))
  File "/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 779, in remove_source
    self.remove_source(source, True)
  File "/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 781, in remove_source
    self.remove_source(source, False)
  File "/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 802, in remove_source
    self.sourceslist.list.append(SourceEntry("", file=source.file))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3/dist-packages/aptsources/sourceslist.py", line 509, in __init__
    raise ValueError("Classic SourceEntry cannot be written to .sources file")
ValueError: Classic SourceEntry cannot be written to .sources file
<---

Revision history for this message
Nathan Teodosio (nteodosio) wrote :
description: updated
tags: added: deb822
Revision history for this message
Paride Legovini (paride) wrote :

Hello Nathan,

the diff LGTM, I just have two questions:

1. The bug description has a "test case", but that's more of a reproducer than of a test case, right? The "expected result" is not explicitly stated. In particular, looking at this step:

 - After Authentication, nothing happens.

what should happen instead? And, on:

  The repo line still shows.
  The repo is still in /etc/apt/sources.list.d/

the expected behavior is that the repo is gone, right?

Can you please make this more explicit and state that you actually verified the fix that way?

Thanks!

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Hi Paride, thanks for having a look.

I'm not the reporter of the bug, but yes I'd also call that a reproducer.

The expected behavior is that, after authentication,

(1) it is immediately gone from software properties and
(2) Apt no longer pulls from that repository: 'apt update --print-uris' no longer reports the just removed repository because the corresponding file in is /etc/apt/sources.list.d/ is either gone or empty.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

...And I verified the fix in that way.

Paride Legovini (paride)
Changed in software-properties (Ubuntu):
assignee: nobody → Nathan Teodosio (nteodosio)
status: Triaged → In Progress
Revision history for this message
Paride Legovini (paride) wrote :

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading software-properties_0.99.47.dsc: done.
  Uploading software-properties_0.99.47.tar.xz: done.
  Uploading software-properties_0.99.47_source.buildinfo: done.
  Uploading software-properties_0.99.47_source.changes: done.
Successfully uploaded packages.

Changed in software-properties (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Steve Langasek (vorlon) wrote :

This looks like a good fix to have for 24.04 release but does not look beta-critical.

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

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

---------------
software-properties (0.99.47) noble; urgency=medium

  * Fix failed removal of Deb822 formated source in "Other Software" tab
    (LP: #2059796).

 -- Nathan Pratta Teodosio <email address hidden> Tue, 09 Apr 2024 09:02:50 +0200

Changed in software-properties (Ubuntu):
status: Fix Committed → Fix Released
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.