Package: software-properties-gtk
Version: 0.96.20.2-2.1
Severity: important
Tags: patch

Dear Maintainer,

The current version of software-properties-gtk (0.96.20.2-2.1) hangs
when refreshing the package list cache if the PackageKit refresh task
finishes with failed status. For intance, if a cdrom source repository
is configured but not mounted, refreshing the cache will fail with the
following error output in the terminal:

--------
Traceback (most recent call last):
  File 
"/usr/lib/python3/dist-packages/softwareproperties/gtk/DialogCacheOutdated.py", 
line 86, in on_pktask_finish
    results = self._pktask.generic_finish(result)
gi.repository.GLib.Error: pk-client-error-quark: E: The repository 
'cdrom://[Debian GNU/Linux 11.2.0 _Bullseye_ - Official amd64 DVD Binary-1 
20211218-11:13] bullseye Release' does not have a Release file.
W: Updating from such a repository can't be done securely, and is therefore 
disabled by default.
W: See apt-secure(8) manpage for repository creation and user configuration 
details.
E: cdrom://[Debian GNU/Linux 11.2.0 _Bullseye_ - Official amd64 DVD Binary-1 
20211218-11:13] bullseye Release is not (yet) available (Please use apt-cdrom 
to make this CD-ROM recognized by APT. apt-get update cannot be used to add new 
CD-ROMs)
 (319)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/usr/lib/python3/dist-packages/softwareproperties/gtk/DialogCacheOutdated.py", 
line 88, in on_pktask_finish
    dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 319, in 
new_init
    return super_init_func(self, **new_kwargs)
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 572, in 
__init__
    self._init(*args, **new_kwargs)
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 319, in 
new_init
    return super_init_func(self, **new_kwargs)
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 518, in 
__init__
    _window_init(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 319, in 
new_init
    return super_init_func(self, **new_kwargs)
TypeError: could not convert value for property `transient_for' from 
DialogCacheOutdated to GtkWindow
--------

This is due to a bug in the exception-handling part of
DialogCacheOutdated.on_pktask_finish(): the call to
Gtk.MessageDialog() should specify self.parent as its first
argument instead of self.

As a result of this bug, the "Cache Refresh" dialog hangs and
cannot be closed properly. (Furthermore, forcefully closing
the hung window by using right-click then "Close" fails to kill
the software-properties-gtk process: it then becomes impossible
to start software-properties-gtk again until the session is restarted
or the process is manually killed...)

This issue was already reported and fixed upstream:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1829401
https://git.launchpad.net/software-properties/commit/softwareproperties/gtk/DialogCacheOutdated.py?id=354bbd08bd3a0a99d357b5b54b27a2df68db46ed

Would it please be possible to backport this fix to the currently
shipped version of software-properties-gtk? I'm attaching a trivial
patch which should apply smoothly to 0.96.20.2-2.1 and fix this issue.

Thank you very much in advance!

Cheers,
SnipFoo.

-- System Information:
Debian Release: 11.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-10-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages software-properties-gtk depends on:
ii  gir1.2-gtk-3.0               3.24.24-4
ii  python3                      3.9.2-3
ii  python3-gi                   3.38.0-2
ii  python3-software-properties  0.96.20.2-2.1
ii  software-properties-common   0.96.20.2-2.1

software-properties-gtk recommends no packages.

Versions of packages software-properties-gtk suggests:
ii  gnome-software  3.38.1-1

-- no debconf information
diff -Naur a/softwareproperties/gtk/DialogCacheOutdated.py 
b/softwareproperties/gtk/DialogCacheOutdated.py
--- a/softwareproperties/gtk/DialogCacheOutdated.py
+++ b/softwareproperties/gtk/DialogCacheOutdated.py
@@ -85,7 +85,7 @@
         try:
             results = self._pktask.generic_finish(result)
         except Exception as e:
-            dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR,
+            dialog = Gtk.MessageDialog(self.parent, 0, Gtk.MessageType.ERROR,
                 Gtk.ButtonsType.CANCEL, _("Error while refreshing cache"))
             dialog.format_secondary_text(str(e))
             dialog.run()

Reply via email to