Bug 1144003

Summary: [abrt] dnf: download.py:181:_get_query_source:TypeError: 'NoneType' object has no attribute '__getitem__'
Product: [Fedora] Fedora Reporter: Marcela Mašláňová <mmaslano>
Component: dnfAssignee: Tim Lauridsen <tim.lauridsen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: jsilhan, jzeleny, packaging-team-maint, pnemade, rholy, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/158330246b2aae87d54480952d695afc3a8e90f6
Whiteboard: abrt_hash:2411e6982d4abca243db6fbbaa5e4b2b0570b0c7
Fixed In Version: dnf-0.6.3-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-13 09:53:59 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: backtrace
none
File: environ none

Description Marcela Mašláňová 2014-09-18 12:36:31 UTC
Description of problem:
dnf download ruby193 --source

Okay, ruby193 wasn't in the repo, but it should do something better than give a traceback.

Version-Release number of selected component:
dnf-0.5.4-2.fc20

Additional info:
reporter:       libreport-2.2.3
cmdline:        /usr/bin/python -OO /usr/bin/dnf download ruby193 --source
dso_list:       dnf-plugins-core-0.1.1-3.fc20.noarch
executable:     /usr/bin/dnf
kernel:         3.16.2-200.fc20.x86_64
runlevel:       N 5
type:           Python
uid:            8270

Truncated backtrace:
download.py:181:_get_query_source:TypeError: 'NoneType' object has no attribute '__getitem__'

Traceback (most recent call last):
  File "/usr/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 200, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 83, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 133, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1171, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 84, in run
    locations = self._download_source(self.opts.packages)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 111, in _download_source
    pkgs = self._get_packages(source_pkgs, source=True)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 119, in _get_packages
    queries = map(self._get_query_source, pkg_specs)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/download.py", line 181, in _get_query_source
    pkg_spec = pkg_spec[:-4]  # skip the .rpm
TypeError: 'NoneType' object has no attribute '__getitem__'

Local variables in innermost frame:
pkg_spec: None
self: <dnf.plugin.dynamic.download.DownloadCommand object at 0x1e61410>

Comment 1 Marcela Mašláňová 2014-09-18 12:36:34 UTC
Created attachment 938869 [details]
File: backtrace

Comment 2 Marcela Mašláňová 2014-09-18 12:36:35 UTC
Created attachment 938870 [details]
File: environ

Comment 3 Parag Nemade 2014-09-18 16:46:57 UTC
I think there is no such traceback on Fedora 21. I tried to reproduce this as
$ sudo dnf download ruby193 --source
enabled fedora-source repository
Fedora 21 - Source                                225 kB/s | 5.4 MB     00:24    

and no output as it didn't find srpm ruby193

Comment 4 Honza Silhan 2014-09-19 09:55:37 UTC
I haven't reproduced it either - no traceback in f20 with the same packages as reporter.

Do you know what's going on, Tim? Would you mind taking it, please?

Comment 5 Tim Lauridsen 2014-09-19 10:57:00 UTC
I will take a look

Comment 6 Tim Lauridsen 2014-09-19 12:18:10 UTC
Look a little strange, this will only happen if no sourcerpm is defined for a given package.

I have made a fix, so the plugin don't traceback in this case

https://github.com/rpm-software-management/dnf-plugins-core/pull/43

Comment 7 Marcela Mašláňová 2014-09-22 10:40:55 UTC
Thanks.

Comment 8 Honza Silhan 2014-11-19 11:39:08 UTC
Thanks, Tim.

Comment 9 Fedora Update System 2014-12-09 14:06:50 UTC
dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21

Comment 10 Fedora Update System 2014-12-12 04:32:58 UTC
Package dnf-0.6.3-2.fc21, hawkey-0.5.2-1.fc21, dnf-plugins-core-0.1.4-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.6.3-2.fc21 hawkey-0.5.2-1.fc21 dnf-plugins-core-0.1.4-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-16760/dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2014-12-13 09:53:59 UTC
dnf-0.6.3-2.fc21, hawkey-0.5.2-1.fc21, dnf-plugins-core-0.1.4-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.