diff options
author | Fedora Python maintainers <python-devel@lists.fedoraproject.org> | 2020-07-15 13:41:24 (GMT) |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2020-09-29 13:59:05 (GMT) |
commit | 405ce2ca6e70f43ba0ee94ca61a3c1aedb2c7ccf (patch) | |
tree | b1034a87814c71662fff7de35e0c595215479430 /Modules | |
parent | 0dcf06e1f9d02d0280928cf075fb362c5545b3c8 (diff) | |
download | cpython-405ce2ca6e70f43ba0ee94ca61a3c1aedb2c7ccf.zip cpython-405ce2ca6e70f43ba0ee94ca61a3c1aedb2c7ccf.tar.gz cpython-405ce2ca6e70f43ba0ee94ca61a3c1aedb2c7ccf.tar.bz2 |
00174-fix-for-usr-move.patch
00174 #
Workaround for failure to set up prefix/exec_prefix when running
an embededed libpython that sets Py_SetProgramName() to a name not
on $PATH when run from the root directory due to
https://fedoraproject.org/wiki/Features/UsrMove
e.g. cmpi-bindings under systemd (rhbz#817554):
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/getpath.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c index 20d1779..eca6d69 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -502,6 +502,24 @@ calculate_path(void) MAXPATHLEN bytes long. */ + /* + Workaround for rhbz#817554, where an empty argv0_path erroneously + locates "prefix" as "/lib[64]/python2.7" due to it finding + "/lib[64]/python2.7/os.py" via the /lib -> /usr/lib symlink for + https://fedoraproject.org/wiki/Features/UsrMove + */ + if (argv0_path[0] == '\0' && 0 == strcmp(prog, "cmpi_swig")) { + /* + We have an empty argv0_path, presumably because prog aka + Py_GetProgramName() was not found on $PATH. + + Set argv0_path to "/usr/" so that search_for_prefix() and + search_for_exec_prefix() don't erroneously pick up + on /lib/ via the UsrMove symlink: + */ + strcpy(argv0_path, "/usr/"); + } + if (!(pfound = search_for_prefix(argv0_path, home))) { if (!Py_FrozenFlag) fprintf(stderr, |