Bug 1387754 - dnf tracebacks when doing update while adding new repos via CLI
Summary: dnf tracebacks when doing update while adding new repos via CLI
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
urgent
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1394893 1419615 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-21 18:45 UTC by Tomas Tomecek
Modified: 2017-02-13 14:25 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-07 06:33:05 UTC
Type: Bug


Attachments (Terms of Use)

Description Tomas Tomecek 2016-10-21 18:45:53 UTC
Version-Release number of selected component (if applicable):
python3-dnf-plugins-core-1.0.0-0.rc1.1.fc26.noarch
dnf-yum-2.0.0-0.rc1.4.fc26.noarch
python3-dnf-2.0.0-0.rc1.4.fc26.noarch
dnf-2.0.0-0.rc1.4.fc26.noarch
dnf-conf-2.0.0-0.rc1.4.fc26.noarch
dnf-plugins-core-1.0.0-0.rc1.1.fc26.noarch
libdnf-0.7.0-0.1git179c0a6.fc26.x86_64


Actual results:
$ dnf --disablerepo=* --repofrompath f25,http://download.fedoraproject.org/pub/fedora/linux/releases/25/Everything/x86_64/os/ --enablerepo f25 --repo
frompath f25-u,http://ftp.linux.cz/pub/linux/fedora/linux/updates/25/x86_64/ --enablerepo f25-u --repofrompath f25-ut,http://ftp.linux.cz/pub/linux/fedora/linux/updates/testing/25/x86_64/ --enablerepo f25-ut --disableexcludes all --refresh update kernel
Added f25 repo from http://download.fedoraproject.org/pub/fedora/linux/releases/25/Everything/x86_64/os/
Added f25-u repo from http://ftp.linux.cz/pub/linux/fedora/linux/updates/25/x86_64/
Added f25-ut repo from http://ftp.linux.cz/pub/linux/fedora/linux/updates/testing/25/x86_64/
TypeError: __str__ returned non-string (type NoneType)

During handling of the above exception, another exception occurred:

SystemError: PyEval_EvalFrameEx returned a result with an error set

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 170, in user_main
    errcode = main(args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.5/site-packages/dnf/cli/main.py", line 111, in _main
    cli.run()
  File "/usr/lib/python3.5/site-packages/dnf/cli/cli.py", line 946, in run
    self._process_demands()
  File "/usr/lib/python3.5/site-packages/dnf/cli/cli.py", line 788, in _process_demands
    load_available_repos=self.demands.available_repos)
  File "/usr/lib/python3.5/site-packages/dnf/base.py", line 252, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.5/site-packages/dnf/base.py", line 109, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 842, in load
    self._handle_load(handle)
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 591, in _handle_load
    return self._handle_load_core(handle)
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 604, in _handle_load_core
    result = handle._perform()
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 228, in _perform
    return super(_Handle, self).perform(result)
  File "/usr/lib64/python3.5/site-packages/librepo/__init__.py", line 1517, in perform
    _librepo.Handle.perform(self, result)
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 404, in _progress_cb
    self.progress.progress(self, done)
SystemError: PyEval_EvalFrameEx returned a result with an error set

Comment 1 Igor Gnatenko 2016-10-24 11:25:37 UTC
Seems like CPython's librepo bug.

Comment 2 Tomas Mlcoch 2016-10-25 06:55:50 UTC
Igor, could you shed some light on how librepo is used by DNF when this error occurs? What is happening? Package download? Repodata download? How the callback function look like? Etc.

Comment 3 Igor Gnatenko 2016-11-28 14:48:16 UTC
*** Bug 1394893 has been marked as a duplicate of this bug. ***

Comment 4 Neal Gompa 2016-12-01 03:33:19 UTC
I'm encountering the same issue in Mageia Cauldron, with exactly the same error by running the following command:

sudo dnf --disablerepo=* --repofrompath=mga,https://mirrors.kernel.org/mageia/distrib/6/x86_64/media/core/release/ --enablerepo=mga6 install qupzilla

TL;DR: dnf.repo.Repo() is broken. Details below.

The stage in which this is happening is when it has added the repository to the sack and is starting the repodata download.

Stepping through the program's execution using pudb, it looks like MDPayload doesn't have a text attribute to return for dnf.cli.progress.progress().

The steps that seem to occur at the breaking function call are:
MDPayload::_progress_cb(self=MDPayload, cbdata=None, total=0.0) -> self.progress.progress(self=MDPayload, payload=MDPayload, done=0.0) -> unicode(payload=MDPayload) -> MDPayload::__str__(self=MDPayload) -> return self._text

The "return self._text" returns None, rather than a string.

Going a bit deeper, it seems that when _md_pload.start(self.name) is called in dnf.repo Repo::_handle_load_core(), the self.name has no value when you do --repofrompath (that is, it seems that the name I gave it is not being written in, which in this case is "mga"). With self.name=None, it propagates through until it breaks at _progress_cb().

If I do the exact same operation, but replace all the repo switches with "--refresh" and trace it again, "self.name" is filled in with a string. In my case, it is "Mageia Cauldron - x86_64".

This seems like the issue is in DNF itself, rather than librepo, as the None value breaks the rendering of the progress text, causing the crash.

The new livecd-creator ported over to DNF has the same problem, caused by the name being passed in the Repo() call not being carried into the program.

Here are the relevant bits:

* https://github.com/rpm-software-management/dnf/blob/master/dnf/cli/progress.py#L70

* https://github.com/rpm-software-management/dnf/blob/master/dnf/repo.py#L395

* https://github.com/rpm-software-management/dnf/blob/master/dnf/repo.py#L616

* https://github.com/rhinstaller/livecd-tools/blob/master/imgcreate/dnfinst.py#L153

* https://github.com/rpm-software-management/dnf/blob/master/dnf/repo.py#L454

Comment 5 Neal Gompa 2016-12-01 03:37:20 UTC
This needs to be fixed before the next DNF 2.0 RC goes out.

Comment 7 Neal Gompa 2016-12-04 03:46:36 UTC
There was a slight problem with the fix, as the long form name was always overridden with the repo ID.

Pull request with fix submitted: https://github.com/rpm-software-management/dnf/pull/674

Comment 8 Igor Gnatenko 2017-02-13 14:25:26 UTC
*** Bug 1419615 has been marked as a duplicate of this bug. ***


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