20.04 -> 22.04 upgrade with KDE frontend crashes due to "'str' object has no attribute 'toUtf8'"
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
ubuntu-release-upgrader (Ubuntu) | Status tracked in Mantic | |||||
Mantic |
Fix Released
|
High
|
Brian Murray |
Bug Description
Kubuntu 20.04 being upgraded to 22.04 through the KDE frontend of ubuntu-
Now, the usual lesson that keeps true through the years here is that the only sane upgrade path is through console-based `do-release-
```
2023-05-22 22:04:26,219 ERROR not handled exception in KDE frontend:
Traceback (most recent call last):
File "/tmp/ubuntu-
os.
AttributeError: 'str' object has no attribute 'toUtf8'
2023-05-22 22:04:26,220 DEBUG running apport_crash()
```
(I don't think apport managed to really do anything meaningful, as the system was in shambles being updated and pretty much no "complex" application was even able to start due to broken dependencies, including `do-release-
Having worked on porting a number of Python2/PyQt4 applications to Python3/PyQt4 myself, the problem here is a classic one (and one of the reasons why I will no longer invest time in writing anything that should last through the years in Python): this is code that comes from PyQt4/SIP API v1, where Qt classes returned `QString` values like in C++; in SIP API v2 (which was the default with PyQt 5) `QString` was no longer wrapped, and all methods that used to return `QString` now just returned Python `str` objects, which do not have a `toUtf8` method.
A fix that "does the same thing as before" here is to just change
```
# now sent the key event to the termianl as utf-8
```
to
```
# now sent the key event to the terminal as utf-8
```
(fixing the comment while we are at it)
To be pedantic, in theory the "right thing" here would be to encode the `str` according to the locale of the process that is running inside the pty, although I'd be afraid of this breaking due to `UnicodeEncodeE
tags: | added: dist-upgrade |
tags: | added: focal jammy |
affects: | update-manager (Ubuntu) → ubuntu-release-upgrader (Ubuntu) |
Changed in ubuntu-release-upgrader (Ubuntu): | |
importance: | Undecided → High |
status: | New → In Progress |
assignee: | nobody → Brian Murray (brian-murray) |
I'm sorry your upgrade didn't go well, but thanks for providing a patch!
I've searched Launchpad and the Ubuntu Error Tracker for crashes in keyPressEvent and didn't find any. However, searching the Error Tracker for ubuntu- release- upgrader crashes is rather difficult due to a lot of noise in there.
So this **may** not be worth SRU'ing but let's get it fixed for Mantic++.