Giter Site home page Giter Site logo

Comments (4)

fernflower avatar fernflower commented on July 22, 2024

Looks like the key issue is items list being shared between the 2 models. Did some debugging in redhatsignedrpmsscanner actor and every time an rpm is added to one model's items list it immediately appears in the second model's list.

(Pdb) signed_pkgs.items,unsigned_pkgs.items
([], [])
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(38)process()
-> continue
(Pdb) signed_pkgs.items,unsigned_pkgs.items
([<leapp.models.installedrpm.RPM object at 0x7fa5d76b0890>], [<leapp.models.installedrpm.RPM object at 0x7fa5d76b0890>])
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(32)process()
-> for pkg in rpm_pkgs.items:
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(34)process()
-> if any(key in pkg.pgpsig for key in RH_SIGS) or \
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(35)process()
-> (pkg.name == 'gpg-pubkey' and pkg.packager.startswith('Red Hat, Inc.')):
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(40)process()
-> unsigned_pkgs.items.append(pkg)
(Pdb) n
> /home/ivasilev/projects/leapp-repository/repos/system_upgrade/el7toel8/actors/redhatsignedrpmscanner/actor.py(32)process()
-> for pkg in rpm_pkgs.items:
(Pdb) signed_pkgs.items,unsigned_pkgs.items
([<leapp.models.installedrpm.RPM object at 0x7fa5d76b0890>, <leapp.models.installedrpm.RPM object at 0x7fa5d76b08d0>], [<leapp.models.installedrpm.RPM object at 0x7fa5d76b0890>, <leapp.models.installedrpm.RPM object at 0x7fa5d76b08d0>])
(Pdb) signed_pkgs.items == unsigned_pkgs.items
True

from leapp-repository.

fernflower avatar fernflower commented on July 22, 2024

I suspect that base class fields are not copied correctly in ModelMeta.__new__ -> this causes base class and child class to share reference to the same object unless the field has been specifically redefined in child class

leapp/models/__init__.py:ModelMeta:__new__

kls_attrs = (getattr(klass, 'fields', None) or {}).copy()

iiuc this won't create proper copy of List field changing a reference to the actual underlying list object.
Created a leapp PR with bug localization\eye bleeding fix oamg/leapp#513

from leapp-repository.

bocekm avatar bocekm commented on July 22, 2024

@fernflower, isn't this fixed by oamg/leapp#513?

from leapp-repository.

fernflower avatar fernflower commented on July 22, 2024

@bocekm it is, thank you!

from leapp-repository.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.