Bug 1565599 - IndexError: list index out of range when removing a module with a wrong stream specified
Summary: IndexError: list index out of range when removing a module with a wrong strea...
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf   
(Show other bugs)
Version: 28
Hardware: Unspecified Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Martin Hatina
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Triaged
Depends On:
Blocks: dnf-modularity
TreeView+ depends on / blocked
 
Reported: 2018-04-10 11:51 UTC by Jiri Kortus
Modified: 2018-06-28 08:03 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-06-28 08:03:26 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Jiri Kortus 2018-04-10 11:51:36 UTC
Description of problem:
When removing a module with other stream than the one installed on the system, the following traceback occurs:

[root@localhost ~]# dnf module list --installed
Last metadata expiration check: 0:07:05 ago on Tue 10 Apr 2018 01:38:17 PM CEST.
Fedora Modular 28 - x86_64 - Test Updates
Name                  Stream     Version          Profiles                                                           
nodejs                6 [e]      20180328185917   default [i], development, ...                                      

Hint: [d]efault, [e]nabled, [i]nstalled, [l]ocked

[root@localhost ~]# dnf module remove nodejs:8/default
Last metadata expiration check: 0:08:25 ago on Tue 10 Apr 2018 01:38:17 PM CEST.
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 99, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.6/site-packages/dnf/cli/main.py", line 115, in cli_run
    cli.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/cli.py", line 1016, in run
    return self.command.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/module.py", line 278, in run
    self.subcmd.run_on_module()
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/module.py", line 153, in run_on_module
    self.base.repo_module_dict.remove(self.opts.module_nsvp)
  File "/usr/lib/python3.6/site-packages/dnf/module/repo_module_dict.py", line 457, in remove
    module_version.remove(profiles)
  File "/usr/lib/python3.6/site-packages/dnf/module/repo_module_version.py", line 126, in remove
    if self.base._yumdb.get_package(remove_query[0]).reason == 'user':
  File "/usr/lib64/python3.6/site-packages/hawkey/__init__.py", line 369, in __getitem__
    return self.run()[idx]
IndexError: list index out of range


Version-Release number of selected component (if applicable):
dnf-0:2.7.5-8.fc28.noarch

How reproducible:
100% (on Fedora-Server-dvd-x86_64-28-20180407.n.0.iso for Fedora modularity test day)

Steps to Reproduce:
1. install a module (that has at least two streams) with one particular stream:
   # dnf module install nodejs:6/default
2. try to remove the same module with another stream specified:
   # dnf module remove nodejs:8/default
3. dnf traceback occurs

Actual results:
Traceback.

Expected results:
No traceback, dnf informs the user that such action cannot be accomplished since no such module with specified stream is installed.

Additional info:

Comment 1 Martin Hatina 2018-04-11 10:48:15 UTC
Fixed by https://github.com/rpm-software-management/dnf/pull/1054

Comment 2 Jaroslav Mracek 2018-06-28 08:03:26 UTC
The issue is solved by dnf-3.0.1-1 that was released into rawhide.


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