Blame SOURCES/00174-fix-for-usr-move.patch

925e6b
diff -up Python-2.7.3/Modules/getpath.c.fix-for-usr-move Python-2.7.3/Modules/getpath.c
925e6b
--- Python-2.7.3/Modules/getpath.c.fix-for-usr-move	2013-03-06 14:25:32.801828698 -0500
925e6b
+++ Python-2.7.3/Modules/getpath.c	2013-03-06 15:59:30.872443168 -0500
925e6b
@@ -510,6 +510,24 @@ calculate_path(void)
925e6b
        MAXPATHLEN bytes long.
925e6b
     */
925e6b
 
925e6b
+    /*
925e6b
+      Workaround for rhbz#817554, where an empty argv0_path erroneously
925e6b
+      locates "prefix" as "/lib[64]/python2.7" due to it finding
925e6b
+      "/lib[64]/python2.7/os.py" via the /lib -> /usr/lib symlink for
925e6b
+      https://fedoraproject.org/wiki/Features/UsrMove
925e6b
+    */
925e6b
+    if (argv0_path[0] == '\0' && 0 == strcmp(prog, "cmpi_swig")) {
925e6b
+        /*
925e6b
+          We have an empty argv0_path, presumably because prog aka
925e6b
+          Py_GetProgramName() was not found on $PATH.
925e6b
+
925e6b
+          Set argv0_path to "/usr/" so that search_for_prefix() and
925e6b
+          search_for_exec_prefix() don't erroneously pick up
925e6b
+          on /lib/ via the UsrMove symlink:
925e6b
+        */
925e6b
+        strcpy(argv0_path, "/usr/");
925e6b
+    }
925e6b
+
925e6b
     if (!(pfound = search_for_prefix(argv0_path, home))) {
925e6b
         if (!Py_FrozenFlag)
925e6b
             fprintf(stderr,