From fc9d387719e851f49994351cf645961ada7f3b4c Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 18 May 2016 10:37:39 +0900 Subject: [PATCH] Crash python3 running at x86_64 [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] N/A [Occurrence Version] N/A [Problem] When python excute, python's library loading failed. [Cause & Measure] At getpath.c, python lib path is hardcoding. fixed, lib path value set from spec file's defined value. [Checking Method] running python excute binary. [Team] Open Source Management and Setting Part [Developer] dh0128.kwak [Solution company] Samsung [Change Type] N/A Change-Id: Ic23ee87c8b352a013f8736a5b9491ab0deac818a Signed-off-by: DongHun Kwak --- Makefile.pre.in | 2 ++ Modules/getpath.c | 6 +++++- packaging/python3-base.spec | 2 +- packaging/python3.spec | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 809e1c77..f81c261f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -128,6 +128,7 @@ BINLIBDEST= $(LIBDIR)/python$(VERSION) LIBDEST= $(SCRIPTDIR)/python$(VERSION) INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION) CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION) +BASE_LIB= lib # Symbols used for using shared libraries SHLIB_SUFFIX= @SHLIB_SUFFIX@ @@ -711,6 +712,7 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile -DEXEC_PREFIX='"$(exec_prefix)"' \ -DVERSION='"$(VERSION)"' \ -DVPATH='"$(VPATH)"' \ + -DBASE_LIB='"$(BASE_LIB)"' \ -o $@ $(srcdir)/Modules/getpath.c Modules/python.o: $(srcdir)/Modules/python.c diff --git a/Modules/getpath.c b/Modules/getpath.c index 13e38172..3d196fc4 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -126,6 +126,10 @@ #define LANDMARK L"os.py" #endif +#ifndef BASE_LIB +#define BASE_LIB "lib" +#endif + static wchar_t prefix[MAXPATHLEN+1]; static wchar_t exec_prefix[MAXPATHLEN+1]; static wchar_t progpath[MAXPATHLEN+1]; @@ -494,7 +498,7 @@ calculate_path(void) _pythonpath = _Py_char2wchar(PYTHONPATH, NULL); _prefix = _Py_char2wchar(PREFIX, NULL); _exec_prefix = _Py_char2wchar(EXEC_PREFIX, NULL); - lib_python = _Py_char2wchar("lib/python" VERSION, NULL); + lib_python = _Py_char2wchar(BASE_LIB "/python" VERSION, NULL); if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) { Py_FatalError( diff --git a/packaging/python3-base.spec b/packaging/python3-base.spec index ed92ada7..b26c758e 100644 --- a/packaging/python3-base.spec +++ b/packaging/python3-base.spec @@ -258,7 +258,7 @@ target=profile-opt target=all %endif LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH \ - make %{?_smp_mflags} $target + make %{?_smp_mflags} BASE_LIB=%{_lib} $target %check # SUSE's gdb breaks test_gdb by producing spurious output (zypper suggestions) diff --git a/packaging/python3.spec b/packaging/python3.spec index 74c10b64..a082080f 100644 --- a/packaging/python3.spec +++ b/packaging/python3.spec @@ -177,7 +177,7 @@ touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h Objects/typeslots.in --with-ensurepip=no \ --enable-loadable-sqlite-extensions -make %{?_smp_mflags} # DESTDIR=$RPM_BUILD_ROOT +make %{?_smp_mflags} BASE_LIB=%{_lib} %check # Limit virtual memory to avoid spurious failures -- 2.34.1