Bug 1299261 - dnf repoquery's --repo argument does not work
dnf repoquery's --repo argument does not work
Status: CLOSED DUPLICATE of bug 1260986
Product: Fedora
Classification: Fedora
Component: dnf-plugins-core (Show other bugs)
22
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-17 18:22 EST by Erik Johnson
Modified: 2016-01-19 10:10 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-19 10:10:52 EST
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)

  None (edit)
Description Erik Johnson 2016-01-17 18:22:43 EST
Description of problem:

The release notes for 0.1.7 state that --repoid has been changed to --repo to make usage consistent (http://dnf-plugins-core.readthedocs.org/en/latest/release_notes.html?#id8)

However, using "--repo" results in an error while using the old (and now deprecated) "--repoid" works properly.


Version-Release number of selected component (if applicable):

At least the most recent version (as of now, 0.1.15) has this problem.


How reproducible:

100% of the time


Steps to Reproduce:

1. Run the following command:

dnf repoquery --quiet --repo=updates --queryformat='%{name} - %{repoid}' bash


Actual results:

usage: dnf [--allowerasing] [-b] [-C] [-c [config file]] [-d [debug level]]
           [--debugsolver] [--showduplicates] [-e ERRORLEVEL]
           [--rpmverbosity [debug level name]] [-q] [-v] [-y] [--assumeno]
           [--version] [--installroot [path]] [--enablerepo [repo]]
           [--disablerepo [repo]] [-x [package]] [--disableexcludes [repo]]
           [--repofrompath [repo,path]] [--noplugins] [--nogpgcheck]
           [--disableplugin [plugin]] [--color COLOR]
           [--releasever RELEASEVER] [--setopt SETOPTS] [--refresh] [-4] [-6]
           [--downloadonly] [-h]
Command line error: argument --repofrompath: bad format: updates


Expected results:

bash - updates


Additional info:

As mentioned above, using --repoid works properly:

% dnf repoquery --quiet --repoid=updates --queryformat='%{name} - %{repoid}' bash
bash - updates
Comment 1 Erik Johnson 2016-01-17 20:34:56 EST
I've found the issue. This is getting caught up in dnf's own argument parsing before it ever reaches the repoquery plugin. I dug into the source code for argparse in the Python stdlib, and found this gem:

for option_string in self._option_string_actions:
    if option_string.startswith(option_prefix):
        action = self._option_string_actions[option_string]
        tup = action, option_string, explicit_arg
        result.append(tup)

(See https://hg.python.org/releases/2.7.11/file/tip/Lib/argparse.py#l2156)

So, what's happening is that the repoquery plugin has a "--repo" argument, but because of this loose matching in argparse.py, it is being matched to "--repofrompat" from dnf proper.
Comment 2 Honza Silhan 2016-01-19 10:10:52 EST

*** This bug has been marked as a duplicate of bug 1260986 ***

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