Bug 1080331 - dnf group list fail to run with noroot plugin
Summary: dnf group list fail to run with noroot plugin
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1062889
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-25 07:50 UTC by Tim Lauridsen
Modified: 2014-09-30 23:42 UTC (History)
4 users (show)

Fixed In Version: dnf-plugins-core-0.0.8-2.fc20
Clone Of:
Environment:
Last Closed: 2014-05-31 23:59:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
fix for group install (1.89 KB, patch)
2014-04-08 05:25 UTC, Tim Lauridsen
no flags Details | Diff
Better patch (1.89 KB, patch)
2014-04-08 05:47 UTC, Tim Lauridsen
no flags Details | Diff
Better patch (wrong checkout) (1.85 KB, patch)
2014-04-08 05:50 UTC, Tim Lauridsen
no flags Details | Diff
fix for group install (3.05 KB, patch)
2014-04-08 06:31 UTC, Tim Lauridsen
no flags Details | Diff

Description Tim Lauridsen 2014-03-25 07:50:09 UTC
Description of problem:
if dnf-plugins-core is install, it is not possible to run 
dnf group list
dnf group info

as non root


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

How reproducible:
every time

Steps to Reproduce:
1. dnf group list
2.
3.

Actual results:

Error: This command has to be run under the root user.

Expected results:

list the groups

Additional info:

dnf group list --noplugins works as a work around

The problem is that the GroupCommand class
is setting 
writes_rpmdb = True

that triggers the noroot plugin.

A solution could be to split the GroupCommand in 2, one with read only commands and one with the commands there is making changes to the system.

Another one is to have an optional nowrite_rpmdb_subcmd = ['install', 'remove', .....]

and change to noroot to look at 

writes_rpmdb = True

and 

subcmd not in nowrite_rpmdb_subcmd

Comment 1 Tim Lauridsen 2014-03-25 07:51:07 UTC
IT should have been :)

nowrite_rpmdb_subcmd = ['list', 'info', .....]

Comment 2 Ales Kozumplik 2014-03-25 11:52:16 UTC
Thanks Tim. This issue awaits the signups implementation and fix to bug 1062889.

Comment 3 Ales Kozumplik 2014-04-07 16:30:28 UTC
Fixed by 680ad20.

Comment 4 Tim Lauridsen 2014-04-08 05:24:22 UTC
group info & group list works as non root now, thanks

All non-root group cmds gives a
[Errno 13] Permission denied: '/var/lib/dnf/groups.json'

this might confuse the user and give a number of bugzilla reports.

group install xxxx is still broken in 0.5

THe issue is in

    def _install(self, extcmds):
        cnt = 0
        types, patterns = self._split_extcmds(extcmds)
        for env in self._patterns2environments(patterns):
            cnt += self.base.environment_install(env, types)
        for grp in self._patterns2groups(patterns):
            cnt += self.base.group_install(grp, types)
        if not cnt:
            msg = _('No packages in any requested groups available to install.')
            raise dnf.cli.CliError(msg)


self._patterns2environments will raise an a CliError("No relevant match for the specified xxxx") if xxxx is not an evironment id.

the patterns2 helper uses by _patterns2groups & _patterns2environments
should proberly not raise and CliError, it should be handled on a higher level.

    def _patterns2(fn, patterns, fltr):
        for pat in patterns:
            grps = fn(pat)
            cnt = 0
            for grp in grps:
                if not fltr(grp):
                    continue
                yield grp
                cnt += 1
            if not cnt:
                msg = _("No relevant match for the specified '%s'.")
                msg = msg % to_unicode(pat)
                raise dnf.cli.CliError(msg)

Comment 5 Tim Lauridsen 2014-04-08 05:25:37 UTC
Created attachment 883863 [details]
fix for group install

Fix for the group install not working isssue

Comment 6 Tim Lauridsen 2014-04-08 05:47:39 UTC
Created attachment 883876 [details]
Better patch

Comment 7 Tim Lauridsen 2014-04-08 05:50:03 UTC
Created attachment 883877 [details]
Better patch (wrong checkout)

Comment 8 Tim Lauridsen 2014-04-08 06:31:17 UTC
Created attachment 883892 [details]
fix for group install

group remove also fixed
demands.resolving set, so the packages are installed/removed

Comment 9 Fedora Update System 2014-05-02 08:32:37 UTC
dnf-0.5.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.5.1-1.fc20

Comment 10 Fedora Update System 2014-05-02 21:05:10 UTC
Package dnf-0.5.1-1.fc20, hawkey-0.4.14-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.5.1-1.fc20 hawkey-0.4.14-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5937/hawkey-0.4.14-1.fc20,dnf-0.5.1-1.fc20
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2014-05-28 12:10:28 UTC
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20

Comment 12 Fedora Update System 2014-05-28 23:50:26 UTC
Package dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.0.8-2.fc20 libsolv-0.6.1-1.git6d968f1.fc20 hawkey-0.4.16-1.fc20 dnf-0.5.2-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-6789/libsolv-0.6.1-1.git6d968f1.fc20,hawkey-0.4.16-1.fc20,dnf-0.5.2-1.fc20,dnf-plugins-core-0.0.8-2.fc20
then log in and leave karma (feedback).

Comment 13 Fedora Update System 2014-05-31 23:59:03 UTC
dnf-plugins-core-0.0.8-2.fc20, libsolv-0.6.1-1.git6d968f1.fc20, hawkey-0.4.16-1.fc20, dnf-0.5.2-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, 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.