Bug 893445

Summary: yum -C search whatever return error
Product: Red Hat Enterprise Linux 7 Reporter: Patrik Kis <pkis>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: james.antill, jzeleny, ksrot, zpavlas
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 669746 Environment:
Last Closed: 2013-07-19 08:19:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 903631    
Bug Blocks:    

Description Patrik Kis 2013-01-09 11:00:56 UTC
+++ This bug was initially created as a clone of Bug #669746 +++

Description of problem:
yum -C search whatever as a non-root does not works
This works on RHEL-6 so this can be considered as regression.

Version-Release number of selected component (if applicable):
yum-3.4.3-46.el7

How reproducible:
always

Steps to Reproduce:
# useradd testusr
#
# yum search zsh
Loaded plugins: product-id, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There was an error communicating with RHN.
RHN Satellite or RHN Classic support will be disabled.

Error Message:
	Please run rhn_register as root on this client
Error Class Code: 9
Error Class Info: Invalid System Credentials.
Explanation: 
     An error has occurred while processing your request. If this problem
     persists please enter a bug report at bugzilla.redhat.com.
     If you choose to submit the bug report, please be sure to include
     details of what you were trying to do when this error occurred and
     details on how to reproduce this problem.

=========================================== N/S Matched: zsh ===========================================
zsh-debuginfo.i686 : Debug information for package zsh
zsh-debuginfo.x86_64 : Debug information for package zsh
zsh-html.i686 : Zsh shell manual in html format
zsh-html.x86_64 : Zsh shell manual in html format
zsh.i686 : Powerful interactive shell
zsh.x86_64 : Powerful interactive shell

  Name and summary matches only, use "search all" for everything.
#
# su - testusr
$ yum -C search zsh
Loaded plugins: product-id, rhnplugin, security, subscription-manager
*Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.
Error: Cannot access repository dir /var/tmp/yum-testusr-GXZdje/x86_64/6.92Server/qa-tools
$ echo $?
1
$
  
Actual results:
yum return error
yum makecache as user root does not help

Expected results:
yum return the search result like in RHEL-6

Additional info:gg
In RHEL6 this works:
# useradd testusr
# 
# yum search zsh
Loaded plugins: downloadonly, fastestmirror, product-id, security, subscription-manager, tmprepo
Updating certificate-based repositories.
Unable to read consumer identity
Loading mirror speeds from cached hostfile
=========================================== N/S Matched: zsh ===========================================
python-twisted-core-zsh.x86_64 : Tab completion for Zsh and Twisted Core
zsh-debuginfo.x86_64 : Debug information for package zsh
zsh-html.x86_64 : Zsh shell manual in html format
zsh.x86_64 : A powerful interactive shell

  Name and summary matches only, use "search all" for everything.
# 
# su - testusr
$ yum -C search zsh
Loaded plugins: downloadonly, fastestmirror, product-id, security, subscription-manager, tmprepo
Not root, certificate-based repositories not updated
=========================================== N/S Matched: zsh ===========================================
python-twisted-core-zsh.x86_64 : Tab completion for Zsh and Twisted Core
zsh-debuginfo.x86_64 : Debug information for package zsh
zsh-html.x86_64 : Zsh shell manual in html format
zsh.x86_64 : A powerful interactive shell

  Name and summary matches only, use "search all" for everything.
$

Comment 2 Zdeněk Pavlas 2013-06-13 14:17:34 UTC
The problem is that:

1) since commit 0f03409 (Tue Dec 13 15:43:30 2011) users always have their own cachedir (even when -C is in use)

2) The -C option instructs Yum NOT to attempt any modification of the cachedir.

As a result, preloading from root to user cachedir does not work when user runs "yum -C .."  I wrote a patch to fix (some cases of) this, but it's not upstream.  It's also questionable whether it's a bug or not.  See this thread:

http://lists.baseurl.org/pipermail/yum-devel/2012-June/009298.html

Comment 3 James Antill 2013-06-18 20:01:19 UTC
 Yeh, not much has changed since that thread. In theory we can change .cache = 1 to mean "no network activity" and declare all past API usage of cachedir=<system>, cache=1 as broken/bad ... but we should really have done that sooner.
 From what I can see all current yum-utils scripts "behave" and wouldn't trigger this problem.


 Maybe putting the access() check from the thread:

http://lists.baseurl.org/pipermail/yum-devel/2013-June/010175.html

...into a property (cached) and using that to say "can't modify" instead of cache=1 would be quick and have no downsides (push it and se^W run ;).

Comment 4 Jan Zeleny 2013-07-19 08:19:49 UTC
Reviewed the dependency on #903631 and assessed it to be a duplicate.

*** This bug has been marked as a duplicate of bug 903631 ***