[Yum-devel] [PATCH 1/2] Check CWD earlier. Related: rhbz#711358

Zdeněk Pavlas zpavlas at redhat.com
Tue Apr 17 11:45:08 UTC 2012


Check the current directory before instantiating YumBase,
and before processing config and options.  This avoids
a possible traceback with '-cfg' option.

Forward port from RHEL6.3
---
 yummain.py |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/yummain.py b/yummain.py
index c473df6..e3a232b 100755
--- a/yummain.py
+++ b/yummain.py
@@ -89,18 +89,6 @@ def main(args):
     logger = logging.getLogger("yum.main")
     verbose_logger = logging.getLogger("yum.verbose.main")
 
-    # our core object for the cli
-    base = cli.YumBaseCli()
-
-    # do our cli parsing and config file setup
-    # also sanity check the things being passed on the cli
-    try:
-        base.getOptionsConfig(args)
-    except plugins.PluginYumExit, e:
-        return exPluginExit(e)
-    except Errors.YumBaseError, e:
-        return exFatal(e)
-
     # Try to open the current directory to see if we have 
     # read and execute access. If not, chdir to /
     try:
@@ -118,6 +106,18 @@ def main(args):
             logger.critical(_('No getcwd() access in current directory, moving to /'))
             os.chdir("/")
 
+    # our core object for the cli
+    base = cli.YumBaseCli()
+
+    # do our cli parsing and config file setup
+    # also sanity check the things being passed on the cli
+    try:
+        base.getOptionsConfig(args)
+    except plugins.PluginYumExit, e:
+        return exPluginExit(e)
+    except Errors.YumBaseError, e:
+        return exFatal(e)
+
     lockerr = ""
     while True:
         try:
-- 
1.7.4.4



More information about the Yum-devel mailing list