Bug 1788182

Summary: [abrt] DNF raises RuntimeError when passing invalid values to `--repofrompath`
Product: [Fedora] Fedora Reporter: Allan Lewis <allanlewis99>
Component: dnfAssignee: Lukáš Hrázký <lhrazky>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: amatej, jmracek, jrohel, lhrazky, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/50eaf315ac1bee627dadf525bc5c9fbc7ba57c1c
Whiteboard: abrt_hash:82047bd1d310779da65c4da681bf10738f48cad6;VARIANT_ID=workstation;
Fixed In Version: dnf-4.2.23-1.fc32 dnf-4.2.23-1.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-05 02:29:54 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:
Attachments:
Description Flags
File: _var_log_dnf.log
none
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.librepo.log
none
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.log
none
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.rpm.log
none
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_hawkey.log
none
File: backtrace
none
File: cgroup
none
File: cpuinfo
none
File: dnf-makecache.log
none
File: environ
none
File: mountinfo
none
File: namespaces
none
File: open_fds none

Description Allan Lewis 2020-01-06 16:02:18 UTC
Description of problem:
I was testing a repo I created using `dnf reposync` but used the wrong syntax for `--repofrompath`: I put the URL first instead of the repo name. My mistake, but it caused an unhandled exception.

Version-Release number of selected component:
dnf-4.2.17-1.fc31

Additional info:
reporter:       libreport-2.11.3
cmdline:        /usr/bin/python3 /usr/bin/dnf --repofrompath /mnt/nas/repo/mirror2/centos/8/2020-01-06/extras,extras --repo extras list
crash_function: __init__
exception_type: RuntimeError
executable:     /usr/bin/dnf
interpreter:    python3-3.7.5-2.fc31.x86_64
kernel:         5.3.15-300.fc31.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
repo.py:440:__init__:RuntimeError: Bad id for repo: /mnt/nas/repo/mirror2/centos/8/2020-01-06/extras, byte = / 0

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.7/site-packages/dnf/cli/main.py", line 191, in user_main
    errcode = main(args)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 65, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.7/site-packages/dnf/cli/main.py", line 94, in _main
    cli.configure(list(map(ucd, args)), option_parser())
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 969, in configure
    self._configure_repos(opts)
  File "/usr/lib/python3.7/site-packages/dnf/cli/cli.py", line 753, in _configure_repos
    this_repo = self.base.repos.add_new_repo(label, self.base.conf, baseurl=[path])
  File "/usr/lib/python3.7/site-packages/dnf/repodict.py", line 86, in add_new_repo
    repo = dnf.repo.Repo(repoid, conf)
  File "/usr/lib/python3.7/site-packages/dnf/repo.py", line 427, in __init__
    self._repo = libdnf.repo.Repo(name if name else "", self._config)
  File "/usr/lib64/python3.7/site-packages/libdnf/repo.py", line 440, in __init__
    _repo.Repo_swiginit(self, _repo.new_Repo(id, config))
RuntimeError: Bad id for repo: /mnt/nas/repo/mirror2/centos/8/2020-01-06/extras, byte = / 0

Local variables in innermost frame:
self: <libdnf.repo.Repo;  >
id: '/mnt/nas/repo/mirror2/centos/8/2020-01-06/extras'
config: <libdnf.conf.ConfigRepo; proxy of <Swig Object of type 'libdnf::ConfigRepo *' at 0x7f2e3cc733c0> >

Comment 1 Allan Lewis 2020-01-06 16:02:29 UTC
Created attachment 1650155 [details]
File: _var_log_dnf.log

Comment 2 Allan Lewis 2020-01-06 16:02:37 UTC
Created attachment 1650156 [details]
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.librepo.log

Comment 3 Allan Lewis 2020-01-06 16:02:39 UTC
Created attachment 1650157 [details]
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.log

Comment 4 Allan Lewis 2020-01-06 16:02:41 UTC
Created attachment 1650158 [details]
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_dnf.rpm.log

Comment 5 Allan Lewis 2020-01-06 16:02:50 UTC
Created attachment 1650159 [details]
File: _var_tmp_dnf-allan.lewis-qo7a7nhx_hawkey.log

Comment 6 Allan Lewis 2020-01-06 16:02:55 UTC
Created attachment 1650160 [details]
File: backtrace

Comment 7 Allan Lewis 2020-01-06 16:03:01 UTC
Created attachment 1650161 [details]
File: cgroup

Comment 8 Allan Lewis 2020-01-06 16:03:06 UTC
Created attachment 1650162 [details]
File: cpuinfo

Comment 9 Allan Lewis 2020-01-06 16:03:11 UTC
Created attachment 1650163 [details]
File: dnf-makecache.log

Comment 10 Allan Lewis 2020-01-06 16:03:16 UTC
Created attachment 1650164 [details]
File: environ

Comment 11 Allan Lewis 2020-01-06 16:03:21 UTC
Created attachment 1650165 [details]
File: mountinfo

Comment 12 Allan Lewis 2020-01-06 16:03:27 UTC
Created attachment 1650166 [details]
File: namespaces

Comment 13 Allan Lewis 2020-01-06 16:03:28 UTC
Created attachment 1650167 [details]
File: open_fds

Comment 14 Lukáš Hrázký 2020-01-07 10:08:14 UTC
Hello Allan,

it is a sad fact that there are a lot of unhandled exceptions in dnf. Thanks for the report though, I'll try to fix this one once my PR for allowing to even handle the exceptions goes through: https://github.com/rpm-software-management/libdnf/pull/866

Comment 16 Fedora Update System 2020-06-03 08:55:17 UTC
FEDORA-2020-f3f7292b39 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-f3f7292b39

Comment 17 Fedora Update System 2020-06-03 08:55:18 UTC
FEDORA-2020-a943fde9ba has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-a943fde9ba

Comment 18 Fedora Update System 2020-06-04 03:00:25 UTC
FEDORA-2020-f3f7292b39 has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-f3f7292b39`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f3f7292b39

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

Comment 19 Fedora Update System 2020-06-04 04:08:31 UTC
FEDORA-2020-a943fde9ba has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-a943fde9ba`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-a943fde9ba

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

Comment 20 Fedora Update System 2020-06-05 02:29:54 UTC
FEDORA-2020-a943fde9ba has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 21 Fedora Update System 2020-06-19 01:05:26 UTC
FEDORA-2020-f3f7292b39 has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.