Bug 1873146 - package.remote_location() tracebacks for @commandline package
Summary: package.remote_location() tracebacks for @commandline package
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 34
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-27 13:32 UTC by amatej
Modified: 2021-03-03 23:15 UTC (History)
9 users (show)

Fixed In Version: dnf-4.6.0-1.fc33
Clone Of:
Environment:
Last Closed: 2021-03-03 23:15:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description amatej 2020-08-27 13:32:02 UTC
Description of problem:
package.remote_location() tracebacks if package is from @commandline

The problem is kind of contrived but traceback is ugly.
It also breaks one dnf API test in https://github.com/rpm-software-management/dnf/pull/1654

How reproducible:
dnf repoquery ./some-local.rpm --location

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.9/site-packages/dnf/cli/main.py", line 201, in user_main
    errcode = main(args)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 67, in main
    return _main(base, args, cli_class, option_parser_class)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 106, in _main
    return cli_run(cli, base)
  File "/usr/lib/python3.9/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.9/site-packages/dnf/cli/cli.py", line 1162, in run
    return self.command.run()
  File "/usr/lib/python3.9/site-packages/dnf/cli/commands/repoquery.py", line 596, in run
    location = pkg.remote_location()
  File "/usr/lib/python3.9/site-packages/dnf/package.py", line 260, in remote_location
    return self.repo.remote_location(self.location, schemes)
  File "/usr/lib/python3.9/site-packages/dnf/package.py", line 184, in repo
    return self.base.repos[self.reponame]
KeyError: '@commandline'

Comment 1 Daniel Mach 2020-08-27 13:57:49 UTC
Good catch!
I believe it's because the @commandline repo is treated differently than others and is not part of the RepoDict.
That's why we're considering adding the repo there in dnf5 so all repos are treated equally.

Comment 2 Jaroslav Mracek 2021-01-04 09:01:02 UTC
I create a patch that resolves the crash https://github.com/rpm-software-management/dnf/pull/1706. It also resolves the issue with installed packages (`dnf repoquery --installed --location vim-minimal`).

Comment 3 amatej 2021-01-05 10:14:27 UTC
Here are some tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/928

Comment 4 Ben Cotton 2021-02-09 16:26:07 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 5 Fedora Update System 2021-03-02 16:58:26 UTC
FEDORA-2021-4935120076 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-4935120076

Comment 6 Fedora Update System 2021-03-03 23:15:42 UTC
FEDORA-2021-4935120076 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


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