mysql's apport hook's add_info() routine needs to handle 2nd parameter

Bug #1922413 reported by Bryce Harrington
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mysql-8.0 (Ubuntu)
Fix Released
Undecided
Bryce Harrington

Bug Description

As seen in https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1922143,

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 227, in _run_hook
    symb['add_info'](report, ui)
TypeError: add_info() takes 1 positional argument but 2 were given

This is resolving to call this routine in source_mysql-8.0.py:

def add_info(report):
    attach_conffiles(report, 'mysql-server-8.0', conffiles=None)
    ...

However it's being called like:

        try:
            symb['add_info'](report, ui)
        except TypeError as e:
            if str(e).startswith('add_info()'):
                # older versions of apport did not pass UI, and hooks that
                # do not require it don't need to take it
                symb['add_info'](report)
            else:
                raise

So, while the older form of the call supports the single-arg version, the apport hook should probably be updated to handle the newer calling syntax.

Related branches

Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Thanks for the report, Bryce. I've assigned this to you since we discussed this during the standup today.

However, I am curious, what does the "ui" parameter do? It's not really clear to me, maybe you'd know? Also, do you happen to know other packages that uses apport like mysql? I'd be very interested to see how things change with different packages?

Thank you!

Changed in mysql-8.0 (Ubuntu):
status: New → Triaged
assignee: nobody → Bryce Harrington (bryce)
Revision history for this message
Utkarsh Gupta (utkarsh) wrote :

Oooh, gotcha! I looked up samba and how it uses ui.information, ui.choice, et al. Interesting, but it simply needs some work to add choices and information to make this more interactive for the users.

Anyway, I look forward to your patch. And then I can rebase the fix for LP: #1922412 on top of it and add ui.information("...") instead of print("..."). Hope that makes sense.

Revision history for this message
Bryce Harrington (bryce) wrote :

The xorg hook (/usr/share/apport/package-hooks/source_xorg.py) has some non-trivial examples of use of the ui.* api's.

[I think you meant this comments to LP #1922412...]

Bryce Harrington (bryce)
Changed in mysql-8.0 (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mysql-8.0 - 8.0.28-0ubuntu3

---------------
mysql-8.0 (8.0.28-0ubuntu3) jammy; urgency=medium

  * d/a/source_mysql-8.0.py: Improve apport hook
    - Update call signature for add_info() (LP: #1922413)
    - Skip non-existing conf dirs (LP: #1958641)
    - If /etc/mysql missing, ask confirmation (LP: #1922412)
    - Fix all lint/flakes warnings
      + python3 -m py_compile source_mysql-8.0.py
      + pyflakes3 source_mysql-8.0.py
      + pylint source_mysql-8.0.py

 -- Bryce Harrington <email address hidden> Wed, 16 Feb 2022 19:07:41 -0800

Changed in mysql-8.0 (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.