** Description changed:

+ [Impact]
+ 
+ Bugs about the upgrade process might not be reported because the apport
+ hook is not working correctly. This was caused by apport chaning the
+ signature of apport_excepthook().
+ 
+ [Test Plan]
+ 
+ We need to force and exception to occur and observe that apport handles
+ it correctly. Because the function signature changed between jammy and
+ noble, the test plan is slightly different depending on the upgrade
+ path. In either case, we interrupt the upgrade after the script is
+ downloaded, and modify DistUpgradeController.py to unconditionally raise
+ an exception at a given point.
+ 
+ 1. Start an upgrade:
+ 
+ $ do-release-upgrade --proposed
+ 
+ Accept the initial prompt, but then decline the next one (before the
+ upgrade really begins).
+ 
+ 2. Navigate to the temp directory where the upgrade script was unpacked:
+ 
+ $ cd "$(find /tmp/ -name ubuntu-release-upgrader-* -type d)"
+ 
+ 3. Edit the DistUpgradeController.py script to contain a line with:
+ 
+ raise Exception("Test 123")
+ 
+ For oracular, add this at the end of the __init__() function. For noble,
+ add this at the end of fullUpgrade().
+ 
+ 4. Run the upgrade, and observe that the exception is caught, and the
+ apport hook is called as a result:
+ 
+ $ ./oracular
+ 
+ OR
+ 
+ $ ./noble
+ 
+ [Where problems could occur]
+ 
+ Any further issues would be related to the apport hook, because we are
+ chaning the number of arguments passed.
+ 
+ For jammy->noble, this risk is mitigated by trying the old way, catching
+ TypeError, and then trying the new way. This is necessary because the
+ change happened between jammy and noble.
+ 
+ For noble->oracular, the apport function has the same signature, so this
+ extra step is not necessary.
+ 
+ [Original Description]
+ 
  When there was a failure to handle an upgrade, apport_crash() gets
  called to handle it and it calls apport_excepthook(), but it is missing
  an argument in that call:
  
  Error in sys.excepthook:
  Traceback (most recent call last):
-   File 
"/tmp/ubuntu-release-upgrader-rj__cqhy/DistUpgrade/DistUpgradeViewText.py", 
line 138, in _handleException
-     apport_crash(type, value, tb)
-   File 
"/tmp/ubuntu-release-upgrader-rj__cqhy/DistUpgrade/DistUpgradeApport.py", line 
57, in apport_crash
-     apport_excepthook(type, value, tb)
+   File 
"/tmp/ubuntu-release-upgrader-rj__cqhy/DistUpgrade/DistUpgradeViewText.py", 
line 138, in _handleException
+     apport_crash(type, value, tb)
+   File 
"/tmp/ubuntu-release-upgrader-rj__cqhy/DistUpgrade/DistUpgradeApport.py", line 
57, in apport_crash
+     apport_excepthook(type, value, tb)
  TypeError: apport_excepthook() missing 1 required positional argument: 
'exc_tb'
  
  In my case, that was because I had Apt::Default-Release "noble"; in my
  apt.conf. That issue is on me and I've fixed that misconfiguration.
  However, this bug is about the second exception that was triggered when
  trying to handle the first exception. It seems that apport_excepthook is
  missing the binary argument. Maybe apport_crash() needs to be passing in
  sys.argv[0] in DistUpgradeApport.py on it's call to
  apport_excepthook()??
  
  This crash can also be seen in another, recent bug report:
  
  https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-
  upgrader/+bug/2064955

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2096824

Title:
  apport_excepthook called with incorrect number of arguments

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2096824/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to