Bug 974866 - dnf crashes if neither baseurl nor mirrorlist are defined
dnf crashes if neither baseurl nor mirrorlist are defined
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-06-16 14:57 EDT by Andreas Fleig
Modified: 2014-09-30 19:41 EDT (History)
3 users (show)

See Also:
Fixed In Version: libsolv-0.3.0-5.git228d412.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-06-30 21:37:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Andreas Fleig 2013-06-16 14:57:32 EDT
Description of problem:
When neither mirrorlist nor baseurl are defined for a repository, dnf will
crash with the following stack trace:

$ sudo dnf check-update
Failed to set locale, defaulting to C
Traceback (most recent call last):
  File "/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 304, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 39, in main
    _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 135, in _main
    result, resultmsgs = cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1295, in run
    return self.command.doCommand(self.base.basecmd, self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands.py", line 1206, in doCommand
    local = po.localPkg()
  File "/usr/lib/python2.7/site-packages/dnf/package.py", line 160, in localPkg
    os.path.join(self.repo.pkgdir, os.path.basename(self.location))
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 449, in pkgdir
    if self._local_origin:
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 210, in _local_origin
    if self.baseurl[0].startswith('file://'):
IndexError: list index out of range

Version-Release number of selected component (if applicable):
$ dnf --version
Failed to set locale, defaulting to C
  Installed: dnf-0:0.3.7-1.gitf8bdc98.fc19.noarch at 2013-05-31 14:14
  Built    : Fedora Project at 2013-05-29 12:41

  Installed: rpm-0: at 2013-06-03 14:13
  Built    : Fedora Project at 2013-05-28 07:16

How reproducible:

Steps to Reproduce:
1. Comment out both "baseurl" and "mirrorlist" in /etc/yum.repos.d/fedora.repo
2. run dnf check-update

Actual results:
dnf crashes

Expected results:
1. dnf should not crash and skip the misconfigured repository
2. dnf should show an error message explaining the misconfiguration
Comment 1 Ales Kozumplik 2013-06-18 08:24:36 EDT
Fixed by 4196601.
Comment 2 Fedora Update System 2013-06-24 09:25:43 EDT
libsolv-0.3.0-5.git228d412.fc19, librepo-0.0.4-2.fc19, hawkey-0.3.14-1.git78b3aa0.fc19, dnf-0.3.8-2.git85524ae.fc19 has been submitted as an update for Fedora 19.
Comment 3 Fedora Update System 2013-06-24 14:50:10 EDT
Package libsolv-0.3.0-5.git228d412.fc19, librepo-0.0.4-2.fc19, hawkey-0.3.14-1.git78b3aa0.fc19, dnf-0.3.8-2.git85524ae.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libsolv-0.3.0-5.git228d412.fc19 librepo-0.0.4-2.fc19 hawkey-0.3.14-1.git78b3aa0.fc19 dnf-0.3.8-2.git85524ae.fc19'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 4 Fedora Update System 2013-06-30 21:37:26 EDT
libsolv-0.3.0-5.git228d412.fc19, librepo-0.0.4-2.fc19, hawkey-0.3.14-1.git78b3aa0.fc19, dnf-0.3.8-2.git85524ae.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.