[Yum-devel] [PATCH] Check .repo file permissions. BZ 809598.

Zdeněk Pavlas zpavlas at redhat.com
Wed Apr 4 10:35:25 UTC 2012


Sometimes, people add .repo files with perm=600.
Report the problem but don't abort.
---
 yum/__init__.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 82a9380..c9bc815 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -542,6 +542,9 @@ class YumBase(depsolve.Depsolve):
 
             if os.path.isdir(reposdir):
                 for repofn in sorted(glob.glob('%s/*.repo' % reposdir)):
+                    if not os.access(repofn, os.R_OK):
+                        self.logger.warning(_("Skipping unreadable repository %s"), repr(repofn))
+                        continue
                     thisrepo_age = os.stat(repofn)[8]
                     if thisrepo_age < repo_config_age:
                         thisrepo_age = repo_config_age
-- 
1.7.4.4



More information about the Yum-devel mailing list