FrostyX / tracer

Tracer finds outdated running applications in your system
GNU General Public License v2.0
81 stars 24 forks source link

Traceback with dnf4: `module 'rpm' has no attribute 'fi'` #198

Closed mrc0mmand closed 10 months ago

mrc0mmand commented 11 months ago

Hey!

In one of our Rawhide CI jobs I noticed a traceback when running a transaction with dnf4 (a temporary workaround, since that particular transaction has issues with dnf5), and it can be easily reproduced with:

# dnf install dnf-plugins-extras-tracer
# rpm -q python3-dnf python3-dnf-plugin-tracer
python3-dnf-4.16.2-1.fc39.noarch
python3-dnf-plugin-tracer-4.1.0-3.fc39.noarch
# dnf remove -y vim
# dnf4 install -y vim
Last metadata expiration check: 0:04:20 ago on Fri 04 Aug 2023 04:54:42 AM EDT.
Dependencies resolved.
===================================================================================================================================
 Package                           Architecture              Version                              Repository                  Size
===================================================================================================================================
Installing:
 vim-enhanced                      x86_64                    2:9.0.1677-3.fc39                    rawhide                    1.9 M
Installing dependencies:
 gpm-libs                          x86_64                    1.20.7-44.fc39                       rawhide                     20 k
 libsodium                         x86_64                    1.0.18-13.fc39                       rawhide                    162 k
 vim-common                        x86_64                    2:9.0.1677-3.fc39                    rawhide                    7.3 M
 vim-filesystem                    noarch                    2:9.0.1677-3.fc39                    rawhide                     18 k
 xxd                               x86_64                    2:9.0.1677-3.fc39                    rawhide                     35 k

Transaction Summary
===================================================================================================================================
Install  6 Packages

Total download size: 9.4 M
Installed size: 39 M
Downloading Packages:
(1/6): gpm-libs-1.20.7-44.fc39.x86_64.rpm                                                           74 kB/s |  20 kB     00:00    
(2/6): libsodium-1.0.18-13.fc39.x86_64.rpm                                                         499 kB/s | 162 kB     00:00    
(3/6): vim-filesystem-9.0.1677-3.fc39.noarch.rpm                                                   955 kB/s |  18 kB     00:00    
(4/6): xxd-9.0.1677-3.fc39.x86_64.rpm                                                              336 kB/s |  35 kB     00:00    
(5/6): vim-enhanced-9.0.1677-3.fc39.x86_64.rpm                                                     9.6 MB/s | 1.9 MB     00:00    
(6/6): vim-common-9.0.1677-3.fc39.x86_64.rpm                                                        14 MB/s | 7.3 MB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------
Total                                                                                               11 MB/s | 9.4 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                           1/1 
  Installing       : xxd-2:9.0.1677-3.fc39.x86_64                                                                              1/6 
  Installing       : vim-filesystem-2:9.0.1677-3.fc39.noarch                                                                   2/6 
  Installing       : vim-common-2:9.0.1677-3.fc39.x86_64                                                                       3/6 
  Installing       : libsodium-1.0.18-13.fc39.x86_64                                                                           4/6 
  Installing       : gpm-libs-1.20.7-44.fc39.x86_64                                                                            5/6 
  Installing       : vim-enhanced-2:9.0.1677-3.fc39.x86_64                                                                     6/6 
  Running scriptlet: vim-enhanced-2:9.0.1677-3.fc39.x86_64                                                                     6/6 
  Verifying        : gpm-libs-1.20.7-44.fc39.x86_64                                                                            1/6 
  Verifying        : libsodium-1.0.18-13.fc39.x86_64                                                                           2/6 
  Verifying        : vim-common-2:9.0.1677-3.fc39.x86_64                                                                       3/6 
  Verifying        : vim-enhanced-2:9.0.1677-3.fc39.x86_64                                                                     4/6 
  Verifying        : vim-filesystem-2:9.0.1677-3.fc39.noarch                                                                   5/6 
  Verifying        : xxd-2:9.0.1677-3.fc39.x86_64                                                                              6/6 
Tracer:
 Call to Tracer API ended unexpectedly:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/dnf-plugins/tracer.py", line 65, in transaction
    tracer = TracerFacade(packages)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf-plugins/tracer.py", line 78, in __init__
    self.apps = self.get_apps(packages)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf-plugins/tracer.py", line 83, in get_apps
    return query.from_packages(packages).now().affected_applications().get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/tracer/query.py", line 72, in get
    return self._method(**self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/tracer/resources/tracer.py", line 99, in trace_affected
    for file in self._PACKAGE_MANAGER.package_files(package.name):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/tracer/resources/PackageManager.py", line 55, in package_files
    return self.package_managers[0].package_files(pkg_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/tracer/packageManagers/dnf.py", line 52, in package_files
    return super(Dnf, self).package_files(pkg_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/tracer/packageManagers/rpm.py", line 105, in package_files
    fi = rpm.fi(next(mi))
         ^^^^^^
AttributeError: module 'rpm' has no attribute 'fi'

Please visit https://github.com/FrostyX/tracer/issues and submit the issue. Thank you
We apologize for any inconvenience

Installed:
  gpm-libs-1.20.7-44.fc39.x86_64             libsodium-1.0.18-13.fc39.x86_64              vim-common-2:9.0.1677-3.fc39.x86_64     
  vim-enhanced-2:9.0.1677-3.fc39.x86_64      vim-filesystem-2:9.0.1677-3.fc39.noarch      xxd-2:9.0.1677-3.fc39.x86_64            

Complete!
FrostyX commented 10 months ago

See also RHBZ 2235578

kannon92 commented 7 months ago

Hello, I ran into this issue.

I wanted to create a GCP instance using fedora 39.

I can hit this failure if I do dnf install openssl.

I wanted to mention it here as it blocked me from continuing on to test with fedora 39. I hope there will be a release soon to fix this.

FrostyX commented 7 months ago

Hello @kannon92, the fix was released with tracer-1.0 and tracer-1.1 is in F39 for two months now https://bodhi.fedoraproject.org/updates/FEDORA-2023-924fcc46d1

Are you sure you are using the up-to-date version?

kannon92 commented 7 months ago

Hello @kannon92, the fix was released with tracer-1.0 and tracer-1.1 is in F39 for two months now https://bodhi.fedoraproject.org/updates/FEDORA-2023-924fcc46d1

Are you sure you are using the up-to-date version?

The main issue is I was using whatever GCP says they consider the latest.. I just wanted to report it because I didn't have control over the latest version of F39. I realized that it was considered beta in GCP so I decided to backtrack to F38 for my testing.

kannon92 commented 7 months ago

The image I used for GCP was Fedora Cloud Base 39_Beta 39-20230912.0.