Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: east_asian_width() argument must be a unicode character, not #2135

Closed
edgan opened this issue Sep 26, 2024 · 2 comments
Closed

TypeError: east_asian_width() argument must be a unicode character, not #2135

edgan opened this issue Sep 26, 2024 · 2 comments

Comments

@edgan
Copy link

edgan commented Sep 26, 2024

I have "twice" seen this error from dnf on my Fedora 40 system. In the case from the traceback and output below it didn't cause a crash or really any problem. I say "twice", because until I cleaned up the first incident it was easily reproducible. Yet there have been two distinct cases of it on the same system.

A previous time I at the time thought it was an edge case related to the google-cloud-cli package. That incident caused a huge mess inside my rpm database. Where I had something like 50 packages with duplicate versions. Some of the packages included were systemd packages and some libraries. I was able to clean up the system manually with a fair amount of work. In the case the traceback looked the same. I removed the google-cloud-cli package and repository. I hadn't seen the issue since, till today. Both then and now I tried googling the error and didn't find much.

This isn't a edge case where I have a multi-language system, or that I am trying to worth with an asian language in some way.

As far as I can tell this desktop system was originally installed fresh as Fedora 38, and was upgraded from 38 to 39 via dnf system-upgrade. Then later upgraded again the same way to Fedora 40.

Versions:

dnf-4.21.1-1.fc40.noarch
fedora-release-identity-workstation-40-39.noarch
python3-3.12.6-1.fc40.x86_64

Environment variable:

LANG=en_US.UTF-8

Command used to find duplicates:

rpm -qa --queryformat '%{name}\n' | sort | uniq -c | sort -g | grep -Ev 'kernel|firmware' | grep ' [2-3]'

Traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/dnf/yum/rpmtrans.py", line 294, in callback
    self._instProgress(amount, total, key)
  File "/usr/lib/python3.12/site-packages/dnf/yum/rpmtrans.py", line 375, in _instProgress
    display.progress(pkg, action, amount, total, self.complete_actions, self.total_actions)
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 1999, in progress
    self._out_progress(ti_done, ti_total, ts_done, ts_total,
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 2016, in _out_progress
    (fmt, wid1, wid2) = self._makefmt(percent, ts_done, ts_total,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 2040, in _makefmt
    pnl = exact_width(pkgname)
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 179, in exact_width
    return sum(_exact_width_char(c) for c in msg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 179, in <genexpr>
    return sum(_exact_width_char(c) for c in msg)
               ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 153, in _exact_width_char
    return 2 if unicodedata.east_asian_width(uchar) in ('W', 'F') else 1
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: east_asian_width() argument must be a unicode character, not 

Full output:

Last metadata expiration check: 0:47:42 ago on Thu 26 Sep 2024 10:27:17 AM MST.
Dependencies resolved.
===============================================================================================================================================================================================================================================
 Package                                                          Architecture                                       Version                                                        Repository                                            Size
===============================================================================================================================================================================================================================================
Installing:
 kernel                                                           x86_64                                             6.10.11-200.fc40                                               updates                                              177 k
 kernel-core                                                      x86_64                                             6.10.11-200.fc40                                               updates                                               17 M
 kernel-devel                                                     x86_64                                             6.10.11-200.fc40                                               updates                                               20 M
 kernel-modules                                                   x86_64                                             6.10.11-200.fc40                                               updates                                               63 M
 kernel-modules-core                                              x86_64                                             6.10.11-200.fc40                                               updates                                               38 M
 kernel-modules-extra                                             x86_64                                             6.10.11-200.fc40                                               updates                                              2.9 M
Upgrading:
 kernel-devel-matched                                             x86_64                                             6.10.11-200.fc40                                               updates                                              177 k
 python3-paramiko                                                 noarch                                             3.5.0-1.fc40                                                   updates                                              403 k
Removing:
 kernel                                                           x86_64                                             6.10.9-200.fc40                                                @updates                                               0  
 kernel-core                                                      x86_64                                             6.10.9-200.fc40                                                @updates                                              69 M
 kernel-devel                                                     x86_64                                             6.10.9-200.fc40                                                @updates                                              71 M
 kernel-modules                                                   x86_64                                             6.10.9-200.fc40                                                @updates                                              62 M
 kernel-modules-core                                              x86_64                                             6.10.9-200.fc40                                                @updates                                              36 M
 kernel-modules-extra                                             x86_64                                             6.10.9-200.fc40                                                @updates                                             2.7 M

Transaction Summary
===============================================================================================================================================================================================================================================
Install  6 Packages
Upgrade  2 Packages
Remove   6 Packages

Total download size: 142 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): kernel-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                                      291 kB/s | 177 kB     00:00    
(2/8): kernel-core-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                                  12 MB/s |  17 MB     00:01    
(3/8): kernel-devel-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                                 13 MB/s |  20 MB     00:01    
(4/8): kernel-modules-extra-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                         15 MB/s | 2.9 MB     00:00    
(5/8): kernel-devel-matched-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                        1.8 MB/s | 177 kB     00:00    
(6/8): python3-paramiko-3.5.0-1.fc40.noarch.rpm                                                                                                                                                                3.6 MB/s | 403 kB     00:00    
(7/8): kernel-modules-core-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                          27 MB/s |  38 MB     00:01    
(8/8): kernel-modules-6.10.11-200.fc40.x86_64.rpm                                                                                                                                                               25 MB/s |  63 MB     00:02    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                           42 MB/s | 142 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                       1/1 
  Installing       : kernel-modules-core-6.10.11-200.fc40.x86_64                                                                                                                                                                          1/16 
  Installing       : kernel-core-6.10.11-200.fc40.x86_64                                                                                                                                                                                  2/16 
  Running scriptlet: kernel-core-6.10.11-200.fc40.x86_64                                                                                                                                                                                  2/16 
  Installing       : kernel-modules-6.10.11-200.fc40.x86_64                                                                                                                                                                               3/16 
  Running scriptlet: kernel-modules-6.10.11-200.fc40.x86_64                                                                                                                                                                               3/16 
  Installing       : kernel-devel-6.10.11-200.fc40.x86_64 [=================================================                                                                                                                           ]  4/16Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/dnf/yum/rpmtrans.py", line 294, in callback
    self._instProgress(amount, total, key)
  File "/usr/lib/python3.12/site-packages/dnf/yum/rpmtrans.py", line 375, in _instProgress
    display.progress(pkg, action, amount, total, self.complete_actions, self.total_actions)
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 1999, in progress
    self._out_progress(ti_done, ti_total, ts_done, ts_total,
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 2016, in _out_progress
    (fmt, wid1, wid2) = self._makefmt(percent, ts_done, ts_total,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/cli/output.py", line 2040, in _makefmt
    pnl = exact_width(pkgname)
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 179, in exact_width
    return sum(_exact_width_char(c) for c in msg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 179, in <genexpr>
    return sum(_exact_width_char(c) for c in msg)
               ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/i18n.py", line 153, in _exact_width_char
    return 2 if unicodedata.east_asian_width(uchar) in ('W', 'F') else 1
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: east_asian_width() argument must be a unicode character, not 

  Installing       : kernel-devel-6.10.11-200.fc40.x86_64                                                                                                                                                                                 4/16 
  Running scriptlet: kernel-devel-6.10.11-200.fc40.x86_64                                                                                                                                                                                 4/16 
  Upgrading        : kernel-devel-matched-6.10.11-200.fc40.x86_64                                                                                                                                                                         5/16 
  Installing       : kernel-6.10.11-200.fc40.x86_64                                                                                                                                                                                       6/16 
  Installing       : kernel-modules-extra-6.10.11-200.fc40.x86_64                                                                                                                                                                         7/16 
  Running scriptlet: kernel-modules-extra-6.10.11-200.fc40.x86_64                                                                                                                                                                         7/16 
  Upgrading        : python3-paramiko-3.5.0-1.fc40.noarch                                                                                                                                                                                 8/16 
  Erasing          : kernel-modules-extra-6.10.9-200.fc40.x86_64                                                                                                                                                                          9/16 
  Running scriptlet: kernel-modules-extra-6.10.9-200.fc40.x86_64                                                                                                                                                                          9/16 
  Erasing          : kernel-6.10.9-200.fc40.x86_64                                                                                                                                                                                       10/16 
  Erasing          : kernel-modules-6.10.9-200.fc40.x86_64                                                                                                                                                                               11/16 
  Running scriptlet: kernel-modules-6.10.9-200.fc40.x86_64                                                                                                                                                                               11/16 
  Erasing          : kernel-modules-core-6.10.9-200.fc40.x86_64                                                                                                                                                                          12/16 
  Running scriptlet: kernel-core-6.10.9-200.fc40.x86_64                                                                                                                                                                                  13/16 
  Erasing          : kernel-core-6.10.9-200.fc40.x86_64                                                                                                                                                                                  13/16 
  Erasing          : kernel-devel-6.10.9-200.fc40.x86_64                                                                                                                                                                                 14/16 
  Cleanup          : python3-paramiko-3.4.0-3.fc40.noarch                                                                                                                                                                                15/16 
  Cleanup          : kernel-devel-matched-6.10.10-200.fc40.x86_64                                                                                                                                                                        16/16 
  Running scriptlet: kernel-modules-core-6.10.11-200.fc40.x86_64                                                                                                                                                                         16/16 
  Running scriptlet: kernel-core-6.10.11-200.fc40.x86_64                                                                                                                                                                                 16/16 
  Running scriptlet: kernel-modules-6.10.11-200.fc40.x86_64                                                                                                                                                                              16/16 
  Running scriptlet: kernel-devel-matched-6.10.10-200.fc40.x86_64                                                                                                                                                                        16/16 

Upgraded:
  kernel-devel-matched-6.10.11-200.fc40.x86_64                                                                               python3-paramiko-3.5.0-1.fc40.noarch                                                                              
Installed:
  kernel-6.10.11-200.fc40.x86_64  kernel-core-6.10.11-200.fc40.x86_64  kernel-devel-6.10.11-200.fc40.x86_64  kernel-modules-6.10.11-200.fc40.x86_64  kernel-modules-core-6.10.11-200.fc40.x86_64  kernel-modules-extra-6.10.11-200.fc40.x86_64 
Removed:
  kernel-6.10.9-200.fc40.x86_64   kernel-core-6.10.9-200.fc40.x86_64   kernel-devel-6.10.9-200.fc40.x86_64   kernel-modules-6.10.9-200.fc40.x86_64   kernel-modules-core-6.10.9-200.fc40.x86_64   kernel-modules-extra-6.10.9-200.fc40.x86_64  

Complete!
@ppisar
Copy link
Contributor

ppisar commented Sep 27, 2024

It seems that your RPM database contains a broken package name (UTF-8-invalid string) and DNF attempts to print it. Before printing it DNF tries to interpret it as UTF-8 in progress() function with ucd() call and that call fails to provide a valid UTF-8 string.

We would like to know what kind of object is and what content has pkgname variable in progress() method in /usr/lib/python3.12/site-packages/dnf/cli/output.py file before line 1993 and after line 1993 when your problem happens. Are you able to debug it?

@edgan
Copy link
Author

edgan commented Sep 28, 2024

I think this was a hardware issue. I am closing it.

@edgan edgan closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants