Bug 2331665

Summary: libcomps segfaults when iterating over and iterator from an iterator
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: libcompsAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 41CC: daniel.mach, jluza, jmracek, mblaha, pkratoch, python-maint, rpm-software-management, sergio
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: libcomps-0.1.21-4.fc42 libcomps-0.1.21-4.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-12-11 20:25:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2321657, 2330927    

Description Miro Hrončok 2024-12-11 10:39:48 UTC
This is pretty much the same thing as bz2330562 but for libcomps.

In Python 3.13.0:

>>> import libcomps
>>> i = libcomps.Comps()
>>> next(iter(iter(i.environments)))
Segmentation fault (core dumped)

This is with python3-libcomps-0.1.21-3.fc41.x86_64.


With Python 3.13.1 this code is called via dnf in https://github.com/rpm-software-management/dnf/blob/4.22.0/dnf/comps.py#L420

This causes anaconda to segfault and blocks update to Python 3.13.1.

Reproducible: Always

Comment 1 Miro Hrončok 2024-12-11 10:47:09 UTC
> >>> import libcomps
> >>> i = libcomps.Comps()
> >>> next(iter(iter(i.environments)))
> Segmentation fault (core dumped)

Or even:

>>> import libcomps
>>> i = libcomps.Comps()
>>> it = iter(i.environments)
>>> it2 = iter(it)
Segmentation fault (core dumped)

Comment 2 Miro Hrončok 2024-12-11 11:17:06 UTC
Upstream PR: https://github.com/rpm-software-management/libcomps/pull/116

Comment 3 Fedora Update System 2024-12-11 14:14:02 UTC
FEDORA-2024-63d5771cc9 (libcomps-0.1.21-4.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-63d5771cc9

Comment 4 Fedora Update System 2024-12-11 14:34:06 UTC
FEDORA-2024-3c18fe0d93 (libcomps-0.1.21-4.fc41, libdnf-0.73.4-2.fc41, and 2 more) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-3c18fe0d93

Comment 5 Fedora Update System 2024-12-11 20:25:46 UTC
FEDORA-2024-63d5771cc9 (libcomps-0.1.21-4.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2024-12-12 02:40:11 UTC
FEDORA-2024-3c18fe0d93 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-3c18fe0d93`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-3c18fe0d93

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2024-12-22 02:01:05 UTC
FEDORA-2024-3c18fe0d93 (libcomps-0.1.21-4.fc41, libdnf-0.73.4-2.fc41, and 2 more) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.