Bug 1215208 - Double-dash ("--") argument separator is not supported
Summary: Double-dash ("--") argument separator is not supported
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 23
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-24 15:07 UTC by Nikolai Kondrashov
Modified: 2016-10-04 19:13 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-21 09:20:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1212693 0 unspecified CLOSED dnf does not consistently exit immediately when an invalid option is given 2021-02-22 00:41:40 UTC

Internal Links: 1212693

Description Nikolai Kondrashov 2015-04-24 15:07:34 UTC
Description of problem:
DNF doesn't support the standard double-dash ("--") option-argument separator, which yum supported. This breaks yum compatibility and prevents safe invocation of DNF with arbitrary command arguments.

E.g. if a program is expecting an arbitrary list of packages to install, it can no longer safely pass them to yum.

Before it was possible to do this in Bash:

    yum install --assumeyes -- "${PACKAGE_LIST[@]"

Now that doesn't work, producing this error message instead:

    No package -- available.
    Error: no package matched: --

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

How reproducible:
Always

Steps to Reproduce:
Execute "dnf install -- dnf"

Actual results:
No package -- available.
Error: no package matched: --

Expected results:
Using metadata from Fri Apr 24 16:46:28 2015 (0:19:58 hours old)
Package dnf-0.6.5-1.fc23.noarch is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!

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

Strictly speaking, the man pages say that the synopsis is "dnf [options] <command> [<args>...]". So, anything passed after a "<command>" should be handled as an argument of the command. E.g. in case of the install command, anything after the "install" word should be considered a package specification.

This means that there is no actual need for means that mark that no switches will follow. The command name serves that purpose. And also no command name starts with a dash.

But I admit that although we don't (officially) support passing switches after the command name, it works (sometimes).

So, I am not trying to say that we shouldn't support this separator. I just wanted to tell that so far, this is an RFE, not a bug. And unless we agree that we want to support using switches after the command name, the priority of the request is low.

Comment 2 Nikolai Kondrashov 2015-04-27 10:26:43 UTC
Hello, Radek.

I disagree that this is RFE. DNF seems to accept options after a command name perfectly fine, at least for "install", the most important case for us. Examples:

dnf install --help
dnf install dnf --help
dnf install dnf -d 10 bash
dnf install --assumeyes bash --assumeno

This is a clear compatibility breakage. Yum supported this, DNF doesn't.

This breaks sudo rule security. With yum you could rely on the fact that whatever is passed after "--" will only be interpreted as package name. With DNF you can't do that. Now you'll have to remove "--", opening yourself to, e.g. "--enablerepo=" being passed along with package names.

Comment 3 Radek Holy 2015-04-27 10:53:34 UTC
As I said, although it isn't (officially) supported, it works (sometimes).

Comment 4 Jan Kurik 2015-07-15 14:14:32 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 5 Honza Silhan 2015-07-22 09:38:12 UTC
It should be fixed automatically with DNF argparser refactoring using subparsers.

Comment 6 Nikolai Kondrashov 2015-07-22 09:45:07 UTC
Great! Thank you, Jan!
This change would be welcome. For now I have to fall back to yum.

Comment 7 Nikolai Kondrashov 2015-09-30 14:27:24 UTC
Jan Silhan, could you please give an ETA for the fix? Thank you.

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

Comment 9 Igor Gnatenko 2016-07-21 09:20:56 UTC
Merged, will be part of DNF 2.0 release which will be released at some point soon.


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