Bug 1545075 - updateinfo tracebacks when an advisory consists of multiple repos
Summary: updateinfo tracebacks when an advisory consists of multiple repos
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 27
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Marek Blaha
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Triaged
: 1548684 1548788 1550491 1564363 1566006 1569745 1575810 1578953 1585463 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-14 08:40 UTC by Eva Mrakova
Modified: 2018-06-28 08:23 UTC (History)
19 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2018-06-28 08:23:11 UTC


Attachments (Terms of Use)

Description Eva Mrakova 2018-02-14 08:40:09 UTC
Description of problem:
when a security advisory contains packages from multiple repositories and there are inconsistencies in their metadata, 'dnf updateinfo' fails with traceback 

Note: yum is able to report metadata mismatch in the same situation.
      Related bugs 737173 and 1269659 has been reported for yum in the past.

Version-Release number of selected component (if applicable):
dnf-2.7.5-2.fc27.noarch

How reproducible:
always

Steps to Reproduce:
1. create 2 repos with different packages, all that packages belong to the 
   same security advisory
2. modify updateinfo metadata in one of the repos so that it is inconsistent
   with the other one (ID and title of advisory are the same but severity
   differs, e.g. Low vs. High)
3. run 'dnf updateinfo list'

Actual results:
# dnf --disablerepo=\* --enablerepo=repoA --enablerepo=repoB updateinfo list
Last metadata expiration check: 0:14:42 ago on Tue 13 Feb 2018 08:10:11 AM EST.
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 1014, in run
    return self.command.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 417, in run
    display(apkg_adv_insts, mixed, description)
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in display_list
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in <genexpr>
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 290, in <genexpr>
    for id_, (typ, sev) in id2type.items()),
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 283, in type2label
    return (cls.SECURITY2LABEL[sev] if typ == hawkey.ADVISORY_SECURITY
KeyError: 'High'

Note: there's no traceback for some other inconsistencies (e.g. whitespaces, summary field)

Expected results:
no traceback

Additional info:
/CoreOS/yum/Sanity/bz737173-merge-updateinfo-from-multiple-repositories can be used as a reproducer

Comment 1 Laurentiu Pancescu 2018-02-21 17:50:00 UTC
I get what appears to be the same stack trace (just with a KeyError for None) right now, in Fedora 27, with the default repos - I didn't create any repo files like Eva did:

# dnf updateinfo list
Fedora 27 - x86_64 - Updates                    3.7 MB/s |  19 MB     00:05    
Last metadata expiration check: 0:00:38 ago on Wed 21 Feb 2018 06:21:32 PM CET.
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 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 1014, in run
    return self.command.run()
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 417, in run
    display(apkg_adv_insts, mixed, description)
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in display_list
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in <genexpr>
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 290, in <genexpr>
    for id_, (typ, sev) in id2type.items()),
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 283, in type2label
    return (cls.SECURITY2LABEL[sev] if typ == hawkey.ADVISORY_SECURITY
KeyError: 'None'

Comment 2 alexander 2018-02-22 19:28:06 UTC
changing line 56 from
None: _('Unknown/Sec.')}#fixed by AKB, 2018-02-22 
to 
'None': _('Unknown/Sec.')}#fixed by AKB, 2018-02-22 
seems to fix the problem

Comment 3 alexander 2018-02-22 19:28:39 UTC
sorry, line 56 in updateinfo.py

Comment 4 Marek Blaha 2018-03-02 12:27:47 UTC
*** Bug 1548684 has been marked as a duplicate of this bug. ***

Comment 5 Marek Blaha 2018-03-02 12:28:08 UTC
*** Bug 1548788 has been marked as a duplicate of this bug. ***

Comment 7 Marek Blaha 2018-03-07 10:24:45 UTC
*** Bug 1550491 has been marked as a duplicate of this bug. ***

Comment 8 Chris Schanzle 2018-03-08 03:32:42 UTC
Applying fix in comment 2 works and I see the fix in comment 6 is even better, but it begs the question as to what might be preventing a fixed package from being built?

Obviously others are reporting this issue, so it would be nice to have a fix sooner than later.
Many thanks!

Comment 9 René Genz 2018-03-24 14:15:53 UTC
This problem can be reproduced in Fedora 26 x86_64 and Fedora 28 x86_64 with default repositories:
$ rpm -q dnf
dnf-2.7.5-8.fc28.noarch
# on Fedora 26: dnf-2.7.5-2.fc26.noarch

$ dnf repolist
...
repo id           repo name                          status
*fedora           Fedora 28 - x86_64                 57,057
*updates          Fedora 28 - x86_64 - Updates            0
*updates-testing  Fedora 28 - x86_64 - Test Updates   4,808


On Fedora 28 these commands work without problems:
dnf updateinfo
dnf updateinfo --bugfix
dnf updateinfo --security
dnf updateinfo --summary
dnf updateinfo --info

these commands throw the same stack trace:
dnf updateinfo list updates
dnf updateinfo --list
dnf updateinfo --list available
dnf updateinfo --list all
dnf updateinfo --list installed
dnf updateinfo --list updates
dnf updateinfo --list available security
dnf updateinfo --list all security
dnf updateinfo --list installed security
dnf updateinfo --list updates security

the stack trace is (in Fedora 26 only one difference: the string 'line 1016' is changed to 'line 1014'):
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/updateinfo.py", line 417, in run
    display(apkg_adv_insts, mixed, description)
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in display_list
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 292, in <genexpr>
    for (nevra, inst), id2type in cls._list(apkg_adv_insts))
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 290, in <genexpr>
    for id_, (typ, sev) in id2type.items()),
  File "/usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py", line 283, in type2label
    return (cls.SECURITY2LABEL[sev] if typ == hawkey.ADVISORY_SECURITY


Applying the fix from comment 2 fixes problem in Fedora 26 and 28:
vi /usr/lib/python3.6/site-packages/dnf/cli/commands/updateinfo.py
change line 56 from:
None: _('Unknown/Sec.')}
to:
'None': _('Unknown/Sec.')}

Comment 10 René Genz 2018-03-24 15:04:10 UTC
(In reply to Chris Schanzle from comment #8)
Maybe a new upstream release? I submitted the patch from comment 2 to the dnf package for temporary inclusion:
https://src.fedoraproject.org/rpms/dnf/pull-request/7

Comment 11 Marek Blaha 2018-04-06 05:17:03 UTC
*** Bug 1564363 has been marked as a duplicate of this bug. ***

Comment 12 Marek Blaha 2018-04-11 11:57:50 UTC
*** Bug 1566006 has been marked as a duplicate of this bug. ***

Comment 13 Marek Blaha 2018-04-23 11:40:49 UTC
*** Bug 1569745 has been marked as a duplicate of this bug. ***

Comment 14 Marek Blaha 2018-05-14 11:44:45 UTC
*** Bug 1575810 has been marked as a duplicate of this bug. ***

Comment 15 Marek Blaha 2018-05-18 07:58:00 UTC
*** Bug 1578953 has been marked as a duplicate of this bug. ***

Comment 16 Marek Blaha 2018-06-04 06:41:08 UTC
*** Bug 1585463 has been marked as a duplicate of this bug. ***

Comment 17 Jaroslav Mracek 2018-06-28 08:23:11 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.