[Yum-devel] [PATCH] Don't create dirs. in cwd, when repo.base_persistdir isn't set.
seth vidal
skvidal at fedoraproject.org
Wed Apr 6 19:36:28 UTC 2011
On Wed, 2011-04-06 at 15:06 -0400, James Antill wrote:
> On Wed, 2011-04-06 at 15:03 -0400, seth vidal wrote:
> > On Wed, 2011-04-06 at 14:34 -0400, James Antill wrote:
> > > ---
> > > yum/yumRepo.py | 12 +++++++++++-
> > > 1 files changed, 11 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/yum/yumRepo.py b/yum/yumRepo.py
> > > index 6ba058c..2246aec 100644
> > > --- a/yum/yumRepo.py
> > > +++ b/yum/yumRepo.py
> > > @@ -544,7 +544,17 @@ class YumRepository(Repository, config.RepoConf):
> > > """make the necessary dirs, if possible, raise on failure"""
> > >
> > > cachedir = os.path.join(self.basecachedir, self.id)
> > > - persistdir = os.path.join(self.base_persistdir, self.id)
> > > + if self.base_persistdir and self.base_persistdir[0] == '/':
> > > + persistdir = self.base_persistdir
> > > + else:
> > > + # This sucks, because cakeys can't work ... but it's better
> > > + # than creating dirs. in the currect dir.
> > > + if tmpdir is None:
> > > + tmpdir = os.getenv('TMPDIR')
> > > + if tmpdir is None: # Note that TMPDIR isn't exported by default :(
> > > + tmpdir = '/var/tmp'
> > > + persistdir = misc.getCacheDir(tmpdir=tmpdir)
> > > + persistdir = os.path.join(persistdir, self.id)
> > > pkgdir = os.path.join(cachedir, 'packages')
> > > hdrdir = os.path.join(cachedir, 'headers')
> > > self.setAttribute('_dir_setup_cachedir', cachedir)
> >
> >
> > So is the situation here that the root user has not done anything to
> > make the persistdirs?
>
> No, it's that some random piece of code "creates" a repo. ... but it
> doesn't set base_persistdir ... so it's the default of ''. The above
> turns that into 'foobar', and then yum creates that dir. in $CWD and
> everyone is unhappy :).
grumble.
How about we just call the repo 'bad' if it lacks a base_persistdir and
drop it on the floor.
make the random code fix it?
-sv
More information about the Yum-devel
mailing list