Bug 1212693 - dnf does not consistently exit immediately when an invalid option is given
dnf does not consistently exit immediately when an invalid option is given
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Mráka
Fedora Extras Quality Assurance
: Reopened, Triaged
: 1233845 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-04-17 02:31 EDT by James Patterson
Modified: 2016-10-04 15:14 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-22 05:33:13 EDT
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 James Patterson 2015-04-17 02:31:38 EDT
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 06:10:14 EDT
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 06:18:24 EDT
Yes I understand that, but if an invalid option is passed, you want dnf to exit.
Comment 3 Radek Holy 2015-06-22 03:22:30 EDT
*** Bug 1233845 has been marked as a duplicate of this bug. ***
Comment 4 Davide Repetto 2015-06-22 04:11:51 EDT
(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 05:14:08 EDT
Will be fixed along with argparsing DNF refactoring.
Comment 6 Davide Repetto 2015-10-09 10:28:53 EDT
Any idea of the time frame?
Comment 7 Michael Mráka 2016-05-26 03:22:39 EDT
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 09:45:25 EDT
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 05:33:13 EDT
as Michael said.

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