Bug 1575352 - mock --version requires administrative privileges
Summary: mock --version requires administrative privileges
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 27
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2018-05-06 08:23 UTC by Georg Sauthoff
Modified: 2018-05-09 07:49 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2018-05-09 07:49:50 UTC
Type: Bug

Attachments (Terms of Use)

Description Georg Sauthoff 2018-05-06 08:23:56 UTC
Description of problem:
Invoking a simple `mock --version` command yields a root password prompt, if your user isn't in the 'mock' group.

Sure, one can work around this via `rpm -q mock`. But this also breaks fedora-review which unconditionally calls `mock --version` even if it doesn't need to use mock - e.g. with `fedora-review --help`, `fedora-review --version` or `fedora-review --prebuilt ...`.

One could argue that fedora-review should be fixed instead but requiring root for displaying the version string is just the most surprising thing and thus clearly violates the principle of least astonishment. See also https://bugzilla.redhat.com/show_bug.cgi?id=366711#c3 for another surprised user.

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

How reproducible:

Steps to Reproduce:
1. make sure that your user isn't a member of the 'mock' group
2. mock --version

Actual results:
You are attempting to run "mock" which requires administrative
privileges, but more information is needed in order to do so.
Authenticating as "root"

Expected results:
The trivial output of the version number.

Additional info:

Comment 1 Miroslav Suchý 2018-05-09 07:49:50 UTC
This will be very complicated to implement. The checking of privilege is done consolehelper before mock is actually executed. So I cannot really done there some "if args[0] == '--version' then do not ask for root"

If fedora-review needs this (and do not want to run 'rpm -q' for some reason') you can run:
  /usr/libexec/mock/mock --version
This executable is run by consolehelper itself and does not check for the root.

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