[Yum-devel] [PATCH] make sure we behave correctly if we cannot get the cachedir setup
Seth Vidal
skvidal at fedoraproject.org
Wed Dec 9 21:20:07 UTC 2009
On Wed, 9 Dec 2009, James Antill wrote:
> 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.
I think we do - the function wouldn't return to set cachedir to None so
cachedir would not be defined in that function at all so we'd be get a
variable used before defined error on line 4177 otherwise, I think.
-sv
More information about the Yum-devel
mailing list