Bug 1212693

Summary: dnf does not consistently exit immediately when an invalid option is given
Product: [Fedora] Fedora Reporter: James Patterson <jamespatterson>
Component: dnfAssignee: Michael Mráka <mmraka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jsilhan, jzeleny, mluscon, packaging-team-maint, pnemade, red, tim.lauridsen, vmukhame
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-22 09:33:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Patterson 2015-04-17 06:31:38 UTC
Description of problem:
dnf should exit immediately if an option is given that does not exist.

This does the right thing:
# dnf -a
as does this:
# dnf -a upgrade

This does not work:
# dnf upgrade -a
Using metadata from Wed Apr 15 14:35:15 2015
No match for argument: -a
Error: No packages marked for upgrade.
nor does this:
# dnf list -z

Version-Release number of selected component (if applicable):
dnf-0.6.4-1.fc21.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Radek Holy 2015-04-17 10:10:14 UTC
Hello, thank you for the report.

Actually, this is something that you should expect because according to the man pages, the synopsis is "dnf [options] <command> [<args>...]". So, anything passed after a "<command>" should be handled as an argument of the command.

So, if we are going to officially support putting global options after the "<command>", we should document it as well.

Comment 2 James Patterson 2015-04-17 10:18:24 UTC
Yes I understand that, but if an invalid option is passed, you want dnf to exit.

Comment 3 Radek Holy 2015-06-22 07:22:30 UTC
*** Bug 1233845 has been marked as a duplicate of this bug. ***

Comment 4 Davide Repetto 2015-06-22 08:11:51 UTC
(In reply to James Patterson from comment #2)
> Yes I understand that, but if an invalid option is passed, you want dnf to
> exit.

Which is basically what every other Linux program does. Including yum BTW.

Comment 5 Honza Silhan 2015-07-22 09:14:08 UTC
Will be fixed along with argparsing DNF refactoring.

Comment 6 Davide Repetto 2015-10-09 14:28:53 UTC
Any idea of the time frame?

Comment 7 Michael Mráka 2016-05-26 07:22:39 UTC
Fixed as a part of DNF 2.0 argument parser rewrite
https://github.com/rpm-software-management/dnf/pull/474

Comment 8 Fedora End Of Life 2016-07-19 13:45:25 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Igor Gnatenko 2016-07-22 09:33:13 UTC
as Michael said.