Bug 1566125 - empty reposdir= in config file lead to dnf crash
Summary: empty reposdir= in config file lead to dnf crash
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 27
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Marek Blaha
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-11 14:55 UTC by Olivier LAHAYE
Modified: 2018-05-31 12:53 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-31 12:53:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
dnf config file that triggers the problem (645 bytes, text/plain)
2018-04-11 14:55 UTC, Olivier LAHAYE
no flags Details

Description Olivier LAHAYE 2018-04-11 14:55:04 UTC
Created attachment 1420385 [details]
dnf config file that triggers the problem

Description of problem:
reposdir=
with no value leads to a dnf crash.
Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. save attachnment as /tmp/dnf_test.conf
2. run the following comment
/usr/bin/dnf -c /tmp/dnf_test.conf makecache

Actual results:
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.6/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 95, in _main
    cli.configure(list(map(ucd, args)), option_parser())
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 818, in configure
    self._read_conf_file(opts.releasever)
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 912, in _read_conf_file
    conf._search_inside_installroot('reposdir')
  File "/usr/lib/python3.6/site-packages/dnf/conf/config.py", line 812, in _search_inside_installroot
    val.lstrip('/'))):
AttributeError: 'NoneType' object has no attribute 'lstrip'


Expected results:
Last metadata expiration check: 0:00:00 ago on Wed Apr 11 14:53:25 2018.
Metadata cache created.

Additional info:

Comment 1 Marek Blaha 2018-04-11 15:28:37 UTC
Fixed in pull request https://github.com/rpm-software-management/dnf/pull/1056

Comment 2 Fedora End Of Life 2018-05-03 08:19:28 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Olivier LAHAYE 2018-05-03 10:35:12 UTC
Still not fixed in FC-27.
(Commenting line "reposdir=" let dnf works, but if line is in place, it crashes)
See below:

$ cat /tmp/test.conf
[main]
cachedir=/var/cache/dnf
debuglevel=2
logfile=/var/log/yume.log
pkgpolicy=newest
tolerant=1
exactarch=1
retries=20
obsoletes=1
reposdir=
gpgcheck=0
plugins=1

[oscar_fc-27-x86_64]
name=fc-27-x86_64 package repository
baseurl=file:/tftpboot/oscar/fc-27-x86_64

[unstable_fc-27-x86_64]
name=fc-27-x86_64 package repository
baseurl=http://svn.oscar.openclustergroup.org/repos/unstable/fc-27-x86_64

[27_x86_64]
name=x86_64 package repository
baseurl=https://dl.fedoraproject.org/pub/fedora/linux/updates/27/x86_64

[x86_64_os]
name=os package repository
baseurl=https://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/os




$ sudo dnf -c /tmp/test.conf list all
Traceback (most recent call last):
  File "/bin/dnf", line 58, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 179, in user_main
    errcode = main(args)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 95, in _main
    cli.configure(list(map(ucd, args)), option_parser())
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 818, in configure
    self._read_conf_file(opts.releasever)
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 912, in _read_conf_file
    conf._search_inside_installroot('reposdir')
  File "/usr/lib/python3.6/site-packages/dnf/conf/config.py", line 812, in _search_inside_installroot
    val.lstrip('/'))):
AttributeError: 'NoneType' object has no attribute 'lstrip'




$ rpm -q dnf
dnf-2.7.5-2.fc27.noarch

Comment 4 Jaroslav Mracek 2018-05-31 12:53:47 UTC
The problem is already fixed in upstream and will be released into rawhide and later on in F28 with dnf-3.0


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