[Yum-devel] [PATCH] make sure we behave correctly if we cannot get the cachedir setup

James Antill james at fedoraproject.org
Wed Dec 9 21:16:36 UTC 2009


On Wed, 2009-12-09 at 15:14 -0500, Seth Vidal wrote:
> if someone sets the perms on the tmpdir/cachedir VERY wrong make sure
> we emit an error and do something sensible about it.
> 
> rh bug: https://bugzilla.redhat.com/show_bug.cgi?id=543768
> ---
>  yum/__init__.py |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/yum/__init__.py b/yum/__init__.py
> index 9613378..220be09 100644
> --- a/yum/__init__.py
> +++ b/yum/__init__.py
> @@ -4168,8 +4168,12 @@ class YumBase(depsolve.Depsolve):
>  
>          if not force and os.geteuid() == 0:
>              return True # We are root, not forced, so happy with the global dir.
> -
> -        cachedir = misc.getCacheDir(tmpdir, reuse)
> +        try:
> +            cachedir = misc.getCacheDir(tmpdir, reuse)
> +        except (IOError, OSError), e:
> +            self.logger.critical(_('Could not set cachedir: %s') % str(e))
> +            cachedir = None
> +            

 Do we need the assignment too? Either way ACK.

>          if cachedir is None:
>              return False # Tried, but failed, to get a "user" cachedir
>  



More information about the Yum-devel mailing list