Bug 1074463

Summary: Segmentation fault - hawkey
Product: [Fedora] Fedora Reporter: Jakub Wojtysiak <dolgo.pl>
Component: hawkeyAssignee: Honza Silhan <jsilhan>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: akozumpl, dolgo.pl, jsilhan, rholy
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-28 19:07:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Requested core dump... none

Description Jakub Wojtysiak 2014-03-10 10:11:51 UTC
Description of problem:

When run following code I get segmentation fault when one of repomd_fn, primary_fn, filelists_fn files does not actually exist on the filesystem:

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import

import os
import re
import rpm
import time
import glob
import hawkey
import shutil
import librepo
import ConfigParser

sack = hawkey.Sack()

path = "/mnt/cache/%s"

repo1 = hawkey.Repo("Fedora")
repo1.repomd_fn = path % "fedora/repodata/repomd.xml"
repo1.primary_fn = path % "fedora/repodata/d7777ea6ec66e1c86c3fe1900adf5bf8d877fb77dd06e439bd76bbbec4e82094-primary.xml.gz"
repo1.filelists_fn = path % "fedora/repodata/ef9c432f9a354c202cadbd415248891bfd30addfd2bda52be2391156e32c5392-filelists.xml.gz"

repo2 = hawkey.Repo("Updates")
repo2.repomd_fn = path % "updates/repodata/repomd.xml"
repo2.primary_fn = path % "updates/repodata/41bf2a05469f49f390c5dddd4712814b0a3cfff22b2bd9ea8ebe4490a6769e39-primary.xml.gz"
repo2.filelists_fn = path % "updates/repodata/ed23cac14f1f9d37bf900fa87596c8fcad8c76557b85d5ee203a57fdbb239577-filelists.xml.gz"

sack.load_yum_repo(repo1, load_filelists=True)
len(sack)
sack.load_yum_repo(repo2, load_filelists=True)
len(sack)


Version-Release number of selected component (if applicable):
hawkey-0.4.11-1.fc20.x86_64
python-hawkey-0.4.11-1.fc20.x86_64
python-2.7.5-11.fc20.x86_64


How reproducible:
Everytime, when target file does not exist


Steps to Reproduce:
1. Run above code.
2. Make sure that files transferred to Repo object dont exist on filesystem.
3. Segfault happens when invoking sack.load_yum_repo() on repo that has missing files.


Actual results:
Segmentation fault


Expected results:
Working sack

Additional info:

Comment 1 Ales Kozumplik 2014-03-10 10:21:43 UTC
Jakub, would you be able to upload the coredump somewhere?

Comment 2 Jakub Wojtysiak 2014-03-10 16:28:15 UTC
Created attachment 872793 [details]
Requested core dump...

For simplicity and core size reduction, was generated from code below:

#!/usr/bin/python -tt

import hawkey

sack = hawkey.Sack()

path = "/mnt/cache/%s"

repo2 = hawkey.Repo("Updates")
repo2.repomd_fn = path % "updates/repodata/repomd.xml"
repo2.primary_fn = path % "updates/repodata/41bf2a05469f49f390c5dddd4712814b0a3cfff22b2bd9ea8ebe4490a6769e39-primary.xml.gz"
repo2.filelists_fn = path % "updates/repodata/ed23cac14f1f9d37bf900fa87596c8fcad8c76557b85d5ee203a57fdbb239577-filelists.xml.gz"

sack.load_yum_repo(repo2, load_filelists=True)

Comment 3 Ales Kozumplik 2014-03-11 09:38:58 UTC
Thank you! We will take a look.

Comment 4 Ales Kozumplik 2014-04-17 12:58:11 UTC
Moving to Jan.

Comment 5 Honza Silhan 2014-04-28 19:07:49 UTC
I cannot get segfault even in hawkey-0.4.11-1. It throws "IOError: Can not read repomd file" instead. IMO it's expected result contrary to yours (Expected results: Working sack).