Bug 1659588
Summary: | repotrack --repofrompath and --repoid parameters with -t or --tempcache options don't work as non-root user | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | afox <afox> | ||||
Component: | yum-utils | Assignee: | Michal Domonkos <mdomonko> | ||||
Status: | CLOSED ERRATA | QA Contact: | Jan Blazek <jblazek> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 7.6 | CC: | kabbott, kwalker, mdomonko, mnk, packaging-team-maint | ||||
Target Milestone: | rc | Keywords: | Triaged | ||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | yum-utils-1.1.31-53.el7 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2020-03-31 20:07:41 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
afox@redhat.com
2018-12-14 18:01:15 UTC
Created attachment 1589175 [details]
repotrack: Move the setCacheDir operation to after repofrompath
On further inspection, it looks like this should be pretty simple to fix... The difficulty is the following:
# do the happy tmpdir thing if we're not root
if os.geteuid() != 0 or opts.tempcache:
cachedir = getCacheDir()
if cachedir is None:
print >> sys.stderr, "Error: Could not make cachedir, exiting"
sys.exit(50)
my.repos.setCacheDir(cachedir)
This creates a temporary cache directory named for the current user.
$ ll /var/tmp/yum-vagrant-Fl8ySL/
However, the key to the problem is that EPERM is coming from the /var/cache/yum/ directory.
IOError: [Errno 13] Permission denied: '/var/cache/yum/x86_64/7Server/oo/repomd.xml.old.tmp'
This is due to the above cachedir variable not being applied to repofrompath repos in subsequent operations:
if opts.repofrompath:
for repo in opts.repofrompath:
tmp = tuple(repo.split(','))
if len(tmp) != 2:
my.logger.error("Error: Bad repofrompath argument: %s" %repo)
continue
repoid, repopath = tmp
if repopath and repopath[0] == '/':
baseurl = 'file://' + repopath
else:
baseurl = repopath
try:
my.add_enable_repo(repoid, baseurls=[baseurl],
basecachedir=my.conf.cachedir,
timestamp_check=False)
except yum.Errors.DuplicateRepoError, e:
my.logger.error(e)
sys.exit(1)
if not opts.quiet:
my.logger.info("Added %s repo from %s" % (repoid, repopath))
I've attached a patch that fixes the condition.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:1158 |